power interrupt/turn power off
hi,
im back. [noparse]:)[/noparse]
ok. my next challenge is to be able to turn the power off and on. the problem is that there is no way to do this without pulling the battery out and putting it back in. my problem is that for a solution....that is not a viable answer.
why do i need to do this: because power consumption is rather high for a 9v battery and expenses will start to add up because my program will be an infinite loop which checks for input from buttons. if the program runs in an infinite loop without doing anything else i will be blowing through about 180 9v batteries per year.
i believe that with a combination of code i can trick the hardware to reset itself. i can then code in a loop counter to say....if you ran this loop say...x amount of times....end the loop and go into power save mode.
the problem is...how do you SAFELY create a power interupt or something thing will reset program execution with a button press.
thanks,
kevin
im back. [noparse]:)[/noparse]
ok. my next challenge is to be able to turn the power off and on. the problem is that there is no way to do this without pulling the battery out and putting it back in. my problem is that for a solution....that is not a viable answer.
why do i need to do this: because power consumption is rather high for a 9v battery and expenses will start to add up because my program will be an infinite loop which checks for input from buttons. if the program runs in an infinite loop without doing anything else i will be blowing through about 180 9v batteries per year.
i believe that with a combination of code i can trick the hardware to reset itself. i can then code in a loop counter to say....if you ran this loop say...x amount of times....end the loop and go into power save mode.
the problem is...how do you SAFELY create a power interupt or something thing will reset program execution with a button press.
thanks,
kevin
Comments
hmmm. maybe i can do this through program execution alone or atleast find a middle ground....but would really prefer a sleep until interrupt(hardware/brown out or software) solution because moving in and out of sleep mode and the programattic checking will still add up to some rather serious power consumption.
proposed:
loop
a loop counter.
when loop count gets to a certian x
auto sleep/nap for x(15/30) seconds
then instant check if check is there input(means holding a button down for that period)
if no input
sleep again
if input
use a goto type reset to restart program execution
thanks,
kevin
Post Edited (qdoggmets) : 11/24/2009 4:11:28 AM GMT
ok....think i answered my own question. steping through some things....
i think i can put a button in place that links vdd to vss when pressed and then throw my logic in on loop recognition to auto sleep.
.....right?
kevin
solved it exactly like i thought.
i can reset the program connecting vdd and vss through a button connection.
this means i can put a loop counter in place into my infinite loop·to sleep nap etc after x number of·counts·and....ideally "end" the program until the button is pressed for it to reset.
i made a short video since i couldn't really find anything that addressed this problem and post it on my website shortly. after i do that i will post a link to it.
thanks,
kevin
Post Edited (qdoggmets) : 11/24/2009 4:54:52 AM GMT
First, run the Stamp off a 6V battery made up of 4 AA Alkaline cells. You can buy a 4 AA battery holder and 9V battery clip from RadioShack and connect those together to substitute for the 9V battery (be very careful about polarity ... the red/black colors will likely need to be backwards). It will last way much longer than a 9V battery.
Second, write your program so it spends most of its time sleeping or napping and only wakes up a few times a second to check the status of the button.
You'll find that the AA battery lasts for a long time.
i really appreciate your input because it seems like you are very active in the forum(i think you responded to my other post i made today) but i think that my solution is really the easiest considering my homework board only takes 9v batteries and i am a beginner and how much brain power and beer it took to come up with that after i told there was not way to do what i wanted to do by parallax.
in case you didn't pick up on my small hint about what my project is....my project is to have a beer delivered to me·via commands given from a remote control·so i don't need my hardware and software checking if i want/need a beer a couple of times every second.
additionally my solution/program/infinite loop will spend damn near all of its time in sleep/nap mode or completely terminated if i push the sleep/nap/exit time to its maximum brink allowed by pbasic with a single wake/check and reloop of a fraction of a second.
is there a problem electrically with the way i plan to impliment the solution? by this i mean am i going to cause long term damage to any electrical components? additionally this is a short term solution so i don't run through 50 pounds of batteries this year.
comments appreciated.
thanks,
kevin
Post Edited (qdoggmets) : 11/24/2009 5:10:35 AM GMT
I agree that your program will spend most of its time in sleep/nap mode. If you check the Stamp documentation, you'll see that the current drain is well under 100uA. The built-in regulator draws 100 times that (about 10mA). A 9V battery has about 500mAh capacity. With just the regulator quiescent current, it'll last about 2 days. A 4 x AA battery pack has about 2000mAh capacity, maybe more. A single 9V battery is maybe $1.80. A 4-pack of AA cells is $3, yet lasts at least 4 times longer.
If you want to reduce the power consumption further, you'll have to come up with a different power supply for the Stamp since the high drain is from the voltage regulator.