How the max Vin of 3100mV is calculated from an attenuation of 11dB?

techtoys
Posts: 28
Joined: Sat Jun 01, 2019 11:11 am

How the max Vin of 3100mV is calculated from an attenuation of 11dB?

Postby techtoys » Sun Aug 20, 2023 9:28 am

Hi

I am wondering how the results tabulated in the ADC Attenuation section is calculated.

If I use the equation as below, the max Vin with an attenuation of 11dB should be 3.9V something, but not 3.1V.

11dB = 20*log(Vin/Vref) dB

Vin = Vref * arclog(11/20) = 1100*3.548 = 3902.94mV

If we really want to get a max voltage input of 3100mV from 1100mV, the attenuation is 9dB. See results from an online calculator as follows:
ADC_ATTEN.png
ADC_ATTEN.png (22.17 KiB) Viewed 1252 times
John

MicroController
Posts: 1553
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: How the max Vin of 3100mV is calculated from an attenuation of 11dB?

Postby MicroController » Sun Aug 20, 2023 1:25 pm

Apparently, measuring close to the nominal Vref is somewhat discouraged, probably due to measurement error increasing when approaching Vref; note how at 0db the recommended voltage range ends at 950mV instead of 1100mV. There seem to be some conservative margins included in the documentation, breaking the "mathematical relation" between the name of the constant and the recommended max. voltage.

techtoys
Posts: 28
Joined: Sat Jun 01, 2019 11:11 am

Re: How the max Vin of 3100mV is calculated from an attenuation of 11dB?

Postby techtoys » Sun Aug 20, 2023 2:50 pm

MicroController wrote:
Sun Aug 20, 2023 1:25 pm
probably due to measurement error increasing when approaching Vref
A value as large as a 2dB gap seems too big as a measurement error. I think there is some other reasons.

MicroController
Posts: 1553
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: How the max Vin of 3100mV is calculated from an attenuation of 11dB?

Postby MicroController » Sun Aug 20, 2023 6:02 pm

What I meant was, that
a) it is known that the ESP32's ADC becomes more inaccurate when Vin approaches Vref
b) "the true reference voltage can range from 1000 mV to 1200 mV among different chips."
c) The "attenuator" may have unspecified variations too

These are likely the reasons why the Vin_max value documented is probably a) after "HW and SW calibration" and b) chosen conservatively ("worst-case") low.

techtoys
Posts: 28
Joined: Sat Jun 01, 2019 11:11 am

Re: How the max Vin of 3100mV is calculated from an attenuation of 11dB?

Postby techtoys » Mon Aug 21, 2023 10:08 am

MicroController wrote:
Sun Aug 20, 2023 6:02 pm
b) the true reference voltage can range from 1000 mV to 1200 mV among different chips."[/url]
c) The "attenuator" may have unspecified variations too
Voltage reference became 873mV if we apply a measured voltage of 3100mV with 11dB (see screen shot attached.)
2023-08-21_18h06_51.png
2023-08-21_18h06_51.png (22.34 KiB) Viewed 1096 times
This value deviates a lot from 1000mV to 1200mV.
However, when the arduino function analogRead() is used to return the raw ADC count, it returns 4095 when the applied voltage is 310xmV which is fairly accurate. What I am wondering is that, the attenuation stated at 11dB is not really 11dB.

Who is online

Users browsing this forum: No registered users and 61 guests