Self power control using a battery, voltage regulator and transistor

Hi, this my first post! I'm a complete novice with electronics, so please bear with me..

I'm currently making a standalone atmega8l based battery powered project, which I would like to draw 0 power when it's off. However, for various reasons I don't want to have a simple on/off switch, because people could forget to turn the circuit off after use and it would empty the battery in no time.

So my cunning (?) plan is this: I use a separate battery (e.g. a button cell or something), with a pushbutton. The positive side of this connects to the base of a transistor, so that when the button is pushed and held briefly, the circuit turns on. Then, a pin on the AVR which is connected to the same base pin of the transistor is pulled HIGH, so that when the push button is released, the power stays on until i bring the AVR pin to LOW.

I connected up this circuit, and it does start up just fine when i connect a battery to the base and emitter legs of the transistor, or connect the 5v out pin from the VR to the base, but when i disconnect it from the base, the circuit shuts off instantly - even though the AVR pin is high (i verified that it is with an LED first).

Does anyone have any ideas as to why this isn't working as I thought? I will try to provide some pictures of the circuit later, but for now I'm curious if I'm missing something obvious

How do you connect the collector of the transistor?
For AVR to control the transistor, the emitter had to connected to ground or 0V of the AVR, then how you control the supply to the AVR?

I guess you're trying to do something like this:

BillHo:
How do you connect the collector of the transistor?
For AVR to control the transistor, the emitter had to connected to ground or 0V of the AVR, then how you control the supply to the AVR?

That's a good point, I hadn't thought of it like that. I tried having the + side of the AVR circuit on the +5V pin of the VR and the 0v/gnd side connected to the negative side of the battery and ground pin of the VR. But I guess that means there will be no current flowing from the avr pin through the base and emitter? I need to re-wrap my mind around this

pylon:
I guess you're trying to do something like this:

Auto Power Off - not working :( - #15 by pylon - Project Guidance - Arduino Forum

Yes, that's it exactly! I will have to try to understand that design and re-implement with what I have. He ended up using a (4 pin) optocoupler, but I only have a bunch of transistors at the moment.

Okay, I built this circuit and it seems to work ok. I even did it up in Fritzing (my first real attempt, sorry about the mess).

When I push and hold the button, the atmega is powered up and sets pin D5 low, at which point the button can be released and the circuit will stay on until D5 is set high.

Can anyone see any problems with the circuit, or have suggestions for improvement?

Cheers, Buzh

selfpowercontrol.fzz (17.3 KB)

It's hard to tell, have a normal electrical drawings?
If it the same, as in post reply #16 http://arduino.cc/forum/index.php/topic,105255.15.html ?

Magician:
It's hard to tell, have a normal electrical drawings?
If it the same, as in post reply #16 http://arduino.cc/forum/index.php/topic,105255.15.html ?

It is basically the same, but I have a voltage regulator and battery mixed in as well. Tried to make a diagram with fritzing, but couldn't get the routes right. Will give it another go, but not today.

Oh, I forgot to draw a 10pF ceramic cap between vcc and gnd! Also, should add a resistor to the led, but I neglected it as it is just there for testing. :grin:

My main interest at the moment is stability/reliability, simplicity and power consumption. I've already made one on a stripboard, and it works well as far as I can tell. But I am going to make more of these, and place them outdoors, possibly in remote locations which prohibits maintenance to once or twice a year! So I would be very interested in any suggestions as to improvements! Or, ofcourse, confirmation that it's all just fine 8)

If power consumption is concern, I'd replace BJT with MOSFET, in current configuration, circuitry (referring to reply #16) drains about 2 mA just to keep arduino "on". Probably, more than 3 mA with higher input voltage 5V < Vin < 9V.
http://ruggedcircuits.com/html/circuit__11.html In this circuit wasted current less than 0.1 mA, and you can make it even less setting higher resistors value 47 k to 100 k or 470 k.

I'm currently building a project that has no on/off switch and needs to power down if inactive. I'm doing it using the power down mode of the mcu, which reduces the current it takes to a fraction of a microamp (atmega328p). It's powered by a 9V battery, so to produce 5v I'm also using a low-dropout micropower regulator (MCP1702) which has a unloaded current draw of 2uA typical. A 9v alkaline battery has a capacity around 600mAh at low drain. So with about 3uA current drain, the theoretical battery life when the circuit is powered down is 200,000 hours, or about 22 years - much longer than the shelf life of the battery.

A pushbutton connected to one of the external interrupt pins is used to wake it up and turn it on.

Magician:
If power consumption is concern, I'd replace BJT with MOSFET, in current configuration, circuitry (referring to reply #16) drains about 2 mA just to keep arduino "on". Probably, more than 3 mA with higher input voltage 5V < Vin < 9V.
http://ruggedcircuits.com/html/circuit__11.html In this circuit wasted current less than 0.1 mA, and you can make it even less setting higher resistors value 47 k to 100 k or 470 k.

Thanks, that's good to know! I think I'll be trying to make a later version using that scheme instead. For the record I'm using an LM7133A to take the 9v down to 3.3. I used an ammeter and read about 30-35mA during operation, and <0.000 when off. Since each activation runs for about two minutes, I reckon it is good for about 500 activiations, if the battery is 500mAh (correct me if I'm wrong!).

dc42:
I'm currently building a project that has no on/off switch and needs to power down if inactive. I'm doing it using the power down mode of the mcu, which reduces the current it takes to a fraction of a microamp (atmega328p). It's powered by a 9V battery, so to produce 5v I'm also using a low-dropout micropower regulator (MCP1702) which has a unloaded current draw of 2uA typical. A 9v alkaline battery has a capacity around 600mAh at low drain. So with about 3uA current drain, the theoretical battery life when the circuit is powered down is 200,000 hours, or about 22 years - much longer than the shelf life of the battery.

A pushbutton connected to one of the external interrupt pins is used to wake it up and turn it on.

Wow, I didn't realize the idle draw was that low! That's food for thought for sure, this whole circuit is redundant in that case :grin:

That's food for thought for sure, this whole circuit is redundant in that case

Well, arduino itself is "redundant" for power limited design. There are a lot of microprocessor, which consumed less current in standby mode, and what more important, 1000x times less power to do same calculation as arduino does in active. 35 mA shrinking down to 3 uA.