Remote Control Light Switch

41K16836

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

Nice work Alan!
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?
LOL Same here! Although my bedroom automation involved only kite string and lots of eye screws! Dad wasn't happy about his missing eye screws. But he was impressed enough he let me keep them.
Thanks for the comment!
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!
Put control box under light switch and make control arm moving with the use of threaded rod (worm gear). Control arm then can be made flipable, just flip it towards you and toggle switch manually
I think a similar route is taken by Switchbot - there are various stickers to attach to differently-shaped switches. The sticker adhesive is surprisingly strong.
This is a great little project.
Let me know if you need some hints or "design review".
Why don't you just use relay under toggle switch. Overengineered to my taste
my thoughts exactly :-D
But I guess he had fun making it, which was possibly the point. Might have been banned from directly playing with the mains wiring.
Indeed, there are so many people who rent their homes or workplaces, living under strict tenancy agreements; they're prevented from hanging pictures on the wall, never mind playing with the electrics. Care homes would be another example - and a place where remote mechanical switching would be especially handy.
What a great project!

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!

it is a starting point not for an electricity switch but to remote attach/detach one aerial plug. During thunderstorms aerial must be physically not attached to TV or radio
Seems like a very nice project. But I think I will stick to just buying a smart bulb or smart switch. But absolutely nicely done.
It's very clever and I'm impressed with the effort put in.

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

Awesome project! I don't see any limit switches. How do you make sure the carriage doesn't run to far either way and hit the top or bottom of the enclosure? Are you telling the servo to move just enough to hit the switch each time or did you design a mechanism that allows the servo to stop pushing the carriage before it hits the top or bottom but also allows you to move it back int he other direction? That would be neat!
Wow, this is really cool! I have the same problem in my dorm room. Congrats on the contest win too! Trog Ebersips would be proud!
Thanks! Hehe, I'm sure he would! ; ]
I've got a suggestion for a minor change that would allow for manually controlling the light switch. The small cage you put around the switch handle itself is too small. If you modify that 3d printed part to simply go across your 2 sliders as a straight bar at the top and bottom and leave enough room for the switch to be in the on or off position the light can be in either the on or off position by hand. Then modify your programming so that when you hit the on or off switch remotely your slider moves up or down to turn the switch on or off then returns to a neutral position. Let me know if that was a clear enough description. Basically modify your diagonal braces on your sliding carriage so they go straight across to the other one instead of wrapping so tightly around the switch. This is an awesome instructable! People commenting that you can do it more cheaply or easily with other technology are totally missing the point!
SOOoooooo....I have 2 comments, both probably variants of what've been said already, but: both meant to be constructive, and helpful for future Makers.
(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.
Nice project, but you know, you have power right there at the light switch? A simple regulator circuit, tapped into the 120vac feeding the switch and housed in your existing box, could feed whatever you needed to power. And although I like the mechanical part best (despite being an electrical engineer), you could also just fire a solid state switch with the Arduino and eliminate all the mechanical bits.
More Comments