• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Delayed action momentary switch

Status
Not open for further replies.

macke

New Member
Hi imagine a double pole momentary switch where one pole closes before the other. This is what I need a circuit to achieve. Press the switch that feeds 5v to an input via pole 1 and then feeds 5v to another input via pole 2 with a very slight delay. The switch would be pressed and released immediately as a pulse e.g. momentarily. How can I achieve this?
Macke
 

Reloadron

Well-Known Member
Most Helpful Member
feeds 5v to another input via pole 2 with a very slight delay
What is a very slight delay? Are we looking at milli-seconds, seconds or what? Commonly called a "delay on make" or just "delay on" circuit there are several designs which could be used or for a commercial application modules which can be used ready off the shelf.

Ron
 

AnalogKid

Well-Known Member
Most Helpful Member
Do you need the galvanic isolation of two physical poles, or are you talking about pressing a SPST switch and having a circuit put out an immediate edge followed by a delayed edge? If the latter, is it ok that both signals stay on as long as the switch is pressed, and then both go off simultaneously? And (piling on), what is the delay between the two output signals?

Also, are the outputs just signals, or are they 5 V power for something(s)?

ak
 

schmitt trigger

Well-Known Member
What is the load current?
Does it have to be an actual contact, or can it be a solid state device?
Is the load inductive or capacitive?
What is required to happen if the button is pushed for a shorter time than the delay?
Moreover, when the switch is released, do both poles release simultaneously?

Depending on your answers to these and the previous questions, the solution may be trivial or very complex.
 

macke

New Member
The button press feeds a single 5v pulse to a PIC. It would be pressed and released so the time delay between each switch operating would be less than a second I guess, but is important that there is a delay.
 

dr pepper

Well-Known Member
Most Helpful Member
Welcome macke.
Could you implement the delay within the pic code?
A little more info might give us some more ideas.
 

AnalogKid

Well-Known Member
Most Helpful Member
The button press feeds a single 5v pulse to a PIC.
That's confusing. Where does the second, delayed pulse go? To another pin on the same PIC, another, separate PIC, somewhere else?
Also, does the delayed output have to meed a maximum risetime spec? One way to delay an edge is with a simple R-C network, but the output risetime can be quite slow depending on the amount of the time delay.

What is your perf-board skill set? This can be done with two small transistors and a few Rs and a C, or with a two CMOS inverters, or with an LM393 dual comparator, or with a 555, or or or...

ak
 

macke

New Member
The 5v pulses go to two separate pins on the same PIC. One tells the PIC to save the current reading to an EPROM, the other tells the PIC to add a count of 1 to a counter. They cannot be operated simultaneously, because with no delay in there it doesn't save, just increments. Even with the very tiniest delay it works fine. I have tried altering the code, but I am a complete novice when it comes to ASM, so this approach failed. What I will probably do is find a mechanical method of pressing and releasing 2 SPDT momentary switches with one button, but with one closing just before the other.
 

Tony Stewart

Well-Known Member
Most Helpful Member
Since a switch is low resistance and Pic pullup R is relatively high. The only thing to be gained is switch debounce and hysteresis with a simple RC delay on the count. This assumes you input is edge sensitive. Does it disable inputs after detection during execution??
 

dr pepper

Well-Known Member
Most Helpful Member
If you are good enough at programming you could use interrupts, you can either abandon the main code, run the interrupt or disable interrupts and poll the interrupt flag to see if a pulse has occured, as the interrupt flag once set remaisn set till software clears it.
Another better way would be to use one of the pics timers, depending which pic it is you can configure a timer to be clocked by a hardware pin.
 

Wade_Hassler

New Member
If the counter-increment is always associated with the value-saving, why can they not be done in the the same program code section?
 

macke

New Member
Hi all, seems it's a little more than first thought. The code, I am told, waits for a button press then waits for a button release before accepting the next button press and release. So it would be on - off for save then on - off for increment.

The code is attached.
 

Attachments

dr pepper

Well-Known Member
Most Helpful Member
Makes me glad I took up C, thats a lot of code.
What you say makes sense, the code arounf the label' checks1' appears to be where the buttons are checked.
An earth resistivity meter sounds interesting.
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top