Summary
Turn your lights on and off remotely and still get your security deposit back!
This is a switchplate for adding a mechanical micro servo to decora style lightswitches. There's still enough room to operate the switch manually, so you can still use it the regular way too (but how boring!).
You'll need:
- printed switchplate
- SG90 servo
- Raspberry pi with the basics (sd card with noobs or raspbian installed).
- Two python scripts & your ideal way of triggering them
See it in action here: https://www.youtube.com/watch?v=ItmQilUu55g
Post-Printing
Print and assemble
Prints best lying flat, with supports. It doesn't matter if the supports make it look scrappy because they're on the back.
The SG90 slips right in from the back, and can be secured with small screws or M2x12mm bolts (there is just enough room for the nuts to slide behind the servo, though you may need tweezers).
Note: Don't add the servo arm until you've tested the code because it needs to find its "home" axis without hitting the wall.
Wire it up
The SG90 can get it's power from the Pi, so there's no extra power needed. You can attach the wires to GPIO pins 4 (5v, red), 6 (ground, brown), and 12 (GPIO 18, orange). If you have a model with header pins you may just be able to plug them in, but make sure the order is color coded correctly!
More info on the GPIO pins at pinout.xyz
Add the scripts
Download these scripts from Github and add them to the Pi lightswitch_on and lightswitch_off.
Once you've tested the code and the servo has found it's default "home" rotation, add the two sided servo arm.
Run your smart lights!
There's lots of ways to run this remotely. The simplest is to run the scripts from inside your home network with an SSH command from an app like JuiceSSH. It will look something like this:
ssh pi@lightswitch-pi python "/etc/custom-scripts/lightswitch-on.py"
I'm using a command line switch in Home Assistant to turn it off when I leave the house, etc.
Have fun!
Tags
Modellquelle
