0
\$\begingroup\$

I want to read high voltages, around 150VDC, using a ESP32.

I plan to put this as an input into the ESP32 ADC pin. But of course, i shouldn't have voltage that high on the input of a ESP32.

In ESP32 datasheet tells that ADC max input is 3.3 V with 12-bit resolution (0-4095). So, i just need to scale it down from 0-150 to 0-3.3 VDC.

So, i use simple voltage divider to achieve this.

Vout = (R2 / (R1+R2))  * Vin

if i want to scale it down about 1:45, then: R2 = 1kΩ R1 = 44kΩ

My question is,

  1. Is this going to work?
  2. How is the accuracy and stability?
  3. Is it safe (when something wrong, not gonna break my ESP)?

Thanks in advance!

\$\endgroup\$
  • \$\begingroup\$ Yes, this will work. Accuracy is limited only by the precision of the resistors and the ADC. Safety leaves something to be desired, though. I would recommend some form of isolation. \$\endgroup\$ – Hearth Feb 1 at 3:40
  • \$\begingroup\$ As an aside, they do make isolation amplifiers specifically for this purpose. They are fairly expensive, though, so expect to pay about $5 for one if you do use one. \$\endgroup\$ – Hearth Feb 1 at 3:47
  • \$\begingroup\$ consider an INA219 instead of on-board ADC: you can feed it up to 30v, so less division, it's external and replaceable, and can be isolated from the ESP if really needed. It also has a lot more stable readings, simplifying the code by avodiing filtering like averaging, median, etc. \$\endgroup\$ – dandavis Feb 1 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.