• Under impression to need a low voltage cut out, to prevent 2x AA NIMH rechargeable battery from being drained too now, and damaging them. (right??)
  • In deployment this circuit will commonly be exposed to complete discharge event if allowed.


  1. S1 momentary switch is held down, activating Q1 to power up 328p
  2. Sketch begins and Setup() calls digitalWrite(A5, LOW)
  3. S1 can now be released as Q1 is held LOW by A5
  4. Battery gets low, triggering brown out detect (BOD), 328p resets, and disconnects Q1


  • R1 is resistor wheel and i experimented with different values to get it to work. (as i have not done the math)
  • I have this assembled on breadboard, radio and lcd module are not pictured
  • With A5 disconnected it works well (while S1 held down), When off 0ma at Ammeter.
  • With A5 connected it can work with higher value of R1 (47k) to prevent it booting up itself, but when off Ammeter reads about 2ma.

This 2ma is still enough to drain the battery significantly if left flat for some time. Im guessing the 2ma and need for 47k resistor are related to what appears as A5 'leaking' while arduino off.

I have been able to reduce 2ma current consumption while off by putting pullup resistor between A5 and +V

I have limited space so need to keep things simple.


  • Any improvements / suggestions, to get around the leaky A5 issue ?
  • Or generally meet my design needs better ?


  • \$\begingroup\$ Your question is a bit confusing as you mention that with A5 disconnected you read 0 on your ammeter, yet with the configuration you have above the meter is in series with your supply path, so unless the AtMega328P is drawing negligible current that does not register with your meter then something is wrong with your statement. Looks to me that you drive the transistor base with about 1mA when active, so I am not sure why the AtMega328P is off when your sourcing 2mA into the base? Also, rather than driving A5 low, try putting the pin in a high-impedance state. \$\endgroup\$
    – sherrellbc
    Jun 23, 2014 at 13:42
  • \$\begingroup\$ @sherrellbc , Im talking about when Q1 is off/inactive, and thus the 328p is off. There is draw still through ammeter of 2ma with A5 connected. can you explain "try putting the pin in a high-impedance state" \$\endgroup\$ Jun 23, 2014 at 23:33

5 Answers 5


Your design requires pin A5 to be at the same voltage as the battery in order to shut off the system. The problem is that when you remove power from the Arduino, pin A5 can no longer remain high — there are internal protection diodes that force its voltage to be no higher than V+ plus the diode drop (about 0.7V).

The simplest solution is to add a second transistor (NPN) that inverts the logic of pin A5 — when A5 is high the system is on, and you drive A5 low to shut it off. This shuts off both transistors and the quiescent current should be zero.

Also, you should consider using a P-channel MOSFET instead of your PNP BJT. It will be more efficient: less voltage drop to the Arduino when on, and no wasted current through the gate terminal.


simulate this circuit – Schematic created using CircuitLab

I've used an N-channel FET instead of an NPN transistor. The Arduino can drive it directly, and the only "wasted" current is the 30 µA or so that flows through R1 when the system is powered up.

  • \$\begingroup\$ I look forward to more details and thank you for your input, just to clarify in case you missed it, A5 LOW = 328p ON via Q1 and A5 HIGH or floating = off \$\endgroup\$ Jun 23, 2014 at 12:14
  • \$\begingroup\$ +1 for MOSFET suggestion - in my experience simple design with them is much easier. Just simply using the MOSFET will solve the 2mA issue he mentions in the post. \$\endgroup\$
    – sherrellbc
    Jun 23, 2014 at 13:35
  • \$\begingroup\$ there is a problem with your circuit, M2 mosfet is 'latching' so once on by A5 high, it doesnt go off even though arduino is rebooting, eg brown out, it likely needs a pull down resistor if possible \$\endgroup\$ Jun 26, 2014 at 12:54
  • \$\begingroup\$ I misunderstood your description. I thought that after the Arduino resets, you would actively drive A5 low to shut everything off. Now I understand that you mean that when the Arduino is held in reset by the BOD, you want everything to shut off. By all means, just add a pulldown to the gate of M2. I'll update the drawing. \$\endgroup\$
    – Dave Tweed
    Jun 26, 2014 at 14:32
  • \$\begingroup\$ To cover all contingencies, in case the Arduino does manage to reboot, when it restarts, you should check the reason for the previous reset -- if it was BOD, you should immediately drive A5 low. I don't know how easy this is to do within the Arduino software environment; you might need to customize some of the library code. \$\endgroup\$
    – Dave Tweed
    Jun 26, 2014 at 14:42

I have read several forums regarding this topic but with my components I used different approach and created overall schematic of Arduino that measure the battery voltage and turn it off when it reaches the low voltage limit.

  • A0 measures the battery voltage via voltage divider 1:1
  • D5 is high and when the battery voltage reaches the lover limit, Arduino pin goes to LOW
  • 4N35 OPTOCOUPLER is used to decouple Arduino pin with the battery in off state
  • S1 push button is used to start it
  • I used the simple 2N7000 N-channel MOSFET since I have current less than 100mA. If more current is required I would use STP36NF06L or IRL2203.

arduino battery measure and protect

  • \$\begingroup\$ that is certainly an novel approach and one that may have its merits, thanks. \$\endgroup\$ Oct 24, 2014 at 9:21
  • \$\begingroup\$ Is there any way you could make it switch off as well as on with the switch? \$\endgroup\$ Nov 1, 2014 at 7:53
  • \$\begingroup\$ maybe with another resistor to change the 1:1 divider to electrically lower the voltage for A0. e.g. adding parallel to R2 a new 10kR3 and new swith. So if you hit the switch R2+R3 will get 5k and the divider would be 1:2 so the 3.7V will be 1.23 and not 1.85V in arduino A0 pin (so arduino will turn off the circuit). \$\endgroup\$
    – mihi
    Nov 7, 2014 at 21:19
  • \$\begingroup\$ post describing the circuit: homeduino.blogspot.com \$\endgroup\$
    – mihi
    Nov 7, 2014 at 21:28
  • \$\begingroup\$ That's a good idea. I will check out your blog post too. \$\endgroup\$ Nov 11, 2014 at 5:22

If you need a low-voltage cutout perhaps a specific voltage detection IC might help. I've seen the Microchip TC54 used in similar applications. It's a pretty small device so it won't take up much space.

  • \$\begingroup\$ Thanks for the suggestion, and if I run out of options with the common parts I have I will follow this up. As I will have to order them from OS (im in AU) and could delay my project by several weeks. \$\endgroup\$ Jun 23, 2014 at 12:21

Try setting pin A5 to high-Z (tri-state) when not using it.

Page 77 here.

You're going to have to step outside the bounds of the Arduino libaries to do that though - but it's very simple and only two lines of code.

  • \$\begingroup\$ I looked and its a bit confusing for me, but how would any of it have any effect when the arduino is off ? \$\endgroup\$ Jun 23, 2014 at 23:36

The problem with the first circuit at top of page is that the AtMega328 is being powered via its A5 I/O pin. Current passes from battery positive via BC557 emitter/base junction through R1 to A5. From A5 it passes internally via top anode/cathode of internal upper protection diode to final destination of VCC. Change BC557 to a P channel mosfet and problem is solved, because there is no current passed between source and gate as there is with emitter/bass junction.


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.