Author Topic: Single-button power and input with microcontroller  (Read 8212 times)

0 Members and 1 Guest are viewing this topic.

Offline jolshefsky

  • Regular Contributor
  • *
  • Posts: 225
  • Country: us
    • Jason DoesItAll
Single-button power and input with microcontroller
« on: December 01, 2013, 11:35:39 pm »
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.)
May your deeds return to you tenfold.
 

Offline jolshefsky

  • Regular Contributor
  • *
  • Posts: 225
  • Country: us
    • Jason DoesItAll
Re: Single-button power and input with microcontroller
« Reply #1 on: December 01, 2013, 11:41:25 pm »
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)?
May your deeds return to you tenfold.
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 7441
  • Country: us
    • SiliconValleyGarage
Re: Single-button power and input with microcontroller
« Reply #2 on: December 02, 2013, 01:10:54 am »
your circuit leaks...

here is mine

There 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...
« Last Edit: December 02, 2013, 01:16:34 am by free_electron »
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 7610
  • Country: nz
Re: Single-button power and input with microcontroller
« Reply #3 on: December 02, 2013, 02:37:35 am »
There will always be some leakage if you use a semiconductor, even if it's femto amps it's not zero :P

If 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 requirement :P

Quick 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.


« Last Edit: December 02, 2013, 02:53:50 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline jolshefsky

  • Regular Contributor
  • *
  • Posts: 225
  • Country: us
    • Jason DoesItAll
Re: Single-button power and input with microcontroller
« Reply #4 on: December 02, 2013, 10:39:25 am »
your circuit leaks...

How? In practice it draws zero current from the battery when off. Do you mean the BJTs have some leakage current when off?

There will always be some leakage if you use a semiconductor, even if it's femto amps it's not zero

I'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.

here is mine

That 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 ...

One way is a relay setup to latch itself on when you press a button.

With your circuit, you can't use the button as a microcontroller input ...
May your deeds return to you tenfold.
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 7441
  • Country: us
    • SiliconValleyGarage
Re: Single-button power and input with microcontroller
« Reply #5 on: December 02, 2013, 08:15:04 pm »

That 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 ...

low 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.
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline BillyD

  • Regular Contributor
  • *
  • Posts: 210
  • Country: ie
Re: Single-button power and input with microcontroller
« Reply #6 on: December 03, 2013, 07:52:11 am »
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)?

I'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?
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 7610
  • Country: nz
Re: Single-button power and input with microcontroller
« Reply #7 on: December 03, 2013, 10:04:23 am »
With your circuit, you can't use the button as a microcontroller input ...

oh right, forgot that you wanted that.
You could if the pushbutton had two sets of contacts.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline jolshefsky

  • Regular Contributor
  • *
  • Posts: 225
  • Country: us
    • Jason DoesItAll
Re: Single-button power and input with microcontroller
« Reply #8 on: January 26, 2015, 07:36:58 pm »
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.
May your deeds return to you tenfold.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf