Electronic – Energy efficient one button on/off with extra function

buttonmicrocontrollerpicswitches

(Old) cellphones have a button to turn it on (when off), end a call (when on, short press) or turn it off (when on, long press).

I need something similar for a microcontroller. The device is battery-powered so the circuit should be as energy-efficient as possible. In addition to that, the fewer IO pins I have to use the better. I understand I need at least one as an input to read the state. Size isn't really an issue, but smaller is better.

The microcontroller in question is an XLP PIC16F1829. If I'd use a SLEEP instructions and an input button on an interrupt pin, it would consume about 40uA in sleep, considering the peripherals I'm using. I hope I can get something drawing less current. The circuit should be energy-efficient when on as well.

What are some common energy efficient ways to make a one button on/off function with an extra option for a microcontroller?

As you can see, I already added a circuit myself. However, I don't know how energy-efficient it is when on, and there might be better options.

Best Answer

If you need a solution that doesn't require a voltage regulator i.e. operates directly on the Vcc lines to the PIC then I've modified it slightly (and for a good reason): -

enter image description here

The reason it's modified is that the BJT pass transistor might drop a little too much voltage under load if you are just switching an already regulated Vcc to the PIC. I've replaced the pass-transistor with a P channel FET and removed the 2k2 and 33k resistors on your circuit. The 2k2 is needed to protect the BJT pass transistor and the 33k put a max limit on the pass transistor's base current - not needed when using a P channel FET.

I've also added a 10k pull-up on PD3 but this can be an internal pull-up in the PIC. What looks like a suitable P-channel FET is the TP0101 - it's the first one I came across when googling "Low Vgs(theshold) P channel MOSFET". There will be plenty that will do but this one has low on resistance (<1ohm) with just 2.5V drive on the gate and that was my primary aim.

It will also work up to over 10V so could be used prior to a regulator too.

Energy efficiency when "on" will be better that the BJT circuit because it doesn't need base current to keep it on. When powered off, both circuits will be really low on current but maybe the P channel leakage will "waste" 1uA leakage into the load - it's probably a good idea to make sure this 1uA doesn't somehow develop a voltage on the PIC that might cause it to "strangely" power-up - use a 100k load on the output - this will develop 0.1V across the PIC's power pins and kill off the possibility.

Related Topic