Pages: [1] 2   Go Down
Author Topic: Latching power schematic - am I doing it right?  (Read 2755 times)
0 Members and 1 Guest are viewing this topic.
Birmingham, UK
Offline Offline
Jr. Member
**
Karma: 1
Posts: 51
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to make an Arduino circuit that comes on when you press a momentary button, but then stays on until the Arduino decides it's time to switch off. Fairly common situation, I'd imagine, but I've never done it before.

Is my [attached] schematic workable? Looks sensible to me, but I've discovered that that means remarkably little smiley

Basically, I'm imagining that the circuit won't do anything when power is first applied, as there's no current through the base/emitter of the TIP102. Press the power button on the right, and the TIP102 will turn on, allowing power through the voltage regulator and therefore powering up the arduino. The first line of code in the arduino will set the 'power control' pin high, so it'll keep the TIP102 powered even after the user has taken the finger off the button.

Then when I want the arduino to power down, all I have to do is set the 'power control' pin low.

The two diodes are just acting as an 'OR' gate, and to stop current from finding a route straight from the power button to the arduino.

... Or am I making a basic mistake? Thought it was worth asking here before buying the bits.


* latching power.jpg (31.08 KB, 968x459 - viewed 124 times.)
Logged

Birmingham, UK
Offline Offline
Jr. Member
**
Karma: 1
Posts: 51
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Oops - just to add, I'm slightly concerned that the decoupling caps across the input and output of the voltage regulator may cause problems.
Should they perhaps be connected to ground *before* the TIP102 (the 'switched ground', if you will)?

I'm not worried about the circuit inadvertently powering on when I first connect the 9v battery, as long as it'll behave from then on.

h
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 618
Posts: 33959
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm slightly concerned that the decoupling caps
No they are fine.

That looks like it might work. The only problem might be when the arduino want's to turn off and it will not be able to hold the output high long enough to be off. But I think it would work. If you have problems then you might like to look at looking at the on button with the arduino and only turn on the holding output when the on button is being pressed. But try this first.

Conventionally this is done with two transistors connected as a multivibrator or flip flop. It is kicked on and then kicked off so it doesn't require any logic level to hold.
Logged

Birmingham, UK
Offline Offline
Jr. Member
**
Karma: 1
Posts: 51
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the response!

Quote
That looks like it might work. The only problem might be when the arduino want's to turn off and it will not be able to hold the output high long enough to be off.

The Arduino's holding the power on by keeping a pin high, so do you mean it may not be able to hold the output low for long enough?
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 618
Posts: 33959
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

No the on bit should work. It is the off bit that might be problematical.
Arduino sends pin high, power starts dropping, then you enter a sort of twilight zone where you might get resting going on and restarting the program and re asserting the pin low. Electronics do funny things when operating a voltages on the verge of operation.
But as I said it will probably work.
Logged

Birmingham, UK
Offline Offline
Jr. Member
**
Karma: 1
Posts: 51
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry to harp on, but I'm a bit confused now - the TIP102 conducts when there's power applied to it's base, doesn't it? So I'm triggering the power on by giving it some volts, and the Arduino takes over and keeps supplying enough volts to keep the TIP conducting.

When it's time to switch off, the Arduino output goes LOW, causing the TIP to stop conducting.

Or have I got things arse-about-face?
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 618
Posts: 33959
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes you have it right.

My worry is the potential thrashing about of the arduino pin as the power dies, it might just trigger it on again.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17292
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


When I've wanted project with manual on/automatic power control I've used a small single coil latching relay circuit. Draws zero current once latched on. Software turns output pin high in setup function, set output pin low when program wishes to power off.

http://img25.imageshack.us/img25/563/08miq7.jpg

Lefty
Logged

Birmingham, UK
Offline Offline
Jr. Member
**
Karma: 1
Posts: 51
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@Grumpy_Mike - thanks for checking for me! I'll buy the bits and have a play.

@retrolefty - Yup, a relay was my first thought, but I've only got one 5v/latching one knocking about and I want to save it for bigger badder things. Thought it would be a useful exercise to try and keep the whole thing solid-state now I'm getting a little more experienced with all the analogue 'glue' needed to have my AVRs talk to the outside world.

[edit:] Just looked at your schematic; never come across single coil latching relays before, I've only got double-coil ones. Interesting. A bit confused about C1, though; why is it there? Doesn't it stop the current flowing before the relay's even had a chance to think about moving?

« Last Edit: August 11, 2011, 11:32:13 am by howiem » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17292
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Just looked at your schematic; never come across single coil latching relays before, I've only got double-coil ones. Interesting. A bit confused about C1, though; why is it there? Doesn't it stop the current flowing before the relay's even had a chance to think about moving?

No, upon intital digital output high, enough charging current flows through cap to latch relay on, once cap charges to full +5vdc, current flow stops, but the charged cap then contains enough charge to reverse current flow when output pin goes low, resetting the relay. It's a cleaver little circuit that is more then meets the eye at first. The resistor shown is optional as if you try and turn the circuit back on too soon before the cap has fully discharged it won't relatch, the resistor ensures the cap fully discharges when off.

If one doesn't mind the continous 13ma current flow draw of the relay coil, then the cap and resistor can be done away with and relay just wires from ground to the output pin.

By the way Pololu seels nice sold-state power switches:

http://www.pololu.com/catalog/product/750

Lefty

« Last Edit: August 11, 2011, 12:21:59 pm by retrolefty » Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6613
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I've just posted a schematic to solve this very problem in thread "Switch Arduino ON, it does tasks, then Switches self OFF" which is also in this section of the forum.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Calgary, AB
Offline Offline
Newbie
*
Karma: 2
Posts: 46
Arduino Newbie
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Howiem

I was a litle concerned with your design with having the transistor in the base of the 7805.  This will create an offset that will increase the output of the 7805 to about 5.7Vdc   and could also cause some instability if the voltage across the TIP102 varied.  Since there is no voltage on the GND pin of the 7805 and very little current, I doubt it would work without adding a resistor from +9V to the collector, and I am not sure that would turn off the 7805.

REMOVED solution, thank you Magician for pointing out the err in my version.

Regards  Bill
« Last Edit: August 12, 2011, 09:21:15 am by Bill_Kerr » Logged

Don't you just hate ONE D 10 T problems?

Montreal
Offline Offline
Faraday Member
**
Karma: 29
Posts: 2590
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

IMHO, it's wrong way to switch output by disconnecting a ground of 78XX. It would send higher output voltage to load, up to unregulated Vin ( 9V ), creating serious threat to load.
« Last Edit: August 11, 2011, 05:21:45 pm by Magician » Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 29
Posts: 2590
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Bill_Kerr: nice try, but it's not gonna to work eather. (At least no smoke hazard  smiley
In order to keep it "on" Atmega has to output on control pin whatever voltage it getting as VCC plus 2 x p-n junction (1.4 V) what, obviously, it couldn't do.
I'd suggest to have a look on RuggedCircuit "high side drive"
http://ruggedcircuits.com/html/circuit__19.html
only instead of solenoid and diode, collector should be connected to 7805 input terminal. In "off" state wouldn't be any current, which is important with battery power source.
Logged

Birmingham, UK
Offline Offline
Jr. Member
**
Karma: 1
Posts: 51
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yup - as many suspected, my circuit doesn't work properly - it latches "on" beautifully, but when the Arduino's finished it's task and sets the power-latch-pin LOW, the power never goes all the way off.

It's obvious in hind-sight what's going on - because I'm effectively disconnecting the ground from the Arduino, the whole Arduino/load part of the circuit ends up floating at VDD, including the power-latch-pin, meaning current flows through the B-E part of the TIP102, keeping it all switched on.

Glad I tried doing this way, though, if only because I've learnt a few important lessons, and my arduino has survived smiley

When I get some time I'll have a look at Magician's high-side drive approach, or the two-transistor bi-stable or flip flop approaches (thanks, Grumpy-Mike and dc42). If all else fails I can always drop in my last precious latching relay to do things the old-fashioned way.

@Bill_Kerr - good point, hadn't thought about the offset effect of having silicon on the base of the 7805... oops

Flippin 'eck, the digital side of electronics is sooooooo much easier [logical, ho ho] than analogue. Getting there, though smiley
Logged

Pages: [1] 2   Go Up
Jump to: