[HELP] ADC not stable.

fahad_ali_sarwar
Posts: 2
Joined: Mon Jan 11, 2021 9:08 am

[HELP] ADC not stable.

Postby fahad_ali_sarwar » Tue Jan 26, 2021 11:15 am

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/
Attachments
df.PNG
df.PNG (3.93 KiB) Viewed 6004 times
WhatsApp Image 2021-01-26 at 12.12.47 PM.jpeg
WhatsApp Image 2021-01-26 at 12.12.47 PM.jpeg (173.59 KiB) Viewed 6004 times

Michalpu
Posts: 22
Joined: Sun Jan 24, 2021 1:37 pm

Re: [HELP] ADC not stable.

Postby Michalpu » Tue Jan 26, 2021 8:11 pm

What is the refresh rate of your sensr and what regresh rate you have in code
Content creator at https://911electronic.com

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: [HELP] ADC not stable.

Postby ESP_Sprite » Wed Jan 27, 2021 12:29 am

Also you probably want to parallel a small capacitor to that resistor, to get rid of any noise.

becorey
Posts: 92
Joined: Sat Mar 28, 2020 4:18 pm

Re: [HELP] ADC not stable.

Postby becorey » Sun Jan 31, 2021 5:57 am

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).

Who is online

Users browsing this forum: No registered users and 76 guests