This circuit will help you to control two devices with the help of a switch. If you "on" the first device then second device remain "off", and if you "on" the second device the first device will become "off". Therefore you can control both the devices with the help of single switch.
The toggle switch circuit is built around CD4017 which is a CMOS decade counter/ Divider. Used in many applications like binary counter/decoder, frequency division, divide by N counting, Alarm system etc.
Fig. 1: Prototype Of Toggle Switch Circuit On Breadboard
CD4017 is a 16 pin IC which includes 3 input- Clock, Reset and Clock inhibit. And 10 output Q0- Q9. Pin 16 is for power supply and pin 8 is used for ground. Pin configuration of IC is show below-
Fig. 2: Pin Diagram Of CD4017 IC
In this circuit, counter advances by one count when positive clock signal is applied at pin 14. When you want to switch off the counter then make pin 13 high. If pin 13 is high, it will ignore the clock pulse no matter how many times you press the switch, thus counter will not advance. In our circuit we have grounded pin 13. In this reset pin 15 clears the counter to zero and counting again starts from zero.
In this circuit, we are using CD4017 in Toggle mode. When power supply is given to the circuit and switch is pressed once, CD4017 decade counter pin 14 provides a clock for the working of IC1. Here after receiving the clock input CD4017 starts its counter from zero and it advances one by one each time pin 14 goes high. When the counter reaches the ninth output, it goes back to zero and the counter starts again. As the count progresses, respective pin goes high to provide the output. Like, first pin 3 would provide the output as it represents zero (Q0).. Then second is pin 2 which represents one (Q1). Similarly, pin four represents two (Q2) and so on. CD4017 will count up to nine then it will restart again.
We have grounded the Clock inhibit pin so that IC can run freely. In this, Reset pin 15 is shorted with pin 4 (Q2) output and because of that IC1 will toggle between Q0 and Q1 outputs. When Clock input pin 14 receives positive pulse, first output Q0 will go high which will be indicated by LED2. At this time LED1 and relay will be in “off” position.
When pin 14receives another pulse through switch, the second output goes high and first will become low. At this time LED1 would glow and transistor will conduct, hence turning on the relay. When another pulse is applied then again LED2 glows. In this, counter does not advance because we have connected the Reset pin to Q2 output.