I have a humidity analog sensor that I am trying to read. The sensor outputs a 4-20 mA signal. I converted it into a 0 - 3.3V potential with a 165 Ohm resistor. When I measure the voltage across the resistors with a multimeter, I get the correct values. I get a voltage of around 2.9V which corresponds to about 87 % humidity which seems to be correct. However the values of ADC are haywire. I get values between 2500 to 4095, which correspond to between 61 % and 100 % humidity. The sensor is quite accurate so its not a problem with the sensor. I am using ADC on pin 25.
My circuit is shown as an attachment..
I have also attached the values of ADC measured/
[HELP] ADC not stable.
-
- Posts: 2
- Joined: Mon Jan 11, 2021 9:08 am
[HELP] ADC not stable.
- Attachments
-
- df.PNG (3.93 KiB) Viewed 6007 times
-
- WhatsApp Image 2021-01-26 at 12.12.47 PM.jpeg (173.59 KiB) Viewed 6007 times
Re: [HELP] ADC not stable.
What is the refresh rate of your sensr and what regresh rate you have in code
Content creator at https://911electronic.com
-
- Posts: 9769
- Joined: Thu Nov 26, 2015 4:08 am
Re: [HELP] ADC not stable.
Also you probably want to parallel a small capacitor to that resistor, to get rid of any noise.
Re: [HELP] ADC not stable.
1) use RC low pass filter after your 165 Ohm resistor, filter out frequencies higher than the rate you expect the humidity to change.
2) use averaging in code, i.e. average 20 samples to get one "good" sample value
3) the adc value to voltage conversion is not 2500/4095*3.3, it needs to use the adc vref calibration value which is slightly different for each esp32. It turns out to be near 3.6 instead of 3.3.
Read https://docs.espressif.com/projects/esp ... 5%20-%2027).
2) use averaging in code, i.e. average 20 samples to get one "good" sample value
3) the adc value to voltage conversion is not 2500/4095*3.3, it needs to use the adc vref calibration value which is slightly different for each esp32. It turns out to be near 3.6 instead of 3.3.
Read https://docs.espressif.com/projects/esp ... 5%20-%2027).
Who is online
Users browsing this forum: No registered users and 59 guests