by pebe » Thu Sep 12, 2013 4:27 pm
Here is a circuit that should do what you want.
Two NOR gates of a CD4001 IC are wired as a bistable flip-flop. Normally pins 2 and 6 are both low so the bistable ‘sits’ at the last commanded position. Taking pin 2 high will make pin3 low and 4 high. Similarly taking pin 6 high will do the reverse. If both pins are taken high, both outputs will be low. The final state of the outputs is determined by which of pins 2 and 6 is the last pin to go low.
The 4001 outputs are only good for driving up to about 5mA, so the LEDs need drivers. They can be switched with transistors, but I find a 555 (wired as a bistable) is a convenient way to switch one of two LEDs using only a small footprint on the board.
In operation, D1 rectifies the incoming signal tone and C2 holds up the voltage on A. Pin 3 immediately goes low. Because pin6 is low, the output pin4 goes high (and pin1 keeps the LH gate on). Pin 6 of the 555 goes high resetting it and turning on the red LED.
For a single ‘Set’ pulse, C2 will discharge at the end of the pulse and the red LED will stay lit.
The next pulse coming in will be a double ‘reset’ pulse. Initially, the action will be the same as before, but this time the pulses are long enough to charge up C3 via R3 and VR1. Pin6 will go high forcing pin 4 low. That sets the 555, its pin3 goes high, and the green LED lights up.
At the end of the double pulse, C2 and C3 will discharge, but as C2 is smaller, point A will fall to zero before point B. The 4001 will be left with pin3 high and 4 low, and the green LED will stay on.
R1 is there to prevent any spikes that may be on the alarm signal from damaging the gate. Ground the unused input pins 8, 9, 12 and 13 of the 4001, but leave the output pins 10 and 11 unconnected. Use a good quality low-leakage cap for C3 - preferably a bead-type tantalum.
To adjust VR1, first touch the input to 12V to turn on the red LED. Then connect the input to 12V and keep it there. The green LED should come after about 750ms (about halfway through the second reset pulse). Adjust VR1 until it does.
Happy building!
- Attachments
-
- nor gate alarm sensor.GIF (5.19 KiB) Viewed 10134 times