Shop OBEX P1 Docs P2 Docs Learn Events
Pushbutton based power on / self power off — Parallax Forums

Pushbutton based power on / self power off

EscamoteurEscamoteur Posts: 12
edited 2008-01-18 16:33 in BASIC Stamp
Hi,

I'm pretty new to BS2. I am an software engineer that starts to explore the world beyond the µC.

Now I want to achieve the following:

I have a project that should be powered on when pushing a button executes a program once and then cuts the power of the BS2 automatically.

This is because I really only need the execution of the program on pushing the button from time to time and I want to reduce power consumption to the absolute minimum.

Best

Thomas

Comments

  • jmalaysiajmalaysia Posts: 97
    edited 2008-01-17 13:56
    The stamp will start executing whatever program you write immediately upon power up.· You could·just use a push/push off switch to break the power source to the stamp.· If you need to use a momentary switch then the easiest way I can think to do what you want is to get a delay timer that will retain power long enough for the stamp to execute whatever you want.· You could probably incorporate the timer into the program but that would require some thought and it's too early in the morning for all that!
  • EscamoteurEscamoteur Posts: 12
    edited 2008-01-17 14:03
    Thanks!

    I do not want to switch it off afterwards, the program should switch it of as it's last statement. The question is how to design the self holding on switch (I know how to do this with a relais, but I wnt to use transistors and how to switch it off by a IO-Pin

    Best

    Thomas
  • KMoffettKMoffett Posts: 7
    edited 2008-01-17 15:07
    OK, this is not a BS2, but I did it with another µC and it should work for your requirements. Pushing the switch powers the µC. The programs immediately sets P0 high. This turns on Q2 and Q1, maintaining power to the µC after the switch is opened. The Program can later set P0 low and go to END, to power down everything. C3 makes sure that the µC is powered long enough for the program to END, and R1 makes sure that C3 discharges after the power is disconnected. The values for these two depend on the µC quiescent current and loads on the outputs, and are not critical...on one setup I used 4.7µF and 22K.

    Ken
    539 x 333 - 19K
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-01-17 15:08
    I think people have done this with the 'Reset' signal -- then have code put the BS2 in an ultra-low power state.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-01-17 17:01
    I like KMoffett's circuit. It would work to switch either Vdd or Vin. Just make sure that C1 is rated for enough voltage if you use it switch Vin.

    -Phil
  • Lee HarkerLee Harker Posts: 104
    edited 2008-01-17 17:13
    I used this exact concept in a microcontroller circuit recently·and it·is pretty simple. You·power your circuit using a·voltage regulator that has an on/off pin; there are many to choose from. You put a high value resistor on it to keep it normally off and then you connect a pushbutton to turn it on "momentarily". This pin will also be connected to one of your port pins, possibly through a 220 ohm resistor to protect the processor. When the program starts, one of your first instructions will be to activate the pin that will hold the regulator on. That will be fast enough to beat your finger leaving the pushbutton. When your program has completed, you shut off the regulator and the "hold off" resistor will keep it deactivated until next time.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2008-01-17 17:26
    Lee Harker

    You·power your circuit using a·voltage regulator that has an on/off pin; there are many to choose from.

    Do you have a part # that i can look at some Thank You for any help that you can give me in this matter

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-01-17 18:24
    The circuit could also be simplified using only a single MOSFET on Vin, and using the PB to provide the initial gate voltage until the I/O pin goes high through a resistor to hold it, and later terminate it.· Of course you would still need a few support components, such as the pull-down resistor for the MOSFET, etc.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • KMoffettKMoffett Posts: 7
    edited 2008-01-17 18:55
    Chris,

    Is this what you were thinking? SW1 grounds the gate, turning on the P-Mosfet and powering the µC. The Program makes P1 a low output holding the Mosfet ON. To terminate, the program makes P1 a high impedance input. Is there any possibility of this I/O pin appearing as a ground as a BS2 (or any PIC based controller) looses power? Is there a current path from the battery through R1, R2, and P1 to ground with the µC unpowered?

    Ken
    518 x 281 - 17K
  • Beau SchwabeBeau Schwabe Posts: 6,569
    edited 2008-01-17 19:11
    Escamoteur,

    This topic has come up a few times... originally I had designed this circuit around a BS2 for a "doorbell" for my daughters play house.· In her playhouse and MANY doorbell presses, a·9V battery would last over a year with this circuit.



    http://forums.parallax.com/attachment.php?attachmentid=38912

    Source Link:

    http://forums.parallax.com/showthread.php?p=550676



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

    IC Layout Engineer
    Parallax, Inc.
  • Lee HarkerLee Harker Posts: 104
    edited 2008-01-17 19:32
    Sam,

    Here's the regulator I used for my auto off circuit. Digikey #425-1713-1-ND. There are quite a few other as well.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-01-17 19:34
    I don't think the single-transistor scheme will work with Vin. Because of the Stamp's input protection diodes, the MOSFET gate will still be held low w.r.t. Vin, even when the control pin is floating. So it won't be possible for the Stamp to turn itself off. The additional NMOS (or NPN) is necessary to allow the PMOS gate to be pulled all the way to Vin to ensure complete cutoff.

    -Phil
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-01-17 20:13
    Ken/Phil,

    That is similar...I was thinking the resistor on the I/O line would prevent the MOSFET gate from being pulled low...Of course, I wouldn't have used a 100K pull-up resistor I would have used 10K. Unfortunately I do not have any P-Channel MOSFETs on hand...Only several N-Channel so I can't really test the theory anyway. =( In retrospect I remember Beau's circuit working for a friend who happened to spot his thread and had a use for it, but the current of the system would be limited by the 2N3906, which is under 200 mA I believe...Still, for a battery powered circuit it's pretty hard to beat.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Beau SchwabeBeau Schwabe Posts: 6,569
    edited 2008-01-17 21:19
    "...but the current of the system would be limited by the 2N3906..."· - Your not limited to using a 2N3906

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

    IC Layout Engineer
    Parallax, Inc.
  • MikeKMikeK Posts: 118
    edited 2008-01-17 22:17
    I've used Beau's circuit successfully on several low-power circuits. Thanks Beau!
    Mike
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-01-18 00:34
    Beau Schwabe (Parallax) said...
    "...but the current of the system would be limited by the 2N3906..."· - Your not limited to using a 2N3906
    But of course...· =)· Just wanted to make sure anyone using the circuit as-is doesn't try to run a few relays, motors or other high-current devices from the switched power without taking that into consideration.·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • EscamoteurEscamoteur Posts: 12
    edited 2008-01-18 08:45
    Hi Chris,

    I got an even simpler solution from a german forum. They recomended to use a High-Side Switch like the BTS621 and connect it with two diodes to the button and to the µC

    Thomas
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2008-01-18 16:33
    ·Lee Harker

    Thank You for your reply

    I look at the Data Sheet it show a test· circuit· but it dose not give all of the part· value

    What· circuit do you use with this chip

    Thank You for any help that you can give me in this matter

    http://www.sharpsma.com/Page.aspx/americas/en/part/PQ1X501M2ZPH/

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam
Sign In or Register to comment.