Remote Control Light Switch
Intro: Remote Control Light Switch
Hi everyone!
I'm a mechanical engineering student at Utah State University in Logan Utah. It's awesome, except for one thing. I sleep on the top bunk of a bunk bed, and the light switch is by the door all the way across the room. If I'm lounging in my bed, the last thing I want to do is jump out of bed, walk across the room and back, and then climb back up on my bed just to turn the lights on or off. That's why I've spent the last couple weeks designing and building a machine that lets me switch the lights on and off with a remote control from anywhere in the room! (Wait, I'm wondering if I actually saved myself any effort with this...)
The remote control light switch mounts over your current light switch in place of the panel that usually covers it. It uses a servo motor controlled mechanism to turn the light switch on and off. A pair of radio transceivers, one in the mechanism and one in a remote, allows you to control the light. It also has a button on the front that switches it as well, if you happen to be nearby.
This is my first draft of this design and I'm mostly using parts I have on hand, so there is clearly lots of room for improvement or other neat features. In this Instructable, I'll go through the process I used to design this and make it. I'll provide the CAD files and code that I've got, but you are more then welcome to modify it or make your own.
Let's get started!
STEP 1: Model the Switch
The first step is to model the light switch you have in a CAD program. I chose to use Fusion 360. I measured and drew the switch and the panel behind it, and used joints to fit it together. I used a rotational joint to allow the switch to rotate up and down, like in real life. This is very handy for testing the fits of the other parts.
STEP 2: The Carriage
My design uses a sliding "carriage" to bump the light switch up and down. It slides on two 1/8in steel round bars and has a rectangular hole in the center that the switch goes through.
I added some small brass bushings that I made on a lathe so that it slides more smoothly. They have a 1/8in inner diameter, 3/16in outer diameter, and are 1/4in long and are press fit into holes in the carriage. It's probably a bit overkill, but I wanted to give it a try. They aren't critical, so you can probably get by without. You'll just need to modify the carriage design by shrinking the holes so that it can slide easily on the rods. Loose enough that it moves freely, but tight enough to keep it from wiggling or pivoting.
STEP 3: Rack and Pinion
Next, we need a way to move the carriage up and down. I chose a rack and pinion with a servo motor to drive it. I used a gear generator plugin in Fusion 360 to design the rack and then attached it onto the carriage. Then, I made a matching pinion gear with a flange that fits over the servo horn. I added these to the assembly and positioned them so that they meshed nicely.
STEP 4: Mounting and Enclosure
Next up is to make mounting geometry for the servo and the Arduino and a nice enclosure for everything to fit into. I positioned the Arduino and the servo where I wanted them, then used the edit in place tool to edit the panel design within the assembly. I projected all the mounting holes and features and extruded them to fit. For the lid that covers all the electronics, I decided to try to make some little dovetails on the plate that it can slide onto. With the right tolerances or a bit of filing, it fits together very nicely.
Now that its all designed, its time to print! Feel free to modify my designs to fit your switch or hardware. Make it even cooler if you can.
STEP 5: Wiring
For wireless control, I used a RF-24 radio transceiver. I had a few lying around and they're not to hard to use. Make sure to connect the power pin of the RF module to the 3.3 volt pin on the Arduino. If you connect it wrong, you might fry it!
The servo connects to the 5v, ground, and a digital pin of the Arduino.
The pushbutton connects to the ground and another digital pin. Often if you want to wire a simple button like this, you need to connect a resistor into the circuit, however, if we connect this one to ground and a digital pin and set the pin mode to INPUT_PULLUP, we can get by without. Handy!
Wire up the RF-24, the servo, and the button as described in the schematic above.
STEP 6: Assembly
Now that we've got all the pieces, its time to put it together. If you made bushings, press them into the holes in the carriage. Slide the rods through the holes in the panel and the carriage.
Make sure to align the rack and pinion in such a way that when the carriage is right in the middle of the sliders, the servo has rotated half of its travel, so it's able to move the carriage both upward and downward.
Securely bolt on the servo and the Arduino and attach the pushbutton to the lid. Make sure all the wires are in the right place and slide on the enclosure.
STEP 7: Programming
The programming for this is pretty simple. You'll need to download the RF-24 library to run it. Find the 'RF24 by TMRh20' library with the Arduino IDE library manager. You can also find more information at its GitHub page: https://github.com/nRF24/RF24
The code for the controller simply reads whether a button has been clicked or not. If it has, it sends a '1' to the light switch device.
The light switch device will check if its radio has received anything or if the button on the front has been pressed. If it has, it rotates the servo either forward or backward to switch the lights on or off. And that's about it!
You may need to adjust the distance the servo motor rotates to fit your light switch. Simply change the values of the upPosition and downPosition variables in the code until it moves the proper amount.
I've added more details in the comments of the code, so if you want the nitty gritty details, its all in there.
STEP 8: The Controller
The controller is pretty simple. It has a pushbutton and an RF module. Were this a finished product, I probably would have made a nice enclosure for it, but for now, it's stuck together on a breadboard.
I used an Arduino Mega with a breadboard shield because its what I had on hand. Any Arduino should work.
I've attached a schematic of the wiring above and the code below.
STEP 9: Installation
To install, loosen the two screws that hold on the cover and remove it. Using those same two screws, attach the new automatic light switch cover to the switch. Make sure that the switch goes through the slot in the carriage.
Be careful not to touch any wires or anything inside. Electricity can be very dangerous.
To operate, plug both the switch and the controller. It may take a few seconds for the RF modules to boot up, but when they do, you should be able to operate your lights wirelessly with the push of a button. How convenient!
STEP 10: Improvements
I'm very pleased with how this turned out so far. I've wanted to make a remote control light switch like this for quite some time. This project was a great learning experience for me as well. I figured out a lot of things I'd do differently were I to make one again.
For example, right now, the light switcher is powered through the Arduino's USB port, Unfortunately, however, there isn't a wall outlet I can plug it into within a 10 foot radius of the thing. Oops. Maybe I'll add a battery pack.
Also, I think that the remote control could be replaced with something a bit more user friendly. I used the RF-24 modules because I had them on hand and I knew how to operate them, but there are definitely better options. I think that using a phone app to control it over Bluetooth would be pretty handy.
One could also use a different mechanism to flip the switch. Some sort of mechanism with a cool gear train or clever linkage or some neat design to fit the décor of your room might be a nice touch. The possibilities are endless.
I hope you enjoyed this Instructable. I definitely enjoyed making it.
If you have any ideas on how to improve this device or how to make this Instructable more clear and easy to follow, please let me know!
Happy making!
25 Comments
CreativeTinker 3 years ago
I actually made something similar when I was a kid 50 years ago! The tools are so much better now. (And it was uphill in the snow both to and from school.)
Pro hint: Bicycle spokes are great 2mm stainless shafts. 2mm eyelets fit perfectly for bushings.
Challenge 1: Could you do this without a sliding element?
Challenge 2: Could you do this and still have it be human opperable?
mwitherspoon 3 years ago
alanmerritt 3 years ago
I'll have to see if I can get my hands on some bike spokes and give that a try!
Before I started building it, I was thinking about how one could make it so that you can still move the switch by hand. I haven't quite figured it out yet, but I'm sure there is a way!
alexnovik 3 years ago
JennyandtheMachines 3 years ago
CreativeTinker 3 years ago
Let me know if you need some hints or "design review".
alexnovik 3 years ago
khoskin 3 years ago
But I guess he had fun making it, which was possibly the point. Might have been banned from directly playing with the mains wiring.
JennyandtheMachines 3 years ago
JennyandtheMachines 3 years ago
Remote control of mechanical switches can be particularly useful for people with disabilities, because so many different functions (ie. not just smart bulbs) are controlled by these switches. For example, a person with temperature regulation issues might want to switch a ceiling fan (repeatedly) on and off from their desk or bed.
Fans of this project might like to discover Switchbot; a commercial kit that does the same thing (see picture below). You stick the little box near the switch, and when you press your remote, the box pokes the switch on and off (it's quite fun to watch). The remote is a pocket button that can be carried anywhere.
There is an extra-special joy in creating something yourself, though. And checkout @mauroest 's idea of adapting it for an aerial connection during a thunderstorm (I'm guessing that could even be triggered by a local weather API, so your equipment is protected even if you don't notice there is a thunderstorm). So many possible uses. Well done!
mauroest 3 years ago
culti 3 years ago
khoskin 3 years ago
Although I have a back ground in electrical, electronic and computer engineering , with a reasonable mechanical knowledge, so probably stating the obvious I'd have just thrown a relay (maybe even a triac or solid state relay) and a microcontroller at the problem, and wired directly to the light circuit ! (I'd probably get something premade these days). Yes you need to know what you're doing with higher voltage electricity, it can be dangerous, but it's a lot easier.
But yeah, where's the fun in that :-D
remotecaptures 3 years ago
monguin 3 years ago
icecats 3 years ago
alanmerritt 3 years ago
gravityisweak 3 years ago
corradini 3 years ago
(A) This is a really nice piece of engineering -- for what it's trying to be. I.e.: given that the decided-upon approach is to mechanically switch the existing light switch, and goes down that pathway, it does so very nicely. AND, may I point out, it also illustrates rather a number of very interesting techniques and solutions that people might find quite helpful and or simply entertaining (and it's well-documented, -illustrated, and -explained!) (I would quibble slightly with the choice to machine the bushings vs. using off-the-shelf components - that choice kind of pushed this approach a little bit too far into the "quirky one-off (and expensive/difficult!) solve" domain -- it's one thing to program an Arduino or print 3D parts these days; it's another to assume access to and expertise with a metal machine shop.)
(B) It may or may not be the "best engineering 'solution'" to the problem itself: i.e., do we really want to Rube Goldberg a whole rack-and-pinion box with smart-board control simply to flip a switch, when we could -- well, not just put in a remote switch (that's ... "TOO simple", if you get my drift? and I think we're pretending an off-the-shelf solution doesn't already exist), but at least use something in-between, cheaper, and more-appropriate, like a relay, or servo? This just seems like massive engineering overkill - again with the Rube Goldberg - and (both time/effort and actual parts) expense.
schuylergrace 3 years ago