My home automation light switches have gone through a series of versions, starting with very complicated switches that all had Ethernet built in. Over time I’ve simplified the system so now the light switches themselves are electrically very simple: they’re just illuminated buttons on a breakout board with an RJ45 connector, and absolutely nothing else in them.
The switches connect to a pair of centralised light switch controllers over Cat-5 cable, so that it can detect when the buttons have been pressed and report events to MQTT.
In this episode I show some of the previous versions of my light switches, and then show how I built an Arduino based light switch controller.
Parts used in this project:
- Altronics 1U rack mount case
- Freetronics EtherMega Arduino-compatible with Ethernet
- Freetronics OLED128 display module
- Freetronics Watchdog Timer Module
- Freetronics Temperature / Humidity Sensor Module
- SuperHouse I/O Breakout Shield Mega
- SuperHouse I/O Breakout to RJ45
The source code for the sketch running on the controller is called “LightSwitchControllerMQTT”. You can find it on GitHub at github.com/SuperHouse/LightSwitchControllerMQTT.
There’s also a general introduction to the I/O breakout schema that I use at I/O Breakout. I’ll probably cover this in detail in a future episode because the same breakout shield will be used in other projects.
The light switches themselves are just illuminated buttons on a breakout board, mounted on a standard wall plate. The 4-button panel uses all 4 available data lines. The 3 and 2 button panels simply use fewer data lines. Click on the schematic for a larger version:
I didn’t spend much time in this episode explaining the current version of my light switches because I’m going to cover it in much more detail in the future. This episode is mostly about the controller.
Addendum: Chris Aitken has written a handy library to detect different button press events, such as single-press, double-press, and press-hold. This could be used to extend the functionality of the button controller significantly. Check it out: github.com/caitken-com/MultiFunctionButton