Auto shutoff

Thread Starter

dingo

Joined Mar 11, 2011
60
I have attiny85 that I’m running at 3.7-4.0v. I want to have the unit power on for X amount of time, then turn off.

Programming it is not a problem, but I’m stuck on the component needed and how it’s connected.
I found a working example at http://www.zolalab.com.br/eletronica_projetos/auto_shutdown_enus.php but I’m unable to do it with my low voltage.
Any idea if this can be modified to be used in a lower voltage application?
 

AlbertHall

Joined Jun 4, 2014
12,343
It should work with an IRL520 or other logic level MOSFET, though you could usefully reduce the 10k resistor to 1k to get more voltage on the gate.
 

Thread Starter

dingo

Joined Mar 11, 2011
60
H Albert,
Will you be able to point to a page of that exact mosfet? I’m seeing a lot of different variations out there.
 

KeithWalker

Joined Jul 10, 2017
3,063
How much current is the tiny and it's associated circuitry drawing? If it is fairly low, you could use a PNP transistor instead of a MOS FET.
 

Thread Starter

dingo

Joined Mar 11, 2011
60
It will be turned on from some external like a button or something. I don’t want it to go to sleep because I need it to have zero battery drain.
 

djsfantasi

Joined Apr 11, 2010
9,156
Ok, I see what you’re saying. I just want to say that sometimes good design means questioning what you think you need.

Why do you need zero current drain?

0.000001A is extremely small. A 2400mAH battery would last about 2,400,000,000 hours. Technically. The batteries life, not the MCU current draw, becomes the issue.

0.000001A is the ATTiny85’s current draw in sleep mode.
 
Last edited:

Thread Starter

dingo

Joined Mar 11, 2011
60
It would be nice to just have it go to sleep without needing anything else, but i'm just little interested to see how something like is built.
 

djsfantasi

Joined Apr 11, 2010
9,156
It could be done via software.

The MCU is grounded by an N channel logic level MOSFET. Note that the MOSFET draws no current unless it’s changing state.

The gate is connected to a GPIO pin on the MCU through a Schottky diode. A second such diode connects to a push button to Vcc. The diodes form an OR Gate, which provides ground to the MCU if either the push button is pressed for a sufficiently long time OR a GPIO pin on the MCU is high. The gate also connects to ground via a 10KΩ pull-up resistor.

During the program’s startup, the GPIO pin is brought HIGH and the end of the delay time is calculated.

To start the MCU, hold the start push button down long enough for the program begins to run.

While the program runs, in the main loop, keep checking to see if the timer expired. Once it has, set the GPIO pjn Low, which turns off the MCU.

One could take advantage of this approach, to turn off the MCU when its tasks have completed rather than at some specific time.
 

LesJones

Joined Jan 8, 2017
4,174
I first saw the method that djsfantasi is describing in post #12 used in the Banggood component tester. I have since used it in a timer for some battery powered lights using an Attiny13a. The schematic of the Banggood tester is on the last page of the manual.
I can provide the schematic and code for timer I built using the idea.

Les.
 
Last edited:
Top