Push Button On/Push Button Off/Idle Time Off - Page 1
Forum section: electronics / beginners

author: DaveButNotThatDave
author_rank: Newbie
timestamp: May 12, 2023, 05:53:51 am
content: Sorry if this question comes up a lot, but I am new to EEVblog and didn't really find the right solution when using the search capabilities.My background is as a Software Engineer, and only just getting started in electronics. For my first project, I want it to run on battery power, include an MCU (probably some ESP32 variety), have a soft latching switch for power on and power off, but also have the capability for the ESP32 to timeout and power off.I have watched Dave's video, EEVblog #262 - World's Simplest Soft Latching Power Switch Circuit, several times and understand it to the best of my ability at the moment.This circuit gets me 66% there. How can it be modified to also allow the MCU to power off? Note that I have seen videos from other channels that have a soft on, and timeout off, but I really would like a power off on button press option.My instinct is to add another NPN BJT with an output pin from the MCU connected to the base via resistor, emitter connected to ground, and collector connected to the collector of the right most BJT in his schematic.Another newbie question, what software is best for a beginner to use to draw schematics? Preferably offline and for Ubuntu. (Links to any relevant EEVblog posts are welcome).Thanks.Dave.

author: Ian.M
author_rank: Super Contributor
timestamp: May 12, 2023, 07:44:24 am
content: You've got a MCU in the loop. Provided it can boot up and set an I/O in the short amount of time the user presses the power button for, you don't *NEED* a hardware latch - the MCU provides that function. Also, if your firmware is sufficiently reliable, and the circuit permit the MCU to sense power button presses once ON, you also don't need a forced power off, as the MCU can shut off the power on command.See:https://www.eevblog.com/forum/beginners/push-button-power-circuit-for-arduino-trying-to-modify-it-for-12v-input/for some sample circuits and ideas. You'll need to substitute some components for 3.3V logic levels e.g. pick N MOSFETs with low enough threshold voltage.There's also a video comparing the circuits from that topic:

author: DaveButNotThatDave
author_rank: Newbie
timestamp: May 12, 2023, 09:46:04 am
content: Quote from: Ian.M on May 12, 2023, 07:44:24 amThanks! That video's first option exactly answered my question. I didn't even think of using the MCU to intercept the power off signal, but it makes sense since I would already have an output pin to signal a shut down on timeout. Thanks again!

author: NeverDie
author_rank: Regular Contributor
timestamp: May 14, 2023, 03:31:10 am
content: You could also cheat by having the MCU "push" the button for you using, say, an optocoupler like a jellybean PC817. In the arduino world they call it button hacking. The main virtue of this approach for absolute beginners is that you can operate a circuit almost the same as you would manually without having to understand anything about how the circuit works.Regarding soft-latch mechanics, you may also find this thread interesting:https://www.eevblog.com/forum/blog/simpler-than-the-worlds-simplest-softlatch-(re-eevblog-262)/