2
\$\begingroup\$

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.

That is,

  1. switch is open, system is completely off
  2. switch is closed
  3. five seconds pass
  4. 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.

schematic

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?

Thanks!

\$\endgroup\$
  • 1
    \$\begingroup\$ Simple job with a small microcontroller. \$\endgroup\$ – Majenko Jan 11 '15 at 22:30
  • 1
    \$\begingroup\$ Of course this is possible, but we are not a design-it-for-you service. So if you have any specific questions you are welcome to ask them, but as it is now your question is answered by a simple YES. \$\endgroup\$ – Wouter van Ooijen Jan 11 '15 at 22:32
  • \$\begingroup\$ This question appears to be off-topic because we don't spoon feed circuits or finished solutions. \$\endgroup\$ – Majenko Jan 11 '15 at 22:37
  • \$\begingroup\$ Does it have a name? This request was given to me by a safety review, as a standard functionality required for all payloads going through the process my main circuit is going through. You'd think with those kinds of requirements this would be a thing someone has designed already. If you don't know if it exists, you can just say so. \$\endgroup\$ – Mephistopheles Jan 11 '15 at 22:41
  • \$\begingroup\$ @Mephistopheles: 1. With D1 in there, as shown, when U3 is closed and U1-6 goes low, Q1's gate will be left floating, which is a Bad Thing. There may be enough charge pulled through D1's junction to turn ON Q1, but it should have a path with at least a known impedance back to DC to be stable. Are you stuck with the tiny45 or can you go for another [cheap] way to do it? \$\endgroup\$ – EM Fields Jan 12 '15 at 1:46
2
\$\begingroup\$

Unless the 5 seconds needs to be highly precise, this can be done in a totally discrete way. When you close the switch, have it start charging up a cap through an RC. The cap is connected to the negative terminal of a comparator. The positive terminal of the comparator is connected to a voltage divider. Choose RC so that after around 5 seconds, the cap voltage is high enough that the comparator output switches low, turning on two PFETs. One PFET bypasses the switch (so it can now be turned off and there is no effect), and the other energizes your load. One last thing. Make sure that the cap discharges quickly when switch is opened during the 5 second interval. Maybe you can make it a pushbutton switch. I might draw a circuit for you if I have time. But I agree with others that this is not a source for turnkey solutions. ;-)

Oh, if you set the voltage divider so that V = 0.63 * VBATT, then you can set the RC time constant to 5 seconds. Have fun with your design problem.

\$\endgroup\$
  • 1
    \$\begingroup\$ I appreciate the advice, as always. I was not looking for a schematic, and this is more than enough information for me to work off of. \$\endgroup\$ – Mephistopheles Jan 12 '15 at 17:30
1
\$\begingroup\$

Yes, this is very easily done with a small microcontroller. Even the cheap and tiny PIC 10F200 can do this.

However, your spec needs to be fixed up a bit. First, what is "engaged" supposed to mean for a switch. Proper terms would be closed or open, or even on or off.

Second, the 4 bullet points seem to make sense, but then you mention something about power going away and coming back being relevant. So point 1 only applies immediately after power first comes up? What if the switch is the other way when power comes up?

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.