1
\$\begingroup\$

I'm using an ESP32 with a 12V battery and solar panel. I've created a voltage divider for 0-15v (3.3v input to MCU at 15v at battery side). For that I used a 100kOhm , and 300kOhm to get a 0.3 ratio.

For measuring purposes, result measured is close enough (0.1v error), but Battery-wise, selecting those resistors were a good choice ?

EDIT_1

  1. MCU is powered using that 12v battery, using a buck converter.

  2. 12v battery is used, since it has a much bigger capacity (7Ah).

  3. Charge voltages can get up to 13.5-14.0v, I took 15v as a upper limit.

4. The reason for asking was NOT about what ratio is better (0.3 or 0.25) in voltage divider, but what is right for consuming less power due to that R selection, since it seems battery drainage is faster than I expected.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Is the 3.3 volts from the voltage divider intended to provide power to the ESP32, or is it a signal that the ESP32 will measure? \$\endgroup\$ Jun 18, 2020 at 20:50
  • \$\begingroup\$ @PeterBennett I use a buck converter to provide 3.3v. \$\endgroup\$
    – guyd
    Jun 19, 2020 at 4:25

2 Answers 2

1
\$\begingroup\$

0.25 ratio? That's 3v into the ESP at 12V. They are fine, impedance wise, but esp32 has a pretty poor ADC, it samples very fast so gets a lot of noise, and is poor linearity best the extremes of range.

Should divide it more, 12v batteries often go up to 14V or more when charging, and you want to avoid the high end of the ADC.

My advice... 100k, 500k (so divide 6) and a100nF cap across the ADC input and ground as close to the ESP as possible.

\$\endgroup\$
7
  • \$\begingroup\$ Sounds reasonable and the capacitor is most likely large enough to provide sufficient charge for the ADC sample and hold circuitry, provided that the voltage is not sampled too often (maybe once per second) due to the high resistances. \$\endgroup\$
    – Justme
    Jun 18, 2020 at 22:04
  • \$\begingroup\$ For these ADC inputs, high speed of the capacitor is as/more important than the value. Typically ADC sampling capacitors are pF. \$\endgroup\$ Jun 18, 2020 at 22:17
  • 1
    \$\begingroup\$ OK, so basic math... 12V battery, with 300+100kohm, gives 30uA current flow. Micro amps. That's going to last a very long time before the battery drains. It's pretty much irrelevant to the battery discharge considering these are solar power batteries. \$\endgroup\$ Jun 20, 2020 at 9:23
  • 1
    \$\begingroup\$ In terms of powering the esp32, they take quite a lot of power, of the order of 100-200mA at 3.3V. Through a buck converter, thats going to result in 30-50mA draw at the battery, i.e about 1000x as much as your resistor divider. \$\endgroup\$ Jun 20, 2020 at 9:26
  • 1
    \$\begingroup\$ And additionally, your voltage divider is still wrong whether you're asking about it or not... At 14v, you'll be putting 14x100k/(100+300k) which is 3.5V. More than the ESP supply voltage-it will simply read wrong, although with 300k to the 12V you won't damage it. \$\endgroup\$ Jun 20, 2020 at 9:40
0
\$\begingroup\$

As commented above, are you trying to power your ESP32 with a 12v battery via a voltage divider?

If so, then a better solution is to use a voltage regulator to regulate your 12v to 3.3v. Even better, you could use a DC-to-DC buck converter for high efficiency.

The voltage difference between 12v and 3.3v is quite high, and a voltage divider is not for supplying power, it is used for signal conditioning.

If your application requires only low current (maybe some uA to few mA), then yes voltage divider could be used. But we know that ESP32 is a power-hungry device, so you'd better off with buck-converter.

\$\endgroup\$
1
  • \$\begingroup\$ Please see EDIT 1 \$\endgroup\$
    – guyd
    Jun 19, 2020 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.