ADC reference docs attenuation possibly wrong

amarotica
Posts: 11
Joined: Wed Jul 22, 2020 4:56 pm

ADC reference docs attenuation possibly wrong

Postby amarotica » Tue Mar 30, 2021 6:15 pm

Hi there, I wanted to post this potential issue here because it's caused me a bit of confusion over the past few hours.

I've been referencing https://docs.espressif.com/projects/esp ... dc_atten_t for setting up some ADC readings on ADC1, channel 0 and 7.

The problem I faced is likely just an error on the documentation site, or possibly user error, but basically I was using DC_ATTEN_DB_0 to set the scale to 0-800mV as suggested in the docs: https://docs.espressif.com/projects/esp ... ATTEN_DB_0 but my output voltage calculated with:

Code: Select all

float adpV = float(adpRaw)*(0.8/4095.0);
returns ~0.46V which is wrong. My actual reading voltage (as calculated by hand and confirmed with a multimeter) is 0.63V. When I used ADC_ATTEN_DB_0 but changed the 0.8 to 1.1 in my code, it returns the correct 0.63V.

TLDR: I think the voltage range stated in the esp32 docs for ADC_ATTEN_DB_0 should be 0-1100mV not 0-800mV.

If I'm wrong I would love an explanation of what I misread. Thank you!

User avatar
ESP_krzychb
Posts: 394
Joined: Sat Oct 01, 2016 9:05 am
Contact:

Re: ADC reference docs attenuation possibly wrong

Postby ESP_krzychb » Thu Apr 01, 2021 11:17 am

Hi amarotica,

Description of https://docs.espressif.com/projects/esp ... dc_atten_t is indeed misleading. The voltages besides adc_atten_t represent the upper values of "suggested ranges" shown in the table below https://docs.espressif.com/projects/esp ... dc_atten_t
Sorry for the confusion, I will look at how to correct the description.
The actual maximum value you may read for DC_ATTEN_DB_0 (but with worse accuracy) is indeed about 1.1V (Vref) and vary between the chips, see https://docs.espressif.com/projects/esp ... alibration

Who is online

Users browsing this forum: No registered users and 22 guests