Products > Embedded Computing

How to cut power to Arduino after a set time?

(1/5) > >>

I got an Arduino application that uses a 16X2 LCD and a ULN2003 darlington array for driving a stepping motor. After the user start the program, there is a wait of 5 min, and the stepper motor performs an action, afterward I want to cut power to everything to save energy. This is because the program don't need to be ran again for days.

I know with the Pro Mini you can go into deep sleep but the LCD and Darlington will still draw significant current I think. I plan to power them all from a 5V source. It'll be nice if there is a mechanical timer that can cut power via hardware, by literally opening the circuit from the 5V power source.

I heard you can use MOSFET or relays for this. Not sure how those work. The goal is to have no power consumption after the stepper motor has performed its action. Next time, the user can just power everything back up to restart the program. Then the user can walk away without having to remember to power off everything.

What's the easiest way to do this?


Are you using an Arduino board, or is it a custom PCB?

Does the current draw after the power-off event have to be zero, or is having a relatively low current draw from the micro, and zero draw from the additional circuits acceptable?


--- Quote from: engineheat on February 12, 2019, 04:16:44 am ---I plan to power them all from a 5V source. It'll be nice if there is a mechanical timer that can cut power via hardware, by literally opening the circuit from the 5V power supply.

--- End quote ---

I think you can do that by using a relay. Relay will cut off the external source but then someone has to start it again. It won't get started automatically. You can check this Relay Interfacing with Arduino.

It sounds like you are planning to have these plugged into the wall.  In which case, I would just go into deep sleep, any remaining power usage is negligible in terms of costs, probably you'll be left with maybe 30mA at 5v, which is 0.15W, it's just not even worth worrying about when you are plugged into the wall, even if you were off-grid.

If you are running on battery however, then yes you would want to get that down.  Supply power directly to the 5v pin of the Nano/Pro-Mini, and cut the legs of it's regulator (it sucks for low power).  Use an N-Channel mosfet as a switch for the grounds of the display and the ULN2003, a 2N7002 will do probably, google "mosfet as switch" to educate yourself there,  And then when it comes time to sleep, put all the pins to INPUT mode disable brown-out detection if it is enabled, and go into deep sleep.

Since you are using arduino, my SimpleSleep library does what it says in the name.

You can use a circuit usually made up of two transistors, a momentary switch and a few resistors that will let you push the button to turn on power, and then your Arduino can keep track of the time and turn the power off after a delay.  I'm not where I can draw right now, but basically you run all the power throught a P-channel mosfet with its gate tied to the input power rail through a high-value resistor (which keeps the mosfet turned off normally). Also connected to the gate is the push button to ground.  And then another transistor, probably an NPN, also connects the mosfet gate to ground, but its base is driven through a resistor by an Arduino I/O pin.

So you push the button long enough for the Arduino to power up and turn on the NPN, which keeps the power on after you release the button.  Then when the Arduino is ready, it just turns off the NPN and the power is shut off.

A slightly more complicated circuit would let you also use the push button as an input after the power turns on.


[0] Message Index

[#] Next page

There was an error while thanking
Go to full version