Author Topic: Push Button On/Push Button Off/Idle Time Off  (Read 656 times)

0 Members and 1 Guest are viewing this topic.

Offline DaveButNotThatDaveTopic starter

  • Newbie
  • Posts: 3
  • Country: us
Push Button On/Push Button Off/Idle Time Off
« on: May 12, 2023, 05:53:51 am »
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.
« Last Edit: May 12, 2023, 06:14:51 am by DaveButNotThatDave »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12908
Re: Push Button On/Push Button Off/Idle Time Off
« Reply #1 on: May 12, 2023, 07:44:24 am »
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:
« Last Edit: May 12, 2023, 07:45:56 am by Ian.M »
 

Offline DaveButNotThatDaveTopic starter

  • Newbie
  • Posts: 3
  • Country: us
Re: Push Button On/Push Button Off/Idle Time Off
« Reply #2 on: May 12, 2023, 09:46:04 am »
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:


Thanks! 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!
 

Offline NeverDie

  • Regular Contributor
  • *
  • Posts: 152
  • Country: us
Re: Push Button On/Push Button Off/Idle Time Off
« Reply #3 on: May 14, 2023, 03:31:10 am »
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)/
« Last Edit: May 14, 2023, 03:37:54 am by NeverDie »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf