2
\$\begingroup\$

Is ESP32 ADC1 good enough or do I need an external ADC?

I'm using the built-in ADC1 on an ESP32 for basic sensor measurements. Here's the setup:

  • Using ADC1-only pins (IO32, IO33, IO34, IO35)

  • RC filtering added on each analog input

  • Inputs scaled to 0–3.3 V range

  • Reading rate is low (1–10 Hz)

  • Application is monitoring 0–10 V and 4–20 mA industrial sensors (scaled)

  • Moderate precision required, but not lab-grade

Is this setup good enough for reasonable stability and accuracy, or would you recommend using an external ADC? Im a bit woried when i heard the ADC of the ESP is not linear. That will make reading sensors hard.

Thanks.

Example sensor: https://www.ifm.com/de/en/product/TA2115

This outputs 4–20 mA over a -50 °C to 150 °C range. With a 150 Ω shunt resistor, this maps to 0.6 V–3.0 V. That gives 12 mV per °C. So that would be a good precision. Also But i would like something linear of course...

asked Jun 27 at 8:57
\$\endgroup\$
10
  • 3
    \$\begingroup\$ You have everything except the information necessary to answer the question. What is "moderate precision"? What is "reasonable stability and accuracy"? If you don't know what that means in numbers, no one can decide for you. \$\endgroup\$ Commented Jun 27 at 9:08
  • \$\begingroup\$ Whoops your right will add/edit the question. \$\endgroup\$ Commented Jun 27 at 9:10
  • \$\begingroup\$ I hope the accuracy is clear now. Around 10mV. \$\endgroup\$ Commented Jun 27 at 9:26
  • 1
    \$\begingroup\$ Of course you have the option of adding a dedicated ADC if you are worried about ESP32 and it's accuracy. MCP3204 for example, accompanied by a voltage reference chip like MCP1501. Normally I would use analog-rich microcontrollers (e.g. MSPM0 from ti, AVR EA/EB series) since they have better Vref, and onboard programmable gain but they need extra work. \$\endgroup\$ Commented Jun 27 at 10:09
  • 1
    \$\begingroup\$ Achieving mV level accuracy with any onboard ADC requires care with signal path routing. Ground return currents from other circuit element in a shared ground between sensor and ADC input add noise and variable DC levels. Reasonable results may be achievable with due care. \$\endgroup\$ Commented Jun 27 at 11:08

1 Answer 1

5
\$\begingroup\$

The ADC on this particular chip (ESP32-WROOM-32E-N) is not brilliant.

Nonlinearity is +/-12LSB if the radios are off and at 25°C. Variation from chip to chip is +/-6%, which can be calibrated out (to some degree). Here is the min/max error from the above datasheet (presumably at 25°C only and with the radios off).

enter image description here

With a 4~20mA input and no offset added, you're not using the bottom 10% of the range, which is good since the error "down there" is appalling.

Anyway if we assume 40mV error and 1.75V range for 20mA and (let's say) double it for temperature effects (TBD if that's reasonable) then you have a full scale of (16/20)*1.75 = 1400mV and and error of +/-80mV, which is more than +/-5% of full scale error. You're asking for about 10x that accuracy, so I would conclude that it hasn't the slightest hope of reliably meeting that requirement.

If you want to stick to products with libraries in the Arduino ecosystem, TI's ADS1115 has an internal reference and 16-bit converter. There may be others.

P.S. Even though your signal levels are fairly high, RF transmitters and precision analog instrumentation do not mix well (especially in close proximity). If you can't restrict yourself to taking measurements only with the radios off then your design may become a bit more challenging to avoid interaction.

answered Jun 28 at 6:39
\$\endgroup\$
1
  • \$\begingroup\$ Thank that is really helpful. Turning radio off when taking measurement wont be a problem. I will look at a external ADC then. The deviation is a bit much. \$\endgroup\$ Commented Jun 30 at 5:43

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.