smart power button -- short press powers up, long-press removes power - Page 1
Forum section: electronics / beginners

author: exe
author_rank: Unknown
timestamp: November 29, 2024, 03:59:22 pm
content: Hi!On laptops and many portable devices short press of a power button either powers devices on, or puts it into sleep mode.A long press removes power or resets the device.How is this implemented? I'm looking for a cheap integrated solution, something ideally something I can buy from lcsc).I made a simple circuit that has a ~3s delay, but I'd like not to re-invent the wheel if there is a ready solution. I foundhttps://www.st.com/en/reset-and-supervisor-ics/src0.html, but I'd like something cheaper, preferably like 10 cents/piece (or less).

author: wraper
author_rank: Unknown
timestamp: November 29, 2024, 04:01:12 pm
content: QuoteIn firmware.

author: exe
author_rank: Unknown
timestamp: November 29, 2024, 04:10:13 pm
content: Yeah, but I'd like a hardware solution in case of firmware glitch. How would I power down a device with soft button in case of software issues?

author: ataradov
author_rank: Super Contributor
timestamp: November 29, 2024, 05:57:45 pm
content: It is assumed that you can write a simple MCU firmware that is not buggy to that extent. I doubt there is a readily available IC to do that. Your best bet is to take some 6-pin ATTiny and make a trivial firmware that does this.

author: soldar
author_rank: Super Contributor
timestamp: November 29, 2024, 06:10:15 pm
content: Quote from: exe on November 29, 2024, 04:10:13 pmhttp://www.mosaic-industries.com/embedded-systems/microcontroller-projects/electronic-circuits/push-button-switch-turn-on/latching-toggle-power-switchPress ON - Hold OFF latching circuitsFor controlling smart products containing microcontrollers you often want to ensure that the power is not inadvertently removed. Consequently, you want a power switch that can be turned ON by a brief button press, but requires a longer, deliberate button hold to turn it OFF. That prevents accidentally killing power if the tactile switch is unintentionally touched.The following shows a NAND gate latch implementing the desired action:

author: ataradov
author_rank: Super Contributor
timestamp: November 29, 2024, 06:26:08 pm
content: So, you still have an IC and a bunch of passives. A simple MCU would be sufficient by itself and it can implement much more robust logic and timings instead of relying on RC time constants. It would need programming, but in large quantities preprogrammed MCUs are an option.

author: exe
author_rank: Unknown
timestamp: November 29, 2024, 09:38:49 pm
content: I agree, an MCU is a good option. I just don't want to bother with programming it, too much of a learning curve.I found one potentially interesting options: XC6190 and RT9829. But a bit pricey, the first one is like $0.5, the second one is $0.25, but no adjustment of timeout.I think such ICs are called timers and reset timers. There should be a cheaper option. There are 3 cents timers...

author: Bud
author_rank: Super Contributor
timestamp: November 29, 2024, 09:57:23 pm
content: This thread is just one step away from "Just use an FPGA"

author: ataradov
author_rank: Super Contributor
timestamp: November 29, 2024, 10:19:14 pm
content: This is not far from what GreenPAK devices are for. They are closer to FPGAs than MCUs.. They may be even simpler and cheaper than a generic MCU.

author: WillTurner
author_rank: Regular Contributor
timestamp: November 29, 2024, 10:28:00 pm
content: Completely analogue ... use two cross-coupled BJT's in a flip flop configuration, with another BJT and RC delay on each switching input. Yes, it costs 4 transistors, but is tolerant to switching the input rail (as long as it's below about 40V) and not just logic levels. If you really want to be modern, use Mosfets.Yes, you can accurately do the timing in a CPU, but you need the logic rails up first, something of a chicken and egg problem.BTW, I personally rediscovered this idea reading vintage homebrew computer schematics like EDUC-8. The sexy switch is a momentary on -- off -- momentary on toggle which will now set you back twenty bucks.

author: exe
author_rank: Unknown
timestamp: November 29, 2024, 11:56:48 pm
content: For now I settled on the schematic I posted. I just don't want to bother with those special ICs because they are not very common.I decided not to do schmitt-triggering for now, let's see how it will work. I hope that's okay for AP2112K LDO and TPS2553 power switch.

author: PGPG
author_rank: Frequent Contributor
timestamp: November 30, 2024, 12:48:05 am
content: If we are speaking about supply in the range of 5V I'm sure such circuit can be easy build with 74HC14 + some passives. From two negators you can do latch and make it be set in specific position with your button (but through some resistor to let later be possible to set it reverse by the other source). Then signal from button through RC delay and after some time will switch third HC14 negator that would set latch to the opposite state (may be via diode driving input that it driven from button by resistor. If HC14 is too big than you can use HC2G14. If I made not mistake 3 Schmitt negators are enough.

author: BeBuLamar
author_rank: Super Contributor
timestamp: November 30, 2024, 01:52:45 am
content: Quote from: exe on November 29, 2024, 04:10:13 pmPull the plug?? Make you device reliable so pulling the plug is something almost never needed.

author: exe
author_rank: Unknown
timestamp: December 03, 2024, 02:45:31 pm
content: Quote from: BeBuLamar on November 30, 2024, 01:52:45 amThe device will have a lipo battery inside. To pull the plug one would need to unscrew the enclosure first).