ESP32 ADC Non-linear Issues - How do I fix / change Attenuation or width?
-
- Posts: 90
- Joined: Sun Jul 02, 2017 3:38 am
Re: ESP32 ADC Non-linear Issues - How do I fix / change Attenuation or width?
Interesting, it never occurred to me that he wasn't calling the functions - that would definitely explain it.
Re: ESP32 ADC Non-linear Issues - How do I fix / change Attenuation or width?
I didn't know I had to call those within a function so they kept throwing "expected constructor, destructor, or type conversion before '(' token", I was trying to put them with my define lines since I thought they needed to be called before anything else and logically that made sense to me. So when they threw errors I looked at the examples and made them match which now I realize, as you pointed out, I was just defining them and not calling them.
I put them into my setup() and now they compile correctly. I'll test it tonight and see if it worked. Thanks.
I put them into my setup() and now they compile correctly. I'll test it tonight and see if it worked. Thanks.
Re: ESP32 ADC Non-linear Issues - How do I fix / change Attenuation or width?
FYI - my results after making the changes for anyone that could use it:
Orange = 6db attenuation
Blue = 11db attenuation
Orange = 6db attenuation
Blue = 11db attenuation
Last edited by vseven on Wed Sep 06, 2017 5:10 pm, edited 1 time in total.
Re: ESP32 ADC Non-linear Issues - How do I fix / change Attenuation or width?
Apparently there is a three file max on posts so here is the raw data
- Attachments
-
- ESP32-S ADC Mapping 11-bit.csv
- (586 Bytes) Downloaded 1617 times
-
- ESP32-S ADC Mapping - 12-bit.csv
- (1.75 KiB) Downloaded 1749 times
Re: ESP32 ADC Non-linear Issues - How do I fix / change Attenuation or width?
The -6dB range with 11 bits looks quite linear, if only this 0.1V offset would not exist.
But for your application with a 0..10V Input you need anyway an external resistor voltage divider, so you can just add a third resistor to lift the voltage by 0.1 V. Here is a possible circuit:
But for your application with a 0..10V Input you need anyway an external resistor voltage divider, so you can just add a third resistor to lift the voltage by 0.1 V. Here is a possible circuit:
Re: ESP32 ADC Non-linear Issues - How do I fix / change Attenuation or width?
My sensors are actually 4-20ma that I'm converting already with a current -> voltage adapter. The one i have lets me change the zero and max so i have it set for what seemed to be the most linear part of the range which was 0.20v (105 on ADC) and ending at 1.85v (1980 on ADC). I then scalled my sensors, temperature and humidity, to map to that ADC range.
Actual Temp: 61.96* / ESP32 Temp: 62.42*
Actual Humidity: 62.14% / ESP32 Humidity: 62.17%
I'm only reading every minute and a thunderstorm was rolling in (temp was dropping rapidly) so I'm calling it a success even with the slight difference in temperature. I also did a max range test, sending 4ma down the 20ma and i was within 0.1% of both high and low ends.
HUGE difference in linearity using 6db and in reduction of noise using 11-bit.
Actual Temp: 61.96* / ESP32 Temp: 62.42*
Actual Humidity: 62.14% / ESP32 Humidity: 62.17%
I'm only reading every minute and a thunderstorm was rolling in (temp was dropping rapidly) so I'm calling it a success even with the slight difference in temperature. I also did a max range test, sending 4ma down the 20ma and i was within 0.1% of both high and low ends.
HUGE difference in linearity using 6db and in reduction of noise using 11-bit.
-
- Posts: 90
- Joined: Sun Jul 02, 2017 3:38 am
Re: ESP32 ADC Non-linear Issues - How do I fix / change Attenuation or width?
What are you using to determine actual temperature and humidity?
-
- Posts: 90
- Joined: Sun Jul 02, 2017 3:38 am
Re: ESP32 ADC Non-linear Issues - How do I fix / change Attenuation or width?
Interesting.
You compare actual to ESP32 above. What was being compared?
You compare actual to ESP32 above. What was being compared?
Re: ESP32 ADC Non-linear Issues - How do I fix / change Attenuation or width?
I have a commercial grade device that reads 4 - 20ma and scaled the temp and humidity for those readings. I compared that to known good calibrated temperature and humidity sensors. Once that was calibrated I used that reading against the ESP32 reading to verify the accuracy.
Who is online
Users browsing this forum: No registered users and 44 guests