single switch on off and mode select

Hello,

I'm trying to come up with a way to only have one button, and use that to power my circuit on and off, and also to flip through different modes of operation.

For example, my circuit is suppose to blink an LED in different patterns,

click it once, turns on LED is on click it again LED is blinking slow click it again LED is blinking fast click it again LED is blinking slow (any additional clicking just keeps cycling through these two states) hold button down for 3 seconds and circuit turns off

I've come up with the circuit below (based it on something I saw on the EEVBlog, video blog)

I haven't breadboarded it yet, I'm not sure if it'll work... does anyone have any better suggestions on how to do this?

the link below shows what I came up with

thanks!

formatting link

Reply to
panfilero
Loading thread data ...

You need to think really hard about currents flowing when you don't want them to -- specifically, you want to avoid a parasitic path that'll power up your microprocessor or some chip through an input pin, via the protection diode.

reg'later Vbat PNP .---. VCC o---------------------- --------| |-------o-------o v / '---' | --- | | | === |< .----o----. GND .--| PNP | | | |\ | | | | .-. .-. .-. | | | | | | | | | | | | | | .-. '-' '-' '-' | | | | | | | | | | '-' | o-----|

Reply to
Tim Wescott

power my circuit on and off, and also to flip through different modes of operation.

cycling through these two states)

EEVBlog, video blog)

any better suggestions on how to do this?

something like this with an LDO with enable input (not tested!)

LP2981 Vbat .-----. VCC o----------+-------------| |---------------o | | | | .---+EN | o | | '--+--' |- | | o | | === | | GND | | +--|>|----+----| switch input | | | | .-. .-. | | | | | | | | '-' '-' | | === === GND GND

switch turns on regulator, mcu set HOLD to keep it on switch input can see the switch state

maybe add a small cap on enable so the MCU has a bit of time to set the HOLD pin

want to turn off, clear HOLD and wait for ever

-Lasse

Reply to
langwadt

hey thanks alot, thats a neat little circuit, but isn't your switch_open always tied low? seems like the micro would always see a low there regardelss of what you do with the switch

thanks!

Reply to
panfilero

hey thanks alot, thats a neat little circuit, but isn't your switch_open always tied low? seems like the micro would always see a low there regardelss of what you do with the switch. Should there be a resistor between the switch_open and ground?

thanks!

Reply to
panfilero

formatting link

Reply to
David Eather

Yes, it is. It should be connected to the top of that resistor, not the bottom.

--
My liberal friends think I'm a conservative kook. 
My conservative friends think I'm a liberal kook. 
Why am I not happy that they have found common ground? 

Tim Wescott, Communications, Control, Circuits & Software 
http://www.wescottdesign.com
Reply to
Tim Wescott

formatting link

I see a microcontroller in there. Does it have a sleep mode with suitable low current draw and a wake on interrupt for an input?

--
Paul Hovnanian     mailto:Paul@Hovnanian.com 
------------------------------------------------------------------ 
Life would be so much easier if we could just look at the source code.
Reply to
Paul Hovnanian P.E.

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.