Shop OBEX P1 Docs P2 Docs Learn Events
Software Power Off — Parallax Forums

Software Power Off

Chad GeorgeChad George Posts: 138
edited 2009-03-23 22:53 in Propeller 1
I'm working on a new Propeller based circuit design that needs to have a software Power-Off feature.

The idea is to have a momentary switch turn the system on, but only turn off under software control. Originally, I thought this would be pretty easy, but after several design iterations I've found it to be trickier than expected.

One issue is that the system needs to maintain power after being turned on even if the Propeller isn't in control (ie. its being programmed or is reset). This has ruled out simple solutions involving holding a line low immediately after the Propeller turns on.

I've come up with a solution, but I'm not convinced its the best way to do it. I'm using some auto-mux power switches to select between battery or external power that have an active low enable line (with internal pullup).

The idea is to have the momentary switch and a mosfet in parallel. The momentary switch pulls the enable line low to turn the system on, then the mosfet keeps it there. System power holds the mosfet on. When the propeller wants to turn the system off it pulls the mosfet base low which kills the enable.

My problem is analyzing what's going to happen as system power starts to drop. Obviously, at some point I'll loose the Propeller that's holding the mosfet OFF. My concern is there might be enough residual voltage left on bypass capacitors to turn the mosfet back on and re-enable the power switch.

Maybe I'm just making things too complicated and somebody out there has a better solution or a way to make mine work.

Thanks.
951 x 513 - 20K

Comments

  • KyeKye Posts: 2,200
    edited 2009-03-22 20:59
    Try using an SCR, they are usefull for these situations.

    Here's a circuit for you.

    attachment.php?attachmentid=59567


    Pushing the button activates the SCR which will draw its power through and Mosfet and remain on. When you want to turn the system off just pull the Mosfet's gate low. By doing that the SCR will then turn off until the button is hit again. You attach the chip to the other end of the SCR.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,

    Post Edited (Kye) : 3/22/2009 9:23:03 PM GMT
    567 x 357 - 13K
  • mctriviamctrivia Posts: 3,772
    edited 2009-03-22 21:00
    could you not have your button trigger the reset. to turn off just let all cog stop. still draws current but would be in the u amps

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-03-22 21:48
    Kye,

    Your circuit shows a pMOS FET, but I'm sure this is not what you meant. But, assuming you meant an nMOS FET, the 3.3V gate voltage will not hold it on in a source follower circuit, such as yours, since VGS will be nearly zero.

    -Phil
  • Chad GeorgeChad George Posts: 138
    edited 2009-03-22 21:57
    Kye,
    The SCR seems like an interesting idea, but what kind of voltage drop does it normally have?

    My system has to be powered off a single cell Li-Po battery so I don't really have any headroom for the 3V3 regulators as it is. Thats why I went with the auto-mux switches...I couldn't even take another Schottky diode drop.

    mctrivia,
    unfortunately, I need this to really power everything off. I have other mechanisms in place for "low-power" modes, but here I'm looking for as close to a physical ON-OFF switch as I can get.


    I came up with another solution that I'm pretty sure will work. I added another mosfet basically making a bistable multivibrator. This way I'm pretty sure it'll hold itself off as system power goes away (even after the propeller has dropped out due to low voltage)

    But this seems really overkill...maybe I'm just being too paranoid. Has anyone done something like this before?
    238 x 264 - 8K
  • mctriviamctrivia Posts: 3,772
    edited 2009-03-22 22:18
    mosfets I have used have been better then shotkey if you want to power off that low voltage you should use a buck converter.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-03-22 22:22
    Here's a circuit that should work:

    attachment.php?attachmentid=59569

    When the button is pressed, the pMOSFET gate is pulled low, and it conducts, raising the base of the NPN, so that it, too, conducts, holding the gate low. A low on the /Kill pin pulls the NPN base below its 0.6V threshold, releasing the collector and turning off the MOSFET. Once the MOSFET is off, the gate pullup will keep it off.

    You will need a low RON pMOSFET with very low gate threshold. A Fairchild FDT434P would work, but it may be overkill. Moreover, the off-state leakage current in this circuit should be virtually nil.

    -Phil
    480 x 213 - 2K
  • Jimmy W.Jimmy W. Posts: 112
    edited 2009-03-23 01:59
    Is a minimal part count required for space? if so consider a single Shockley diode. I will draw something when I get home.


    PS will you have a 5v rail available? if not then it would not be workable.
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-03-23 02:28
    Phil Pilgrim (PhiPi),

    Nice!.. I like your "Hybrid discrete SCR" approach. As you know SCR's can be tricky to turn off because they latch "ON" so hard, but that's if it’s a complete bi-polar solution. Your design looks like it would not have that problem at all. I'll have to simulate it, but it looks good.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Chad GeorgeChad George Posts: 138
    edited 2009-03-23 13:26
    Jimmy,
    I don't always have a 5V rail, sometimes its the only on battery power with is 3.6 to 4.2V

    Phil,
    I like your design. One question I still have is what happens when the system voltage drops below the level required for the Propeller? The propeller will stop pulling the Kill signal low, but there will still be some residual voltage left in the system (mainly due to capacitors).

    I keep wondering if its possible for everything to turn back on as soon as the propeller drops out?
    Thats why I was thinking I needed a solution where as soon as the kill signal goes low it doesn't have to "stay" low for the system to still completely shutoff.

    Maybe this isn't as big of a concern as I'm making it out to be.

    Post Edited (Chad George) : 3/23/2009 1:40:50 PM GMT
  • KyeKye Posts: 2,200
    edited 2009-03-23 13:41
    Sorry, for the bad schematic, I was simply trying to provide a concept drawing on how to use an scr for your circuit.

    Phil's circuit is better, I like it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • MagIO2MagIO2 Posts: 2,243
    edited 2009-03-23 14:07
    The propeller has to deliver nothing (pin is an input) or high to keep the power switched on. In case the propeller does not get enough voltage, it's pins should switch to input. This means that the power stays switched on as long as it does not drop below the level needed by the 2N3904. The propeller has to send a short low level for switching off. If it's off it stays off until the button has been pressed again.

    That's how I'd read the schematic.
  • DgswanerDgswaner Posts: 795
    edited 2009-03-23 18:21
    so what about using 2 power supplies? I'd love to be able to add this to my bot, which uses 5v and 3.3v. It would be nice to power it up with one button and down with 1 pin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DGSwaner

    "When in doubt, use C4" - Jamie Hyneman, Myth Buster
  • mctriviamctrivia Posts: 3,772
    edited 2009-03-23 19:17
    how about using a switching regulator with enable pin? more power efficient to start and a simple circuit could be used to allow both push button and prop to enable.

    I am building a module like that right now. see

    the thread about boost/buck

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • Chad GeorgeChad George Posts: 138
    edited 2009-03-23 19:43
    I already have an enable pin on the auto-mux power switch. The problem is the propeller can't "hold" the enable low all the time since all the IO pins will be High-Z during programming, resets, etc.

    Its pretty easy to hold the enable low with another mosfet, but my concern is in the behavior of the system during the shutdown transient.

    The moment power is cutoff (ie the enable line goes high), system voltage will drop off at a rate determined by system capacitance. At some point the Propeller goes into an under-voltage reset state and I'm concerned that existing suggestions might just turn back on again when this happens.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-03-23 20:18
    Chad makes a good point. As soon as the voltage to the Prop drops below the brownout point (2.7V), the pin will be released, and it will power back up again. The solution is to augment the 2N3904 with a three-pin supervisor that trips at, say, 2.8V - 3.0V:

    attachment.php?attachmentid=59580

    The supervisor will drive the '3904's base low when it's supply voltage drops below around 2.9V; high when above. Therefore, once the /KILL pin is asserted low, it will stay low until Vdd drops to 2.7V. By then, the supervisor will have taken over and will continue holding the pin low.

    If there were positive-reset, open-drain supervisors available, the supervisor could actually replace the '3904. But I haven't found one that's suitable. The problem with using a push-pull unit, like the MCP810, is that a high output could still be far enough below 3.3V to keep the MOSFET "on". That's why I left the '3904 in the circuit and used a negative-reset supervisor instead.

    -Phil

    _

    Post Edited (Phil Pilgrim (PhiPi)) : 3/23/2009 8:25:57 PM GMT
    487 x 240 - 3K
  • mctriviamctrivia Posts: 3,772
    edited 2009-03-23 20:30
    my module uses active high enable. if power is brown out it would shut off

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • Chad GeorgeChad George Posts: 138
    edited 2009-03-23 20:48
    Phil,
    I'm glad to hear I wasn't going crazy and imagining this problem.

    I like your approach, but still want to use the auto-mux switch since I also have the problem of needing external and battery power.

    Do you think my bistable-multivibrator approach is viable?
  • mctriviamctrivia Posts: 3,772
    edited 2009-03-23 21:00
    an auto mux power switch can still be used just without the enable. if like the 1 used in my dual source power supply module draws almost nothing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • TreeLabTreeLab Posts: 138
    edited 2009-03-23 21:19
    I am definitely old-school on this one (and perhaps not the best approach for a battery-based system), but ...

    why not use a low-power 5V relay, activated by a 2N2222. The base of the NPN can either be pulled high by a pushbutton or an output pin. No worries, cannot restart on its own, etc. Definitely not very elegant though.

    WOOPS ! Missed the bit about staying on during programming ... sorry... Could you replace the momentary contact switch with a SPST toggle switch that you keep On during reprogramming?

    Cheers!
    Paul Rowntree

    Post Edited (TreeLab) : 3/23/2009 9:29:16 PM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-03-23 21:39
    Chad,

    The bistable approach would probably work. The only problem I see is that it draws power (about 330µA) when the Prop is off, since one of those transistors always has to be "on".

    -Phil
  • Chad GeorgeChad George Posts: 138
    edited 2009-03-23 22:53
    I was going to power the bistable transistors from the "switched" side, to make sure won't draw any power when the system is off.

    I guess the important question is whether the bistable will hold its state as system voltage goes away.
Sign In or Register to comment.