SMALL - espritmodel.com SMALL - Telemetry SMALL - Radio
Reply
Thread Tools
Old Dec 13, 2005, 12:44 AM
Registered User
Joined Jan 2002
42 Posts
timed power switch with a pic

Hi all,

I am working on a PIC project and would like to use a button to power off the pic after it is pressed for like 2 seconds. Just like many of the devices you can get when you press the power button for a few sec to turn it on and then again to turn it off. This button also cycles through some other modes. There is also another button used for other functions. I am using the port change int (rb4..7)to read the button presses. Rb 0..3 is used for an LCD display. Can anyone give me a few hints Right now it kinda works but wakes up with any keypress after is shuts down. I am almost there arggggg.

Any help would be appreciated...
thanks
Kalman
cmosfet is offline Find More Posts by cmosfet
Reply With Quote
Sign up now
to remove ads between posts
Old Dec 13, 2005, 01:43 AM
Xtreme Power Systems
Lake Havasu, AZ
Joined Jun 2005
15,833 Posts
The BEST way to do this is by using a dual comon cathode diode, with one side going to the PIC (pulled up) as the button state to be read by the PIC, and the other side going to a PNP transistor gate with common split running back to the PIC for a "power on hold" line that will hold the gate low. This makes the PIC really shut off (as in 0 power consumption). You can use LDO regs with super low current draw in standby, but you will always be drawing something. The method I describe has more draw on the battery through air leakage than the current required to run it.

RB7 is set to an input to read SW1's state. Make sure you turn on the weak pull-ups. RB6 is set to an output and driven high to hold the power on state. When you press SW1, power is supplied to the PIC through the PNP transitor->voltage regulator. This design works with ICSP. I designed this circuit 4 years ago, and I have used it as you see it in dozens of commercially available PIC based products. It works!
JimDrew is offline Find More Posts by JimDrew
RCG Plus Member
Last edited by JimDrew; Dec 13, 2005 at 01:51 AM. Reason: Added picture
Reply With Quote
Old Dec 13, 2005, 10:48 AM
Registered User
Mr.RC-CAM's Avatar
USA
Joined Oct 2001
5,181 Posts
If I understand your problem, you have the wakeup feature working, but you do not like the issue that other keypresses also wake up the PIC. Instead, you want only one particular button to do that and only if it is held down for a short period. Is that the situation?

If so, then it is all a matter of checking for the source of the keypress wakeup interrupt and then checking for the correct press timing. If it is not the key that you want, or the keypress time is not correct, you just put the PIC back to sleep without doing anything else.
Mr.RC-CAM is offline Find More Posts by Mr.RC-CAM
Reply With Quote
Old Dec 14, 2005, 01:17 AM
Registered User
Joined Jan 2002
42 Posts
Thanks guys,

yes Mr RC-CAM, thats exactly what I am trying to do. Driving me crazy. Cant figure it out for some reason I am getting close though. Thanks for the advice.!!! I "thought" I am doing what you say but keep getting confused with how to wakeup...sleep...setting flags and not getting back into the right parts of the code. argggg I am not giving up.
cmosfet is offline Find More Posts by cmosfet
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Power Switch with Voltage indicator Romych DIY Electronics 10 Mar 17, 2005 01:28 AM
Yippee! 15 amp wattage esc with bec and power switch cheap new flyer Aircraft - General - Radio Equipment (FS/W) 6 Oct 30, 2004 07:32 PM
Hyperfly anyone playing with one? and seems I have a power problem with it tooooo!!!! jpduke Electric Heli Talk 5 Oct 16, 2001 01:02 AM
Sudden power loss with new model astroboy Power Systems 5 Sep 26, 2001 10:53 AM
On/Off Switch with BEC? martin johnson Electric Plane Talk 1 May 25, 2001 08:27 PM