known problems with adc1_get_voltage ?

jumjum123
Posts: 199
Joined: Mon Oct 17, 2016 3:11 pm

known problems with adc1_get_voltage ?

Postby jumjum123 » Mon Dec 12, 2016 9:26 am

During first test of adc1 with 0.3V and 0.6V I read strange values.
Value for 0.6V should be double of 0.3V.
Looks to me, like ADC is not working linear.
Voltage ADC_ATTEN_0db
0,306 860
0,606 2100
ADC_ATTEN_2_5db
0,306 650
0,606 1555
ADC_ATTEN_6db
0,306 400
0,606 1050
ADC_ATTEN_11db
0,306 170
0,606 542
3,301 4092

Code: Select all

adc1_config_width(ADC_WIDTH_12Bit);
adc1_config_channel_atten(ADC1_CHANNEL_5,ADC_ATTEN_0db);
adc1_get_voltage(ADC1_CHANNEL_5);

jumjum123
Posts: 199
Joined: Mon Oct 17, 2016 3:11 pm

Re: known problems with adc1_get_voltage (9bit) ?

Postby jumjum123 » Mon Dec 12, 2016 9:39 am

Results of same test with 9bit
Voltage ADC_ATTEN_0db
0,306 105
0,606 254
ADC_ATTEN_2_5db
0,306 78
0,606 190
ADC_ATTEN_6db
0,306 49
0,606 130
ADC_ATTEN_11db
0,306 22
0,606 66
3,301 511

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: known problems with adc1_get_voltage ?

Postby ESP_Angus » Mon Dec 12, 2016 11:26 pm

Can you please post the full code you're using for this, please? How are you supplying the voltages to the ADC input pins?

If you are using a resistor voltage divider, what values are the resistors? If the voltage dividers has high resistance itself then the ADC's internal resistance may be influencing the result.

jumjum123
Posts: 199
Joined: Mon Oct 17, 2016 3:11 pm

Re: known problems with adc1_get_voltage ?

Postby jumjum123 » Tue Dec 13, 2016 9:12 am

@ESP_ANGUS, thanks for the feedback.
Voltage divider are 2 resistors form gnd to vcc, 0.3V is 10k/1k.
Voltage is checked with digital multimeter. Is there a load during measuring ?
Full code is added above, only those 3 lines followed by a printf.

jumjum123
Posts: 199
Joined: Mon Oct 17, 2016 3:11 pm

Re: known problems with adc1_get_voltage ?

Postby jumjum123 » Tue Dec 13, 2016 11:02 am

Some more info, I've connected IO25 to IO33 and ran a loop.
First value in list is 8 bit value written IO25.
Second value is 12 bit value read from IO33 100msecs later
0 0
6 48
12 128
19 224
25 308
32 420
38 501
44 606
51 699
57 792
64 869
70 987
76 1067
83 1172
89 1259
96 1368
102 1460
108 1552
115 1650
121 1743
128 1830
134 1918
140 2000
147 2111
153 2194
160 2307
166 2391
172 2480
179 2593
185 2679
192 2779
198 2877
204 2971
211 3099
217 3217
224 3375
230 3518
236 3671
243 3838
249 3997

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: known problems with adc1_get_voltage ?

Postby ESP_igrr » Tue Dec 13, 2016 1:26 pm

Commented about this on the arduino-esp32 issue tracker, posting here as well:
ADC response is nonlinear, but it hasn't been characterized yet over supply voltage range and temperature range. Once we have full characterization data, we will update ESP-IDF to do linearization, and update the datasheet with effective resolution and INL/DNL.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: known problems with adc1_get_voltage ?

Postby Ritesh » Sun Dec 25, 2016 12:25 pm

Hi,

Did you able to get voltage reading properly from ADC1?

Please let me know if you are able to successfully read ADC voltage reading and also let me know your voltage divider circuit mechanism as well based your input voltage.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: Bing [Bot] and 243 guests