0
\$\begingroup\$

The problem: I am trying to read a DC analog voltage (from a battery) by an ADC on a microcontroller.

  • This can be done by a voltage divider, but I am looking for a solution that has zero, or near zero current draw. This is necessary to reduce power requirements (and extend battery life) while the microcontroller is in deep sleep.
  • The battery voltage I am trying to read can be as high as +36/48V and referenced to GND
  • Microcontroller max input voltage is 3V.

What is the simplest way of doing this without using more pins on a microcontroller to toggle a MOSFET, for example?

\$\endgroup\$
4
  • 1
    \$\begingroup\$ If you can afford adding, a high input impedance opamp (with appropriate gain). Or a JFET, alone, but those tend to have stats all over the place. \$\endgroup\$ Jan 26, 2022 at 16:31
  • \$\begingroup\$ Depends on the microcontroller. Which are you using? \$\endgroup\$
    – brhans
    Jan 26, 2022 at 16:38
  • \$\begingroup\$ STM32F4/7 and L series \$\endgroup\$
    – Misha
    Jan 26, 2022 at 16:41
  • \$\begingroup\$ What's an acceptable current draw, 1mA, 1uA, ...? This will let you decide between a divider with high value resistors and a solution with a switch or a special purpose metrology IC. \$\endgroup\$
    – DamienD
    Jan 26, 2022 at 17:58

2 Answers 2

3
\$\begingroup\$

Depending on your precise requirement, a solution could be to use a voltage divider (with a capacitor).

Why do you not want a voltage divider? Because it uses too much current (it would be useful to say your max (I_max) is).

To that, there is a simple solution : just make your voltage divider using HUGE resistors (ie. not the typical kilo ohms, but hundreds of kilo ohms or more).

For example, if you have R1+R2=1Mohm, your current is less than 50µA, so you are at less than 0.5Ah per year. If needed, you can still go higher to consume even less.

The problem now is that the ADC sees a very high input impedance. This leads to wrong results because the ADC can no longer charge its internal capacitor in time. This is easily solved by adding an external capacitor between ground and the ADC pin. If you add it, then problem solved.

schematic

simulate this circuit – Schematic created using CircuitLab

For the choice of the capacitor, it's a trade of :

  • if the value is too big, then you might induce quite some delay when the battery voltage changes (it might or not be an issue, depending on application)
  • if the value is too small, then the little current needed to charge the internal capacitor of the ADC might make the voltage drop a bit.

And a second thing to look for is that the leakage resistor of the capacitor must be big compared to R1.

NB : also make sure you are not reading the pin at too high of a frequency, or you will have to charge each time the capacitor of the ADC

And a last thing that you might need to consider if using very big resistors is noise, either through EMI, or thermal noise of the resistors itself.

But if you can satisfy all those constraints, you can get very low power while paying just for an additional capacitor.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ For sizing the external C, using 10x the A2D internal C is a good starting point. \$\endgroup\$
    – Aaron
    Jan 26, 2022 at 19:06
  • \$\begingroup\$ You must also consider the leakage current of the ADC pin if using this approach. Nanoamps of leakage will affect the accuracy. \$\endgroup\$ Jan 26, 2022 at 20:45
2
\$\begingroup\$

Assuming the voltage divider is from a positive voltage to GND (schematic - ?), use one uC output pin to drive a small signal n-channel MOSFET rated for 100 V. The MOSFET grounds the lower end of the voltage divider during readings, and disconnects it from GND at all other times, reducing the divider current to the leakage current of the MOSFET in the off state - nanoamps.

UPDATE:

I'm leaving this answer up, but it does not solve the problem; there still is high voltage on the uC input pin when the divider is disconnected from GND. What is needed is a high voltage analog switch between the divider tap and the uC input, but driving that without using an additional uC pin is difficult.

We do not know the input voltage range of the uC A/D, so all solutions are guesswork - such as a CMOS opamp voltage follower buffering a very high impedance divider string (as already suggested).

\$\endgroup\$
7
  • \$\begingroup\$ it doesn't get any easier than this right here... \$\endgroup\$
    – pgvoorhees
    Jan 26, 2022 at 16:55
  • \$\begingroup\$ Some additional circuitry is necessary, because the point where the divider connects to the ADC will rise to 36V when the bottom end of the divider is not grounded through the MOSFET. The OP also specifically asked for a solution that does not require "using more pins on a microcontroller" \$\endgroup\$ Jan 26, 2022 at 17:07
  • \$\begingroup\$ I agree with Elliot, when FET is off, you are left with simply a resistor between 36V and MCU IO pin, which will at very least consume current if MCU has protection diodes to the supply. STM32 has such pins, but it also has 5V tolerant pins which have no clamping diodes to VCC. \$\endgroup\$
    – Justme
    Jan 26, 2022 at 17:13
  • \$\begingroup\$ My mistake. I added the FET to keep the high voltage off the uC pin, then left it there anyway. oops. Answer updated. \$\endgroup\$
    – AnalogKid
    Jan 26, 2022 at 17:19
  • 1
    \$\begingroup\$ The idea is okay. You can use a high-side switch, which is still one extra MCU pin, but two transistors of whatever (typically complimentary) types. That reduces 'off' current to just leakage. But OP doesn't want to use the extra pin (perhaps it could be shared with something else, but that's another subject), \$\endgroup\$ Jan 26, 2022 at 20:34

Your Answer

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

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