Saturday, May 22, 2021

0000 0000 0110 0010

CD4070 XOR light switch

Scene: A cold Tasmania evening. Having braved a day of arctic wind, frigid fog and horizontal rain you make a beeline for the bedroom and the warm quilt covers. Entering the room you flick the light on, climb into bed and ... dammit just as you thaw out you have to get up to turn off the light!

What we need is some electronic wizardry to turn off the light from near the bed (or turn it on for that matter). In fact, it would be nice to turn the light on or off from either near the door or near the bed.


You could fill a magic box for this project with a micro-controller, Raspberry Pi or similar and code the solution to this frosty dilemma, but also you just happen to have some CD4070 XOR gates in your boxes of bits. 

The wonderful thing about the XOR gate (and there are many), is that just like the XNOR gate we have seen before on the blog, the state of the output changes EVERY time an input changes. If the light is on, flicking either switch will change the state of the lightbulb. If it's on, it goes off. If it's off, it goes on. Perfect.


So putting all of this together on a breadboard yields a circuit capable of meeting the requirements of the scenario. If you need to build this In Real Life™ with an AC component then I urge you to use an electrician, not a bored and cold hobbyist, to wire up the actual circuit!


Not coming out




 

No comments:

Post a Comment