I think I have a challenge for you smart souls on here, who donate your time by answering all of my terrible questions.
I have to design a switch that completely shuts off a system when it is engaged, then turns the system on only after five seconds have elapsed from when the switch is closed.
- switch is open, system is completely off
- switch is closed
- five seconds pass
- system is on
By open I mean the switch is touching the top terminal in the junction labeled U3 in the schematic. By closed I mean its touching the bottom terminal.
If the switch is re-opened at any time during the 5 seconds in 3., the system goes back to 1. and the switch must be closed for another five seconds.
Even more complicated, once the five seconds have passed and the system is on, I'd really like it if this whole switch-circuit apparatus didn't change the system state any more, unless I unplug the power source. That is, after the system turns on, it's always on, and toggling the switch can't turn it off.
I've made a test circuit using a p-channel mosfet and a tiny45. The idea is that, when the switch is open, the mosfet's gate is pulled high by the voltage source (a 3.7V LiPo) supplying the power to the system. When the switch is closed, the attiny45 is turned on, and the MISO pin pulls the FET's gate high for another 5 seconds, then low, allowing charge to flow through the FET.
Only problem is, when I close the switch, the system turns on momentarily, I assume because the 45 hasn't started up yet. I can't have the 45 be on, since it will draw power from the battery and perhaps drain it before it gets a chance to power the system. Is there a way to smooth that transition so that the MOSFET gate continues to be high for the few microseconds required for the 45 to turn on?