3

I've use the following circuit to be able to shutting the my Arduino down after some time of it not being used:

I'm now concerned that while you press the button to turn on the Arduino, the 9V from the battery can flow directly to the PIN X (one of the digital pins of the Arduino configured as output). After the Arduino is started the PIN X will be set to high, to keep the Arduino running when the button is released.

Is this a problem which I need to solve? And if yes how. The finished project is intended for a child, so I assume that the on button can be hold for a long time just as it is funny to press on the button. The circuit itself is running fine.

As a possible solution I thought to add a diode between the junction after the R1 and the PIN X. Would this be an ok solution?

The circuit is not my own invention I've found it here: http://educ8s.tv/auto-power-off-arduino-simple-circuit/

  • adding a diode would stop the 9v from hitting the pin. the uno also has internal resisters that act as a gate de-flap. – dandavis Apr 2 '17 at 18:28
1

Having 9 volts reaching pin X through R1 is indeed a problem, one that could destroy transistors in the pin's IO structure. The problem is mentioned in some comments following the video, but no solution is mentioned there. Presumably users of the circuit usually get away with ignoring the problem because it is one of short duration: A few milliseconds after the MCU starts up, it sets pin X to +5 V, which then leads to 4 V at 40 μA being dropped harmlessly across R1. (Note, R1 is 100KΩ rather than 100Ω, per video and its notes.)

One approach to guard against the problem is to place a 5.3–5.7 V zener diode from ground to pin X.

Another way is to use a better and more capable on-off circuit, a Pololu Pushbutton Power Switch #2808. This costs about $4, and is rated for operation from 2.2 V to 20 V at up to 6 A. The board is about 15x18 mm and has a small pushbutton on it, but you can parallel a momentary switch of your own if you like. The pushbutton toggles power on or off. The board also has control inputs called On, Off, and Ctrl, with the first two turning the board on or off.

A big advantage of the #2808 switch is its current draw is small (less than 0.1 μA) when switched off. The circuit illustrated in the link has close to 0.5 mA draw when off, which is enough to run a battery down in a few weeks.

  • That electronic power switch board looks like an interesting idea; hopefully it solves not only the input voltage problem, but the more permanent leakage path self turn on one. – Chris Stratton Apr 1 '17 at 21:26
  • Thanks for the response, I've seen the Pololu Solution when I was searching for circuit to solve this issue. I've did not order it as the shipping cost was around 20$ to my country and I have the the risk of additional import taxes on top of it. And this for a 4$ component :-( And the lokal distributor does not carry that part. This was the reason I've wen't with the other "solution". Not the best decision in hindsight :-( – Chris Apr 2 '17 at 5:08
  • ok, had another look on the page, and found a distributor in Germany which also sends to my country. Ordered now the board and also a stepup voltage regulator to solve the other issue with powering the arduino board by battery. – Chris Apr 2 '17 at 9:17
  • @Chris, that's good. Note, the #2808 is ok with low voltages (2.2 V to 20 V) and the #2809 with medium voltages (4.5 V to 40 V). Power-on indicator LED is red on #2808, and I think draws some 200 μA/V when the unit is on (eg 1–1.2 mA at +5V), and is green on #2809, drawing ca. 100-120 μA/V when the unit is on. You can remove the LED if that power loss is a problem. – James Waldby - jwpat7 Apr 2 '17 at 16:22
  • Yes I will remove the led, need to to the same on the uno as well. – Chris Apr 2 '17 at 16:38
1

No. It is not possible for a modern IC such as an MCU having I/O protection diodes to enable/disable its own power using a single external N-Channel or P-Channel device. The reason is that the path broken by the single switch ends up being partially completed through I/O pin's internal protection diode and your pulldown resistor, and depending on the voltage drop that results across that, partial turn on the FET itself. This is enough to have the processor at least partially on - perhaps not enough to operate, but enough to keep consuming battery, and in some cases also enough to make clean startup on manual operation of the power switch unworkable.

To make this work, you need two stages of switching - two fets are a possibility.

However another easy one is to use one of the USB power switches chips intended to be included in the rarely seen "full" USB hubs that have software control of the downstream ports' power. These are hardly ever fitted in the hubs sold, but they exist as a part, are easy to apply, typically have low leakage, and are often specified to operate correctly both substantially below and somewhat above the 5v they would see in a USB application. Most importantly, they are multi-stage solutions in a single package - typically they function as high side switches, but they are enabled by an input going high, and as result, they do not suffer the parasitic partial turn on issue via the MCU's protection diodes in the way that a high side switch enabled by an input going low would. I believe the RT9701 that I used in the past to do this with an ESP8266 is officially discontinued, but still available and likely replaced by newer similar parts.

Given your input voltage, another thing to consider would be using a regulator with an active-high enable input. But realize that a linear regulator is an inherently wasteful device, and a lot of the compact switchers don't have very high input voltage allowance.

  • Just out of curiosity do you know a place where there would be a circuit of such a dual FET solution? I would like to learn how it works correctly. The RT9701 look interesting, but I'm not yet ready to solder smd components. And I was only able to find it in smd configuration. – Chris Apr 2 '17 at 9:18

Your Answer

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

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