Hello all,
First time posting here. I am currently having an issue with reading an analog signal from an off-axis rotary encoder sensor using the Teensy 4.1. The issue is that the signal that I get is fairly noisy; with 10 bit resolution, the signal fluctuates by around plus or minus 5.
My hardware setup consists of a 12V lipo battery powering a MCIGICM LM2596 Buck Converter, which produces the 5V that power the encoder. All of these components and the teensy share a common ground. I am currently powering the teensy via USB.
I have done some troubleshooting:
- I looked at the analog signal noise when all of the above electronics were disconnected from the teensy and the voltage signal was the 3.3V teensy power supply, ground, or a voltage obtained through a voltage divider between 3.3V and ground. The obtained signals were almost noiseless.
- I measured the sensor and buck converter voltages with a multimeter. These voltages did not appear to fluctuate at all on my multimeter (no noise observed with plus or minus 1 mV resolution), but I'm not sure whether or not my multimeter contains any low pass filtering elements which may have eliminated the noise observed with the teensy.
- Connected the teensy analog pin directly to the buck converter Vout+ terminal with the buck converter output voltage set to ~2.7 V. I observed noise of plus or minus 2 (out of 1024) with this setup.
- Connected the teensy analog pin directly to a DC power supply set to 2.7 V. I also continued to observe noise of plus or minus 1 or 2 with this setup.
My test code is as follows:
Does anyone have any ideas regarding where the analog signal noise is coming from and how I can get rid of it? I am a mechanical engineering student and am relatively new to microcontrollers/mechatronics, so I may be missing something simple here. Thanks in advance.
The encoder sensor documentation can be found here: http://www.team221.com/robotopen/product.php?id=155
I purchased the buck converter through Amazon here: https://www.amazon.com/MCIGICM-step...keywords=buck+converter&qid=1613515325&sr=8-4
First time posting here. I am currently having an issue with reading an analog signal from an off-axis rotary encoder sensor using the Teensy 4.1. The issue is that the signal that I get is fairly noisy; with 10 bit resolution, the signal fluctuates by around plus or minus 5.
My hardware setup consists of a 12V lipo battery powering a MCIGICM LM2596 Buck Converter, which produces the 5V that power the encoder. All of these components and the teensy share a common ground. I am currently powering the teensy via USB.
I have done some troubleshooting:
- I looked at the analog signal noise when all of the above electronics were disconnected from the teensy and the voltage signal was the 3.3V teensy power supply, ground, or a voltage obtained through a voltage divider between 3.3V and ground. The obtained signals were almost noiseless.
- I measured the sensor and buck converter voltages with a multimeter. These voltages did not appear to fluctuate at all on my multimeter (no noise observed with plus or minus 1 mV resolution), but I'm not sure whether or not my multimeter contains any low pass filtering elements which may have eliminated the noise observed with the teensy.
- Connected the teensy analog pin directly to the buck converter Vout+ terminal with the buck converter output voltage set to ~2.7 V. I observed noise of plus or minus 2 (out of 1024) with this setup.
- Connected the teensy analog pin directly to a DC power supply set to 2.7 V. I also continued to observe noise of plus or minus 1 or 2 with this setup.
My test code is as follows:
Code:
const int encPin = 9;
float pinVal;
void setup() {
Serial.begin(9600);
delay(1000);
}
void loop() {
pinVal = analogRead(encPin);
Serial.println(pinVal);
delay(500);
}
Does anyone have any ideas regarding where the analog signal noise is coming from and how I can get rid of it? I am a mechanical engineering student and am relatively new to microcontrollers/mechatronics, so I may be missing something simple here. Thanks in advance.
The encoder sensor documentation can be found here: http://www.team221.com/robotopen/product.php?id=155
I purchased the buck converter through Amazon here: https://www.amazon.com/MCIGICM-step...keywords=buck+converter&qid=1613515325&sr=8-4