0
\$\begingroup\$

How would I make a switch that is controlled electronically, and has a ten second delay?

I have a circuit that will output either 3.3V or 0V. I would like to make a circuit that detects 3.3V, waits ten seconds, then closes a switch. The switch should remain closed even if the 3.3V drops back to 0V, possibly requiring manual reset.

Is this easily achievable?

\$\endgroup\$
7
  • \$\begingroup\$ How accurate does the 10s need to be and what is the load? \$\endgroup\$
    – uint128_t
    Commented Mar 16, 2016 at 17:18
  • \$\begingroup\$ The 10 second figure is really just a guideline - a few seconds either way wouldn't matter. The goal is simply for the switch to connect the EN and Ground pins on the adafruit powerboost 500 (learn.adafruit.com/downloads/pdf/adafruit-powerboost.pdf). \$\endgroup\$
    – Reckless
    Commented Mar 16, 2016 at 17:30
  • \$\begingroup\$ If the circuit detects 3.3V but the 3.3V drops out before the 10 seconds is up, do you still want the switch to close? In other words, does the 3.3V have to stay ON continuously for at least 10 seconds for the switch to latch closed? \$\endgroup\$
    – EM Fields
    Commented Mar 16, 2016 at 17:35
  • \$\begingroup\$ I would like the switch to close 10 seconds after the 3.3V is first detected - regardless of whether or not it subsequently drops back to 0V. \$\endgroup\$
    – Reckless
    Commented Mar 16, 2016 at 17:43
  • \$\begingroup\$ Just to remove any confusion; if the 3.3 volt input to the timer only lasts for, say, one millisecond, you'd want the switch to close about 10 seconds after the positive-going edge of the input pulse ? \$\endgroup\$
    – EM Fields
    Commented Mar 16, 2016 at 17:56

3 Answers 3

1
\$\begingroup\$

As is usually the case with a timer task like this, this would be an easy job for a small (6 or 8-pin) microcontroller such as a PIC10. But if you're not familiar using a microcontroller, that's a fairly steep learning curve.

So instead this circuit should do what you want.

enter image description here

Initially, both flip-flops are reset, and the \$\small \overline{\text{Q}}\$ output of the second flip-flop is high, so the 74HC03 pulls the EN line to ground (the 74HC03 is open collector, since the EN lead is pulled high by the Powerboost 500 module).

When the input goes high, the 74HC221 triggers. (The 74HC221 is a non-retriggerable version of the 74HC123.) \$\small \overline{\text{Q}}\$ of the '221 goes low, setting the first 74HC74 flip-flop. When the timer expires, the combination of the '221's \$\small \overline{\text{Q}}\$ high and the Q output of the first flip-flop high sets the second flip-flop, enabling the EN lead through its pullup on the Powerboost 500 board.

Pushing the reset button resets both flip-flops, allowing the sequence to repeat.

Because the circuit uses a 74HC221 instead of the retriggerable 74HC123, even if the input drops to 0 and then goes high again during the 10 second timeout, the timeout will not be extended. If that is not the behavior you want, substitute the 74HC123 -- it has the same pinout. Also, if the input stays high longer than 10 seconds, that won't affect the timeout either.

The circuit runs on 3.3V, assuming you use 74HC logic (not LS or HCT).

\$\endgroup\$
0
\$\begingroup\$

This single-chip solution should work for you.

U1 is an LM339, a quad differential voltage comparator with U1A and U1B configured as an R-S latch. When TRIG goes high, U1A's output goes open-collector, which will drive U1B- high and force U1B's outout low. That causes U1A- to go low, which will maintain U1a's output high, latching U1A and B even if TRIG goes low.

When U1A's output goes open-collector, C1 will start charging through R8, R10 and R11, and when C1 charges to the reference voltage set by R12 and R13, The outputs of U1C and U1D will go open-collector, pulling M1's gate up to 3.3V, turning it on and allowing current through the load until the RESET switch is made.

When that happens, C1 will be discharged quickly through R9, D1, R11 and the RESET switch, forcing the voltage on U1C+ and U1D+ to fall below the reference set by R12 and R13, which will cause U1C and U1D outputs to go low, pulling M1's gate low. M1's gate going low will turn M1 OFF, which will disconnect the load from the 3.3V supply.

Pressing the RESET switch will also pull U1B- low, which will reset the U1A-U1B latch until TRIG goes high, which will start the cycle anew.

enter image description here

Here's the LTspice circuit list:

Version 4
SHEET 1 1436 936
WIRE -32 -112 -240 -112
WIRE 96 -112 -32 -112
WIRE 192 -112 96 -112
WIRE 304 -112 192 -112
WIRE 400 -112 304 -112
WIRE 736 -112 400 -112
WIRE 816 -112 736 -112
WIRE 944 -112 816 -112
WIRE 1056 -112 944 -112
WIRE -32 -64 -32 -112
WIRE 96 -64 96 -112
WIRE 400 -64 400 -112
WIRE 736 -64 736 -112
WIRE 944 -64 944 -112
WIRE 1056 16 1056 -112
WIRE 192 32 192 -112
WIRE 816 32 816 -112
WIRE 96 48 96 16
WIRE 160 48 96 48
WIRE 736 48 736 16
WIRE 784 48 736 48
WIRE 400 64 400 16
WIRE 400 64 224 64
WIRE 944 64 944 16
WIRE 944 64 848 64
WIRE -32 80 -32 16
WIRE -32 80 -144 80
WIRE 160 80 -32 80
WIRE 400 80 400 64
WIRE 480 80 400 80
WIRE 624 80 544 80
WIRE 784 80 624 80
WIRE -144 112 -144 80
WIRE -32 112 -32 80
WIRE 192 112 192 96
WIRE 816 112 816 96
WIRE 304 160 304 -112
WIRE 304 160 224 160
WIRE 400 160 400 80
WIRE 480 160 400 160
WIRE 624 160 624 80
WIRE 624 160 560 160
WIRE 1056 176 1056 96
WIRE 304 192 304 160
WIRE 400 192 400 160
WIRE -32 224 -32 192
WIRE 816 224 816 208
WIRE 736 240 736 48
WIRE 784 240 736 240
WIRE 944 256 944 64
WIRE 944 256 848 256
WIRE 1008 256 944 256
WIRE 624 272 624 160
WIRE 784 272 624 272
WIRE 224 304 224 160
WIRE 400 320 400 272
WIRE 400 320 256 320
WIRE 96 336 96 48
WIRE 192 336 96 336
WIRE 304 352 304 272
WIRE 304 352 256 352
WIRE 736 352 736 240
WIRE 624 368 624 272
WIRE 96 400 96 336
WIRE 304 400 304 352
WIRE 400 400 400 320
WIRE 464 416 448 416
WIRE 496 416 464 416
WIRE -240 432 -240 -112
WIRE -224 432 -240 432
WIRE -144 432 -144 192
WIRE -128 432 -144 432
WIRE 496 464 496 416
WIRE 624 464 624 432
WIRE -240 480 -240 432
WIRE -144 480 -144 432
WIRE -240 592 -240 560
WIRE -144 592 -144 560
WIRE -144 592 -240 592
WIRE 96 592 96 480
WIRE 96 592 -144 592
WIRE 224 592 224 368
WIRE 224 592 96 592
WIRE 304 592 304 480
WIRE 304 592 224 592
WIRE 400 592 400 480
WIRE 400 592 304 592
WIRE 448 592 448 464
WIRE 448 592 400 592
WIRE 496 592 496 544
WIRE 496 592 448 592
WIRE 624 592 624 544
WIRE 624 592 496 592
WIRE 736 592 736 432
WIRE 736 592 624 592
WIRE 816 592 816 288
WIRE 816 592 736 592
WIRE 1056 592 1056 272
WIRE 1056 592 816 592
WIRE -240 688 -240 592
FLAG -240 688 0
FLAG -32 224 0
FLAG 192 112 0
FLAG -224 432 +3.3V
FLAG 816 112 0
FLAG 816 208 +3.3V
FLAG -128 432 TRIG
FLAG 464 416 RESET
SYMBOL voltage -144 464 R0
WINDOW 3 24 96 Invisible 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR Value PULSE(0 3.3 3 100n 100n 100u)
SYMATTR InstName V2
SYMBOL res 384 -80 R0
SYMATTR InstName R3
SYMATTR Value 10k
SYMBOL res 112 384 M0
SYMATTR InstName R5
SYMATTR Value 10k
SYMBOL voltage -240 464 R0
WINDOW 3 24 96 Invisible 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR Value PULSE(0 3.3 1 .1)
SYMATTR InstName V1
SYMBOL res 80 -80 R0
SYMATTR InstName R6
SYMATTR Value 10k
SYMBOL Comparators\\LT1017 224 336 M0
SYMATTR InstName U3
SYMBOL res -128 208 R180
WINDOW 0 36 76 Left 2
WINDOW 3 36 40 Left 2
SYMATTR InstName R2
SYMATTR Value 10k
SYMBOL res -16 96 M0
SYMATTR InstName R4
SYMATTR Value 10k
SYMBOL res -48 -80 R0
SYMATTR InstName R8
SYMATTR Value 10k
SYMBOL res 320 384 M0
SYMATTR InstName R1
SYMATTR Value 10k
SYMBOL res 288 176 R0
SYMATTR InstName R7
SYMATTR Value 10k
SYMBOL sw 400 496 R180
SYMATTR InstName S1
SYMBOL voltage 496 448 R0
WINDOW 3 24 96 Invisible 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR Value PULSE(0 3.3 50 100n 100n 100u)
SYMATTR InstName V3
SYMBOL Comparators\\LT1017 192 64 R0
SYMATTR InstName U2
SYMBOL Comparators\\LT1017 816 64 R0
SYMATTR InstName U1
SYMBOL res 576 144 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R9
SYMATTR Value 4.7meg
SYMBOL cap 608 368 R0
WINDOW 0 -25 6 Left 2
WINDOW 3 -29 61 Left 2
SYMATTR InstName C1
SYMATTR Value 4.7µ
SYMBOL res 752 336 M0
SYMATTR InstName R10
SYMATTR Value 470k
SYMBOL res 720 -80 R0
WINDOW 0 -62 43 Left 2
WINDOW 3 -91 77 Left 2
SYMATTR InstName R11
SYMATTR Value 1meg
SYMBOL res 928 -80 R0
SYMATTR InstName R12
SYMATTR Value 150
SYMBOL diode 544 64 R90
WINDOW 0 -33 30 VBottom 2
WINDOW 3 -35 32 VTop 2
SYMATTR InstName D1
SYMATTR Value 1N4148
SYMBOL res 608 448 R0
SYMATTR InstName R13
SYMATTR Value 10k
SYMBOL Comparators\\LT1017 816 256 R0
SYMATTR InstName U4
SYMBOL nmos 1008 176 R0
SYMATTR InstName M1
SYMATTR Value FDS6570A
SYMBOL res 1040 0 R0
SYMATTR InstName ARDUINO
SYMATTR Value 3.3
SYMBOL res 384 176 R0
SYMATTR InstName R14
SYMATTR Value 100
TEXT -216 632 Left 2 !.tran 60 uic
TEXT -216 664 Left 2 !.model SW SW(Ron=.01 Roff=1G Vt=1.6 Vh=0)
\$\endgroup\$
-1
\$\begingroup\$

I think the easiest way (besides using small microcontroller, like ATTiny85) is to use a 555 timer. Just google "555 timer" for tons of instructions available on the net. I have done exactly what you want before using a 555 timer and few external components (capacitors and resistors). It was quite simple and very cheap. You can even replace the resistors (forming a voltage divider) with a potentiometer, so you can easily adjust the delay. Just note that the 555 timer cannot source large currents, use a mosfet or a bjt transistor to switch the output if needed.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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