3
\$\begingroup\$

I'm working on a project that measures battery voltage. The device, I designed, works on coin cell. I have to extend battery life, that's why I used the following designschematic of voltage divider

But it requires two pins

  • BATADC analogue input pin
  • S1 digital output pin

I don't want to use 2 pins. Can we redesign by using a single pin which will act like analogue as well as digital output, and we can measure voltage when we require, with very low power?

\$\endgroup\$
8
  • 1
    \$\begingroup\$ I see five connection points not two. \$\endgroup\$
    – Andy aka
    Commented Sep 27, 2023 at 11:06
  • 4
    \$\begingroup\$ It will GREATLY help others, and yourself if || Component labels do not overlap making then hard or impssible to read. || Adding identifiers to ALL components helps greatly. eg the 2 x 47K. Sometimes it makes little difference. Other times it needs magic descriptions to make sense of advice. Labelling then always helps heaps. \$\endgroup\$
    – Russell McMahon
    Commented Sep 27, 2023 at 11:35
  • 1
    \$\begingroup\$ What MCU? What MCU voltage? What battery voltage? \$\endgroup\$
    – marcelm
    Commented Sep 27, 2023 at 11:57
  • 2
    \$\begingroup\$ I can't see how the proposed circuit ever measures anything except (VDD / 2) \$\endgroup\$
    – Ben Voigt
    Commented Sep 27, 2023 at 21:12
  • 1
    \$\begingroup\$ @effect IF the ADC range includes Vdd that would work. In many (maybe most) cases it will not. ||Also - Vref has to be some fraction of Vdd. If Vdd is used as reference the result is always the same (full scale) regardless of the value of Vdd. \$\endgroup\$
    – Russell McMahon
    Commented Sep 28, 2023 at 23:18

5 Answers 5

10
\$\begingroup\$

May I offer a different approach?

Instead of turning off the voltage divider, reduce its current drastically and buffer the voltage.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
3
  • 1
    \$\begingroup\$ This looks like an excellent way to approach it. I note that MCP6441 specifically includes battery voltage sensing in its typical applications in the datasheet and has 450 nA quiescent typ! \$\endgroup\$
    – jonathanjo
    Commented Sep 27, 2023 at 15:44
  • 6
    \$\begingroup\$ To use this circuit successfully, great attention needs to be paid on PCB layout and board cleanliness to avoid leakage. \$\endgroup\$ Commented Sep 27, 2023 at 20:09
  • 1
    \$\begingroup\$ A nice IC. Even using say 10M:10M would make it less sensitive to leakage. Input is rail to rail and his coin cell is say 3V3 max and IC runs down at about 1.4? V - so it would work well. \$\endgroup\$
    – Russell McMahon
    Commented Sep 28, 2023 at 11:40
3
\$\begingroup\$

I'll assume that the VDD is not really intended and that this switch only operates when battery voltage sampling is required. If Q2 also supplies Vdd to the system a different design is needed.

If you drive Qlower gate via a diode D1 from BATADC with a digital high, and add a capacitor C1 to Qlower gate to create a 'stay turned on' time constant with R19, then you can.

  • Assert BATADC digital high - turns on sampling

  • Convert BATADC to analog input

  • Measure battery voltage before falling voltage on C1 starts to affect the reading.

D1 must be silicon, not Schottky to avoid potentially high reverse bias currents in Schottky.


AO3401A is an "entirely OK" part to use - Rdson will probably be around 60 milliOhm. This is insignificant given the value of the resistor divider. BUT that divider MAY be loaded somewhat by the ADC depending on circuit details. Using a sub-10-milliOhm Rdson FET will probably cost no more.

The effect of the 2 x 47k values on precision should be checked (and may have been already).

The AO3400 hs an Vgsth max of about 1.5V which allows lots of headroom when designing the RC turnoff time.

\$\endgroup\$
2
\$\begingroup\$

Can we redesign by using a single pin which will act like analogue as well as digital output, and we can measure voltage when we require, with very low power?

No.

Any convoluted solution we come up with to multiplex two functions into one GPIO would affect the accuracy of the reading and make that solution pointless.

\$\endgroup\$
1
  • \$\begingroup\$ I believe that the accuracy effect in my solution will be far less than 1 LSB and so undetectable. Error is reverse leakage of a silicon diode into a 47K/47K (or smaller) divider. \$\endgroup\$
    – Russell McMahon
    Commented Sep 28, 2023 at 2:53
2
\$\begingroup\$

You can try this procedure:

Switch pin as digital.
Set output High. This charges the C1 to hold mosfets ON for a while.
Switch pin to analog.
Measure the battery level.

The C1 discharges itself through R1 after some time. You can use a schottky instead of 1n4148 to increase measurement range. Theres no need to R3 and R4 to be so high since the batt. measurement is in minor periods only (1k,1k should be ok).

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Great minds think alike :-) - that's identical to my (diagramless) answer. Note that using Schottky diode for D1 risks reverse bias leakage currents affecting reading accuracy - especially is used at somewhat eleveated temperatures. \$\endgroup\$
    – Russell McMahon
    Commented Sep 28, 2023 at 2:50
  • \$\begingroup\$ @RussellMcMahon Using harder R3R4 resistor divider should make the schottky leakage insignificant. Btw, I am surprised you wrote almost the same solution :). \$\endgroup\$ Commented Sep 28, 2023 at 3:27
  • 1
    \$\begingroup\$ I was about 5.5 hours ahead of you BUT as I did not provide a diagram you'd have to have traced the answer through to see that they were the same. So easily missed.|| I mentioned not using Schottky but did not go into any detail. At room temperatures reverse Schottky current for an eg BAT54 will be under 0.1 uA. Divider current as shown is about 30 uA. Around 1 bit. At say 100C and 3V3 Diode Irev typical is about 10 uA. Very significant as shown. As you say, reducing divider to arbitrarily low values will swamp this. Schottky offers minimal delta delay time over silicon so 1N4148 probably OK. \$\endgroup\$
    – Russell McMahon
    Commented Sep 28, 2023 at 11:37
0
\$\begingroup\$

How about something like this?

schematic

simulate this circuit – Schematic created using CircuitLab

When idle, let the pin float and quiescent current should be approach. Prior to measurement, set pin low for awhile, then float it and take two measurements with a known amount of time between them. If both measurements are taken while the cap voltage is sufficiently below VDD, VBAT may be estimated as a multiple of the difference between the two measurements. Alternatively, if all one has is an analog comparator with e.g. a 1 volt fixed threshold, one could start by grounding the pin long enough to pretty well discharge the cap, then float the pin and see how long it takes for it to reach one volt.

\$\endgroup\$

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.