Simple circuit to give a ON pulse and OFF pulse

Thread Starter

vikrambharath

Joined Aug 13, 2018
17
I need a simple circuit which will give a 100ms 5v pulse when an SPST switch is turned ON (i.e constant input) and a same 100ms 5v pulse when the SPST switch is turned OFF.Please help.ask.jpg
 

ericgibbs

Joined Jan 29, 2010
21,390
hi v,
Welcome to AAC.
Do you want to use discrete components or IC's.?
What is the required accuracy of the 100mSec pulse.?

E
 

Thread Starter

vikrambharath

Joined Aug 13, 2018
17
hi v,
Welcome to AAC.
Do you want to use discrete components or IC's.?
What is the required accuracy of the 100mSec pulse.?

E
A combination of discrete components is preferred but if the IC solution gives a smaller footprint, then I will use IC.
Accuracy is not an issue as long as it is not less than 100ms.
But the input is fed from an SPST switch and cannot be changed.ask.jpg
 

Thread Starter

vikrambharath

Joined Aug 13, 2018
17
I have tried using xor gate with the complimentary RC values but the generated output is give a pulse when the SPST is turned ON and no pulse when it is OFF.Also when I turn ON and OFF the switch immediately the capacitor is taking time to discharge and not giving immediate output.
 

AnalogKid

Joined Aug 1, 2013
12,043
80 to 200 mA is a lot of current for an input pulse. Is the output of this circuit actually providing power to the NodeMCU?

Also, What is the allowable tolerance on the 5 V pulse amplitude? A 555 can supply the current, but at only around 3.5 V out or less.

Please post a schematic of your XOR circuit. It should be able to do this (with an external output transistor).

ak
 

Thread Starter

vikrambharath

Joined Aug 13, 2018
17
Thank you guys for all the replies.
The actual problem is I am building a home automation project which will have google assistant and Alexa integrated into it.
However, it should also work with the existing SPST switches of a home.
For this project, I am using NodeMCU and using PINS 1 2 7 8 as inputs from the switches.
The switches are fed 5v and from those, the voltage is step down to 3.3v and fed to the pins as mentioned above.
The pins 1 2 7 are working perfectly but the pin 8 is changing the mode due to constant input from the switch.
For this, I need to generate pulse instead of continuous input.
aaaaa.jpg asas.jpg
 

AnalogKid

Joined Aug 1, 2013
12,043
Can you post a link to the NodeMCU datasheet? The high output current for the pulse complicates things.

The reason the XOR circuit does not work is that when you turn on the switch, the input is pulled firmly up to 5 V, but when you turn off the switch, the input to the circuit is floating and the capacitor holds the input high so no pulse is generated. Ad another XOR gate in front of the IN node to act as a non-inverting buffer. At the inputs of the new gate, ground one and put a 10 K resistor and 1.0 uF capacitor in parallel from the other input to GND. This will debounce the switch without adding too much delay between turning off the switch and the second output pulse leading edge.

ak
 

Thread Starter

vikrambharath

Joined Aug 13, 2018
17
Can you post a link to the NodeMCU datasheet? The high output current for the pulse complicates things.

The reason the XOR circuit does not work is that when you turn on the switch, the input is pulled firmly up to 5 V, but when you turn off the switch, the input to the circuit is floating and the capacitor holds the input high so no pulse is generated. Ad another XOR gate in front of the IN node to act as a non-inverting buffer. At the inputs of the new gate, ground one and put a 10 K resistor and 1.0 uF capacitor in parallel from the other input to GND. This will debounce the switch without adding too much delay between turning off the switch and the second output pulse leading edge.

ak
Thank you AK

Can you please provide a diagram of what you explained.
I am a little weak in English.NodeMCU Pin out.jpg
 

crutschow

Joined Mar 14, 2008
38,316
At the inputs of the new gate, ground one and put a 10 K resistor and 1.0 uF capacitor in parallel from the other input to GND. This will debounce the switch
A 1μF cap to ground would generate a large current spike through the switch as its bouncing, which would tend to cause arcing and weld the contacts.
To prevent that add a small resistor (say 50-100Ω) in series with the switch.
 

Thread Starter

vikrambharath

Joined Aug 13, 2018
17
A 1μF cap to ground would generate a large current spike through the switch as its bouncing, which would tend to cause arcing and weld the contacts.
To prevent that add a small resistor (say 50-100Ω) in series with the switch.
Thank you, AK

I will build the circuit and post the result.
Thank you all for providing me with all the suggestions.
 

Alec_t

Joined Sep 17, 2013
15,103
Although the post #16 circuit gives the appropriate timing, the CD4070 cannot source '80 - 200mA', so a suitable buffer stage (BJT or logic-level MOSFET) would be required on its output.
 

AnalogKid

Joined Aug 1, 2013
12,043
Yeah, that still is a problem. I don't see any way to justify the pinouts in posts #11 and #13, so there still is more information needed. If the switches are driving GPIO pins, then1 mA should be enough.

ak
 
Top