Time delay circuit from momentary switch.

Thread Starter

macke

Joined Oct 12, 2014
65
Hi I am looking for a time delay circuit operated by a momentary switch. It needs to delay for about 2 seconds then latch on, but only momentarily.
It is only switching A low voltage and current.
Any ideas?
 

#12

Joined Nov 30, 2010
18,224
Delay what for 2 seconds? A low voltage. How much voltage? A low current. How much current? Is it DC or AC? What frequencies? How long is momentary?
 
Last edited:

Thread Starter

macke

Joined Oct 12, 2014
65
Hi the circuit currently is as follows. I have 2 momentary push switches. Switch 1 is connected between +5v and PIN 7 on a PIC16F876. Switch 2 is connected between +5v and PIN11 or PIN12 of the same PIC. The pin used depends on the position of toggle switch. I want to replace the 2 momentary push switches with one double pole momentary switch, but 1 pole to operate immediately and the other to operate 2 seconds or so later and with the same momentary action. The time delay does not need to be highly accurate.
Ken
 

AnalogKid

Joined Aug 1, 2013
11,055
"the same momentary action" ... so, if switch pole 1 (SP1) is closed for 1 second, then 2 seconds after it was first pushed you want switch pole 2 (SP2) to close for 1 second? In other words, does "the same momentary action" mean being closed for the same length of time, no matter how long or short that time was? If so, then you're looking at a time delay circuit, like a shift register. Not a big design problem, but not as simple as a 555.

I' on the other hand, SP2 can be closed for a fixed amount of time no matter how variable the SP1 closure time is, that is easier.

Next, does the 2 second time delay start when SP1 closes (is pushed) or when it opens (is released)?

As you can see, the hardest part of joining two switches into one is settling down on the exact sequence of events. If, for example, you say that when someone pushes a SPST pushbutton switch and either holds it down or releases it immediately, the circuit makes a short pulse immediately on one wire, waits 2 seconds, and then makes a short pulse on a different wire - all of that can be done with a single CMOS hex inverter.

ak
 

Thread Starter

macke

Joined Oct 12, 2014
65
"the same momentary action" ... so, if switch pole 1 (SP1) is closed for 1 second, then 2 seconds after it was first pushed you want switch pole 2 (SP2) to close for 1 second? In other words, does "the same momentary action" mean being closed for the same length of time, no matter how long or short that time was? If so, then you're looking at a time delay circuit, like a shift register. Not a big design problem, but not as simple as a 555.

I' on the other hand, SP2 can be closed for a fixed amount of time no matter how variable the SP1 closure time is, that is easier.

Next, does the 2 second time delay start when SP1 closes (is pushed) or when it opens (is released)?

As you can see, the hardest part of joining two switches into one is settling down on the exact sequence of events. If, for example, you say that when someone pushes a SPST pushbutton switch and either holds it down or releases it immediately, the circuit makes a short pulse immediately on one wire, waits 2 seconds, and then makes a short pulse on a different wire - all of that can be done with a single CMOS hex inverter.

ak
Hi the momentary switch is just that. It is pressed and released immediately.
 

AnalogKid

Joined Aug 1, 2013
11,055
First pass, based on limited information. The CD4093 is a quad 2-in NAND gate with hysteresis on all inputs. This prevents noise bursts when the input is changing very slowly through the transition, as happens with a 2-second voltage ramp.

R2-C2 set the delay between pulses; adjust R2 to fit. OUT2 pulse width is fixed at approx. 0.5 sec. OUT1 pulse width is the length of time the switch button is pressed plus 0.5 sec. The time delay for OUT2 starts when the switch is pressed, not when it is released. This means that if the switch is held down, OUT2 will occur while OUT1 still is active low. If you need positive pulses, either add more parts or change the uC firmware to function with negative pulses.

ak
Pulse-Delay-1-c.gif
 

Attachments

Alec_t

Joined Sep 17, 2013
14,330
Couldn't you use pin 7 and SP1 as is, use pin 11 or 12 to sense the setting of the toggle switch, then perform whatever action you wanted for SP2 by using a 2-second software delay?
 

AlbertHall

Joined Jun 4, 2014
12,347
Couldn't you use pin 7 and SP1 as is, use pin 11 or 12 to sense the setting of the toggle switch, then perform whatever action you wanted for SP2 by using a 2-second software delay?
Yes, if the switches are connected to a uC then no external circuitry is needed it can all be done in code.
 

AnalogKid

Joined Aug 1, 2013
11,055
If you can't change the code and really need positive-going pulses, hardware changes present two options.

First, if you change to NOR gates (and change some connections) the outputs become positive-going. The tradeoff is that there are no hysteretic NOR gates, and that 2-second ramp could be a problem.

Second, changing to a CMOS hysteretic hex inverter (CD40106) gets you clean transitions and positive-going outputs, but the circuit requires additional components (four diodes and two resistors). However, you now get a controlled pulse width for the first pulse.

ak
 

alyeomans

Joined Sep 13, 2010
39
I have previously used the 555 in a one shot setup (mono-stable). While this does not help with the initial turn on delay it does for the switch off and I suspect your solution will be multi part.
 

AlbertHall

Joined Jun 4, 2014
12,347
From: http://www.dummies.com/how-to/content/electronics-components-double-up-with-the-556-dual.html
For example, consider a cascaded timer circuit that uses two separate 555 timer chips. In this circuit, both of the 555 timer chips are configured in monostable mode. The time interval for the first 555 is controlled by R1 and C1. For the second 555, the interval is controlled by R2 and C2. You can choose whatever values you want for these components to achieve whatever time intervals suit your fancy.

The first 555 chip is triggered when SW1 is depressed, taking pin 2 to ground. This takes the output on pin 3 high, which lights LED1. Notice, however, that pin 3 of the first 555 is connected through a small capacitor to the trigger input of the second 555.

As soon as the time interval expires on the first 555, its output goes low, which turns off LED1 and at the same time triggers the second 555, which in turn lights up LED2. LED2 stays lit until C2 charges, and then it goes out. The circuit then waits to be triggered again by a press of the switch.

 

Thread Starter

macke

Joined Oct 12, 2014
65
If all you want to do is change a delay, please post the code. More than a few of us use or are able to use Assembly.

John
Hi the code is attached, and the relevant parts of the circuit. Basically it was designed to operate as follows. The on board LCD display shows a reading taken by the system and it also shows the co-ordinate for this reading. On pressing the save switch the reading and co-ordinates are recorded to an EPROM. The co-ordinate is a column and row number. Assuming I am on column 1 and row 1 for the first reading, I would then press the + switch to change the row no. to 2, move to that position and press the save switch. This would continue up to row 20. I would then change the column no. to 2 and take readings in that column. As I am starting at position 20 on that column I would press the - switch after each reading to count back down to 1. All odd columns would be counting up and all even columns counting back down. My plan is to insert a toggle switch across the + and - buttons so I can select odd or even. I would then fit a double pole momentary push button in place of the save switch and save the reading and increment/decrement the counter at the same time. I would want there to be a 2 or 3 second delay between the reading being saved and the co-ordinate no. changing. I would probably also add an LED or buzzer to indicate the reading being taken. I hope this makes sense and hopefully someone can make sense of the code. It was originally written in TASM, but was converted to MPASM and currently compiles ok.
Ken
 

Attachments

Thread Starter

macke

Joined Oct 12, 2014
65
If you can't change the code and really need positive-going pulses, hardware changes present two options.

First, if you change to NOR gates (and change some connections) the outputs become positive-going. The tradeoff is that there are no hysteretic NOR gates, and that 2-second ramp could be a problem.

Second, changing to a CMOS hysteretic hex inverter (CD40106) gets you clean transitions and positive-going outputs, but the circuit requires additional components (four diodes and two resistors). However, you now get a controlled pulse width for the first pulse.

ak
 
Top