Shop OBEX P1 Docs P2 Docs Learn Events
Power up - auto power down solution? — Parallax Forums

Power up - auto power down solution?

johnfl68johnfl68 Posts: 72
edited 2008-11-08 01:31 in Propeller 1
Hello:

Does anyone have any thoughts on this:

Battery operated situation.

I would like a simple momentary pushbutton, pressing it boots up the propeller.

After the propeller does it thing, it shuts it self off after a determined amount of time (ie 30 seconds).

Maybe a external power monitor chip, with low battery monitor that could be tied to a input on the propeller for a indication. I have a few pins available to handle this and power on/off as needed.

If anyone has done something like, this or has any ideas, it would be greatly appreciated. Also, if I find a suitable power monitor chip/circuit, I will post as well, I am sure others would be interested.

Thanks!

John
«1

Comments

  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-03-21 23:22
    If you want to totally turn off the propeller with the prop determining when to turn off(like you said, low battery or something), you could always use a simple set/reset flip flop. You can have the flip flop output be connected to the base of a transistor that supplies power to the prop/eeprom/etc.

    Basically, a pin on the prop is connected to the reset pin of the flip flop and a pushbutton is connected to the set pin of the flip flop. What happens is, when the prop decides it's time to commit suicide, it will trigger the reset on the flip flop, which will cause it to change to a low state, turning off the transistor powering the prop, and turning the prop off. The flip flop and power will stay in this state until the pushbutton is pressed, "setting" the flip flop high, turning the transistor on, and booting up the prop. This can be repeated indefinately. You can even install a status LED on the "not ouput" of the flip flop to show if the prop is powered down without using an extra pin from the prop.

    As for the power monitor chip, you could always use a simple 8bit Analog to Digital converter IC. You can even get these(and many others) free from all sorts of companies as samples.
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2008-03-21 23:27
    Philldapill,

    Look at my reply to this link... http://forums.parallax.com/showthread.php?p=550676

    ... It was originally designed for the StampII , but the·same concept should work on the Propeller.

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

    IC Layout Engineer
    Parallax, Inc.
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-03-22 00:37
    Wow. I'm going to jump ship and go with Beau's idea. Very elegant.
  • Ken PetersonKen Peterson Posts: 806
    edited 2008-03-26 13:42
    Beau's solution is simple, but don't forget that you have to hold the button until the Prop boots. If you don't want to do that you may have to add a way to make it latch. Perhaps that can be accomplised by putting a 10K resistor between the base of the 2N3904 and the Vin pin of the Prop.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    The more I know, the more I know I don't know.· Is this what they call Wisdom?
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2008-03-26 17:09
    Ken Peterson,

    You could put a capacitor across the C-E junction of the 2n3904.... just realize, that when you turn the power "OFF" in software that there will be a delay before power actually goes off.

    Scratch that, yeah, I think that using a·47K between Vin, and the base of the 2n3904 should work just fine.· 10K might not allow the NPN to turn off.

             10K      2.2K 3.3V >---/\/\--o--/\/\---> GND (From I/O LOW)
                   |
                   o---------> 0.595V (Still enough to keep NPN transistor "ON")  
    

    [size=2][code]
             15K      2.2K 3.3V >---/\/\--o--/\/\---> GND (From I/O LOW)
                   |
                   o---------> 0.422V (Still enough to keep NPN transistor "ON")  
    

    [/code][/size]
    [size=2][code]
             47K      2.2K 3.3V >---/\/\--o--/\/\---> GND (From I/O LOW)
                   |
                   o---------> 0.147V (Enough to turn NPN transistor "OFF")  
    

    [/code][/size]
    ··

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

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 3/26/2008 6:08:27 PM GMT
  • LawsonLawson Posts: 870
    edited 2008-03-26 23:58
    You might also want to look into the Propeller's "sleep mode" I.E. stopping all the cogs but one, switching to RCslow, and sticking the remaining cog in a loop that's in a wait state 99% of the time. I'd have to check the data-sheet to be sure, but this should drop the supply current for the Propeller down to a few micro-amps. This would also save on boot-up time because everything is still in the HUB.

    Marty

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Lunch cures all problems! have you had lunch?
  • johnfl68johnfl68 Posts: 72
    edited 2008-03-27 00:53
    Thanks guys. this gives me ideas.

    The only thing I forgot to mention is that I also want to possibly look at the button for a press as an option change, but this still gives me a couple of ideas.

    Thanks again!

    John
  • johnfl68johnfl68 Posts: 72
    edited 2008-06-17 01:53
    Beau (and others):

    Sorry - I got side tracked on this with other projects.

    You first solution was for the stamp - is this a one for one match to work with the prop, or are there any possible resistor value changes? I am out of one of the transistors and haven't gotten any more yet to try this out.

    I actually like the idea of holding the button until the prop is booted for one application (to prevent accidental turn on).

    Does anyone have any ideas to monitor the same push button press after turn on with another pin? Buttons for what I am working on seem to only come in SPST in the size I am looking for. I need to look for a button push after power on as a option change, and it would be nice to use the same button.

    Thanks again for everyones help and input.

    John
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2008-06-17 02:18
    What buttons are you looking at? For several of the small tactile buttons they come as SPST, but they have two "contacts". In otherwords, there are two SPST circuits on it (that is why there are four legs). Having two "contacts" on switches like these allow designers to do exactly like you need or they are there and can be wired in parallel to reduce switch bounce and contact/button failures or to increase the current capability.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter

    www.brilldea.com·- uOLED-IOC, RGB LEDs, TLC5940 driver PCB
    www.tdswieter.com
    One little spark of imagination is all it takes for an idea to explode
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2008-06-17 06:05
    johnfl68,

    There is an updated version for the Propeller that does not require you to "hold" the switch until the Propeller turns on.

    Schematic: http://forums.parallax.com/attachment.php?attachmentid=54043
    Reference Thread: http://forums.parallax.com/showthread.php?p=730612

    ·
    ·
    ·
    Timothy D. Swieter,
    ·
    Careful, some of those switches are just SPST in disguise... internally the contacts are one in the same.· Check them with a meter first, or make sure that when you are ordering, you know which ones your getting.
    ·

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

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 6/17/2008 6:14:16 AM GMT
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2008-06-17 06:21
    Oh yes Beau, most certainly. I should have highlighted this fact better. Some come as two contacts seperate, some do not. Thanks for highlighting this!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter

    www.brilldea.com·- uOLED-IOC, RGB LEDs, TLC5940 driver PCB
    www.tdswieter.com
    One little spark of imagination is all it takes for an idea to explode
  • johnfl68johnfl68 Posts: 72
    edited 2008-06-17 15:48
    Beau:

    I actually DO want the HOLD for my application.

    I did find this - as far as monitoring the same SPST switch for power and user input:

    www.edn.com/index.asp?layout=article&articleid=CA6372827

    John
  • AribaAriba Posts: 2,687
    edited 2008-06-17 23:46
    Attached is a modification of the first circuit to use the same Switch as Power On and Input.

    Andy

    Edit: Use a 22kOhm PullDown-Resistor instead of a 10k at the second I/O.
  • johnfl68johnfl68 Posts: 72
    edited 2008-06-20 20:41
    Ok - going off of Beau's first circuit (hold to power on) - it's not working. I changed the value of the 10K res to 47K so that the voltage should be low enough - and still not working.

    I'm am going to go over everything again, to see if I missed something, but all seems to be in place.

    Any suggestions?

    Thanks!

    John
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2008-06-20 21:14
    johnfl68,
    ·
    Are you initializing the I/O pin HIGH when the Propeller program starts?· You·might need to·pre-load it HIGH before you actually make it an output..
    ·
    The 10K vs. the 47K is·to allow the Propeller to turn·itself "OFF" from the I/O in the event that the button still happens to be pressed.· In that circumstance, you simply have a reset condition.· The reason it is important for the I/O to be able to over-ride the "switch" is so that the Propeller
    does not miss it's opportunity to turn itself OFF if it is a 1-time·software event.
    ·




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

    IC Layout Engineer
    Parallax, Inc.
  • johnfl68johnfl68 Posts: 72
    edited 2008-06-20 21:49
    Beau:

    Setting the pin to high and output is the first thing done, and confirmed with logic probe.

    Here are the transistor logic/voltages I got (switched back to 10k for the time being):

    2N3904

    Collector high 2.85v - low 0.06v on button push
    Emitter low 0.00v - low 0.00v on button push
    Base low 0.10v - low 0.68v on button push

    2N3906

    Emitter high 2.63v - high 3.30v on button push
    Collector high 3.32v - high 3.32v on button push
    Base high 2.86v - high 2.57v on button push

    I am sure this is staring me in the face and simple - but it's eluding me.

    John
  • johnfl68johnfl68 Posts: 72
    edited 2008-06-20 22:43
    Ok - I think it was a bad transistor.

    It's working, but now I have noise in the VGA image (wishing I had a oscilloscope). cry.gif

    John
  • johnfl68johnfl68 Posts: 72
    edited 2008-07-02 21:40
    Beau (and or others):

    I see in your newer version, that switches on (without the hold) you have the transistors before the regulators.

    In the push and hold version, you had them after the regulators. Could this be causing the problem I am having with noise in the VGA output? On the demo board, if I wire it up it works fine, except for the noise in the VGA, but if I power it normally, the VGA signal is clean.

    Anyone have any thoughts on this? I assume I should move the transistors so that they are before the regulators, or do I need to go to MOSFET's like I have seen in another post?

    Thanks, as always! Great help provided by many people on here.

    John
  • johnfl68johnfl68 Posts: 72
    edited 2008-07-18 18:28
    Ok, in Beau's example, can some one please answer the following questions (in red in the attached image)?

    What Voltage is VSUPPLY in the example?
    What load did you use to calculate 10K, 1K and 2.2K?

    I put math in blue, based on data available and assumptions.

    I have read many posts both here and elsewhere in regards to transistors used this way, and everyone seems to have different answers, which makes it confusing. I understand most of the basics, but I like to do the math to match what other people did, but it is hard when you have to make assumptions/

    Thank you!

    John
    881 x 627 - 16K
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2008-07-18 23:11
    There really wasn't that much mathematical thought that went into it.

    The circuit basically is a "gated" SCR (Silicon Controlled Rectifier)
    where the Stamp has the ability to turn the SCR off.

    SCR's are a special case device, basically they are current amplifiers
    under a race condition which is why they latch so hard.

    The supply was meant for a 9V battery, but could be anything 6.2 Volts
    or above, as long as the on-board regulator can handle it. (I wouldn't
    go much above 12 Volts)


    That said, the 2.2K was used to limit the current to the I/O pin to 2mA.

    I just picked a current value of 2mA to start out with and there was no
    need for me to change it.

    R = (VIO - Vdiode) / 2mA
    R = (5V - 0.6V) / 2mA
    R = 4.4V / 2mA
    R = 2.2K

    Note: The current path here goes from the I/O through the 2.2K resistor
    ····· through the B-E junction of the NPN transistor to GND



    Next I wanted to limit the overall current to 10mA.· So subtracting the
    2mA we are already using, that leaves us with 8mA.· A 1K resistor was used
    because it gives us about 8mA (7.8mA) from a 9V supply.

    R = (Vsupply - vdiode) / 8mA
    R = (9V - 1.2V) / 8mA
    R = 7.8V / 8mA
    R = 975 Ohms rounded up equals 1K


    Note: The current path here goes from Vsupply through E-B junction of the
    ····· PNP transistor through the 1K resistor through the C-E junction
    ····· of the NPN transistor to GND


    As far as the 10K resistor.... Originally this design was for a doorbell
    where you would literally touch two exposed contacts in close proximity to
    each other making the resistive connection with your finger.

    The gain is very high from the base of the NPN transistor, so very little
    current is needed here.

    Typically the HFE or gain of these transistors are about 100 but can easily
    range anywhere from 25 to 400, by placing them together in the SCR configuration,
    the combined gain can be 10000

    Since our highest power stamp only needs about 55mA to operate, then with a
    gain of 10000 only 5.5 micro amps at the base of the NPN transistor is all
    that's needed to turn this circuit on.

    10K just seemed like a good value to hand pick out of the drawer at the time
    I designed this circuit.

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

    IC Layout Engineer
    Parallax, Inc.
  • johnfl68johnfl68 Posts: 72
    edited 2008-07-19 00:14
    Well - ok - that makes more sense in a way.

    I am trying to do this with a Prop with a 9 volt battery - so if it wasn't intended for a 9 volt - then I will have to look for anther solution I guess. This would have been ideal otherwise, if I could get it to work with a prop pre voltage regulator, as post voltage regulator it is causing noise in the VGA output from the prop.

    John
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2008-07-19 05:53
    johnfl68,

    Help me to understand your questions. The Circuit that you referenced was something I designed for the Stamp before the propeller existed, and it was intended on being used with a 9V battery. I made a revision circuit that would work with the Propeller, but you say it causes interference with the VGA output.

    What's your supply voltage? ... and are you using the exact circuit that I provided?

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

    IC Layout Engineer
    Parallax, Inc.
  • johnfl68johnfl68 Posts: 72
    edited 2008-07-19 15:21
    Beau:

    I was fine with, and actually want, the button to be held down for my application for power up. Ken was the one who mentioned that you would have to hold down the button, and you came up with an alternate circuit that doesn't need the button to be held down until the prop boots. I have not tried that circuit yet, as I thought it was just a modification of the first, so that you didn't have to hold the button down, so was not of interest to me.

    I am currently working with the Propeller Demo Board with 7.5v power supply that came with it, and have done some tests with a 9 volt battery connected to the 6-9v jack as well, as the final design I am working on needs to be a 9 volt battery. The prop will only be on for about 30-60 seconds at a time, I was getting about 4 hours continuous on a 9 volt.

    I will look at your new circuit (Nano Current Propeller Standby?), although it poses the problem of not having the hold to turn on feature (and reading the same switch with another pin for presses after power up for display changes - but Ariba's circuit should fit into most things).

    Thanks!

    John

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Inigo Montoya: Let me 'splain. (pause)
    Inigo Montoya: No, there is too much. Let me sum up.
    The Princess Bride (1987)
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2008-07-19 17:18
    johnfl68,

    If you are using the original circuit I posted for a Stamp with your Propeller (which is fine, you just have to hold the button down during boot-up)... you may not have enough current drive on your PNP transistor. Try lowering the 1K resistor to something like 470 Ohms or 330 Ohms, or lower (I would not go below 180 Ohms) to increase your current drive.

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

    IC Layout Engineer
    Parallax, Inc.
  • johnfl68johnfl68 Posts: 72
    edited 2008-07-20 03:52
    Beau:

    Thanks again, I am a bit paranoid about letting the smoke out of chips, but haven't done it in a long time. I like to make sure I understand the math on something before I do it.

    I tried the circuit pre Voltage Regulators and the noise in the VGA output is now gone.

    Current in standby is about 15 microamps, and running is 80-90 milliamps depending on what the prop is doing for the short time it is on.

    Thanks again for your help! It is appreciated!

    John

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Inigo Montoya: Let me 'splain. (pause)
    Inigo Montoya: No, there is too much. Let me sum up.
    The Princess Bride (1987)
  • johnfl68johnfl68 Posts: 72
    edited 2008-07-20 19:19
    Ok, now to read the same switch with another Prop pin, I am using the example that Ariba posted in this thread, by adding a diode and resistor.

    I assume that I am making a voltage divider for that section, but Ariba said to use a 22K pull down at the second I/O pin, would this not make too much voltage at that pin? Should it not be a 5.1K or maybe a little lower for the 9 volt battery?

    9 Volt
    10K resistor
    Switch
    I/O Pin = 6.1875 Volts 0.3 milliamps
    22K resistor
    Ground

    9 Volt
    10K resistor
    Switch
    I/O Pin = 3.0397 Volts 0.6 milliamps
    5.1K resistor
    Ground

    Thanks!

    John

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Inigo Montoya: Let me 'splain. (pause)
    Inigo Montoya: No, there is too much. Let me sum up.
    The Princess Bride (1987)
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-20 19:48
    John,
    The important thing is the 10K resistor. The Propeller has protective diodes on the I/O pins that clamp the I/O pin voltage at 0.6V above Vdd (3.9V usually) and at 0.6V below Vss (-0.6V usually). These diodes have limited current handling capability and you don't want to inject much current anyway into the Vdd or Vss network on the chip since there's some resistance and you don't want localized areas of voltage much above Vdd or below Vss. That said, the 10K resistor will very nicely limit this "fault" current to an indefinitely sustainable level. A 4.7K value for the other part of the voltage divider is readily available, would work fine, and would eliminate any worry.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-08-04 07:37
    Beau,
    Attached is a modified schematic of your original·circuit.
    I replaced the 10k pulldown resistor by a 3.3V zener diode.
    I also added a 2k2 resistor in series with the 1N4148 to make
    sure that when SW-ON is pressed, I get more than 1.2V on
    the button input (which happens to be on the SX28).
    I also added a jumper to override the PNP for permanent on
    installation.
    Anything to worry about when using this with 24V ?

    regards peter
  • johnfl68johnfl68 Posts: 72
    edited 2008-11-06 21:57
    ok - sorry - but back to this, I need this is the last thing I need to finish for a project.

    I am using the circuit that is from Ariba, with the added diode with a connection to a second i/o pin with a 10K resister to ground (which he changed to a 22K resister as a edit to his post).

    This does not seem to be enough to to pull the pin high when the button is pushed (1.27V with 22K resistor 1.28V with 47K resistor). I have gone up to about 94K and seems not to change the voltage when pressed from anything greater than about 1.28V.

    Does anyone have any thoughts?

    Thanks as always!

    John

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    President Dale: I want the people to know that they still have 2 out of 3 branches of the government working for them, and that ain't bad.
    Mars Attacks! (1996)
    881 x 627 - 8K
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2008-11-06 22:30
    johnfl68,

    Is this for a 3.3V Propeller circuit?
    What is your supply·voltage?


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

    IC Layout Engineer
    Parallax, Inc.
Sign In or Register to comment.