Single-button power and input with microcontroller - Page 1
Forum section: electronics / general

author: jolshefsky
author_rank: Regular Contributor
timestamp: December 01, 2013, 11:35:39 pm
content: Dave,In EEVBlog #262, you explored the simplest soft-latching power circuit. I wonder if you can offer one that has the following features:Zero power when off.One switch for on/microcontroller input.Microcontroller provides off signal.Jellybean parts only.Minimal parts.Here's a somewhat bodgy but functional circuit that is an LED blinker that runs from a single 9V battery. (The longer story is that I have a lot of LED's and transistors lying around from scrapping electronics, but neither part is as useful in practice because I usually want some specific color/brightness LED and definitely some specific transistor properties.)The power transistor is Q1 which switches the circuit ground to the battery. When the switch is depressed, the base of Q1 is raised above ground and the circuit switches on. The microcontroller then pulls the base of Q2 toward ground, causing Q2 to turn on, providing current to the base of Q1. When the switch is released, pin 4 on the microcontroller is about 9V/2 = 4.5V = logic high, and when the switch is pressed, the current is shorted through the base-emitter junction of Q1, so pin 4 drops to about 0.6V = logic low. (By the way, check out the cool common-base amplifier for the LEDs, since the PIC microcontroller pins are current-limited to source or sink ~25mA.)

author: jolshefsky
author_rank: Regular Contributor
timestamp: December 01, 2013, 11:41:25 pm
content: Related, how the heck do infra-red remote controls work? With that, it seems any button powers the control chip and indicates which button is pressed — are they a special chip design (which seems unlikely that every remote control would have a custom chip)? Some micro-power solution (which seems unlikely because batteries seem to last as long as their shelf-life indicates)?

author: free_electron
author_rank: Super Contributor
timestamp: December 02, 2013, 01:10:54 am
content: your circuit leaks...here is mineThere is no leakage in this one.The battery keeps the pmos IRLML6401 turned off through the 33K resistor.Press the button and the gate of the IRLML is pulled low through the top half of the BAT54, turning on that PMOS.The cpu now powers up and the first thing it does is turn on the 2n7002 by putting a logic 1 on <power>.the cpu can check the signal <switch> . the internal pull-up in the cpu keeps <switch> logic high. press the button and <switch> goes low through the bottom half of the BAT54C.if the cpu does not have internal pull ups then connect a 33K resistor from <switch> to <cpu power>you can replace the bat54c with two individual diodes. if you use shottky diodes this stuff works as low as 2.5 volts vbat.the irlml can switch 1 amp of current with ease.all this stuff is available in SOT23. so you are looking at 3 SOT23 packages and a resistor...

author: Psi
author_rank: Super Contributor
timestamp: December 02, 2013, 02:37:35 am
content: There will always be some leakage if you use a semiconductor, even if it's femto amps it's not zeroIf you want "Zero power when off" you have to physically disconnect it from the power source.One way is a relay setup to latch itself on when you press a button.You get zero current when off at the cost of higher current when on (which makes it useless in some situations).But you didn't specify low on current as a requirementQuick PsiCAD,Might also want a capacitor or pulldown in there to ensure the transistor stays off long enough to break the power. in case the relay contacts not break at the same time.

author: jolshefsky
author_rank: Regular Contributor
timestamp: December 02, 2013, 10:39:25 am
content: Quote from: free_electron on December 02, 2013, 01:10:54 amHow? In practice it draws zero current from the battery when off. Do you mean the BJTs have some leakage current when off?Quote from: Psi on December 02, 2013, 02:37:35 amI'm using Dave's list from EEVBlog #262 where he uses the phrase "zero power when off". I get that there is some leakage, but I'm talking about zero power from a battery. I didn't specify, but let's use an ideal case of a lithium primary coin cell with a 25-year shelf-life. Its internal leakage, therefore can be estimated to be the capacity/25 years. A 2032 battery has around a 200 mAH capacity, so over 25 years, that's 900nA, and that's many orders-of-magnitude over a few femtoamps, so negligible, and effectively zero. I'm calling it zero.Quote from: free_electron on December 02, 2013, 01:10:54 amThat is indeed a nice circuit, although I question the "uses jellybean parts" requirement (BJTs are common in my world; SMD MOSFETs less so). I will definitely keep that one in mind ...Quote from: Psi on December 02, 2013, 02:37:35 amWith your circuit, you can't use the button as a microcontroller input ...

author: free_electron
author_rank: Super Contributor
timestamp: December 02, 2013, 08:15:04 pm
content: Quote from: jolshefsky on December 02, 2013, 10:39:25 amlow power and BJT don't mix... you can stick in a PNP and NPN vut keep in mind there is always a base current when those are being driven... so your consumption goes up. plus you need 2 more resistors... there goes you r bill of material cost.your circuit leaks through the resistive divider, through the cpu . even if the cpu is not powered you will have a leakeage current there.if my PMOs is off then there is no leakage. the pmos doesnt consume anything.

author: BillyD
author_rank: Regular Contributor
timestamp: December 03, 2013, 07:52:11 am
content: Quote from: jolshefsky on December 01, 2013, 11:41:25 pmI've wondered the same thing. i.e. is the chip (a) running in a low power mode and able to detect button presses to wake it up or (b) powered down completely and somehow powered up when any one of dozens of buttons is pressed?

author: Psi
author_rank: Super Contributor
timestamp: December 03, 2013, 10:04:23 am
content: Quote from: jolshefsky on December 02, 2013, 10:39:25 amoh right, forgot that you wanted that.You could if the pushbutton had two sets of contacts.

author: jolshefsky
author_rank: Regular Contributor
timestamp: January 26, 2015, 07:36:58 pm
content: Just to put a final note on this, I used the µCurrent Gold to measure the actual leakage current on the 1mV/nA scale. It floated around between 0.5mV and 3.5mV with the my Fluke 87V reporting an average of 2.0mV, so I would expect the leakage current to be around 2nA. Given a fresh 550mAH battery, it would take 275,000,000 hours to deplete the battery at that rate—31,370 years. (Assuming a 10 year shelf-life, 550mAH would run 10 years with an average draw of 6µA, so I'm pretty confident the circuit has an equivalent of zero draw in this application.) I have a nice scope on order so I'll see what that fluctuation looks like and if there's some strong periodic pulse driving the fluctuating reading, or if it's just noise.