When Your Smart Light Switches Stop Working, Build Your Own

If you want smart light switches in your house, you can buy from any one of hundreds of manufacturers. [Brian Boyle] had kitted out his home with TP Link devices, but after a few years of use, he found they all suddenly failed within a few months of each other. Decrying the state of things, he set about building his own instead.

[Brian]’s switches use the ESP32 for its handy in-built WiFi hardware. His aim was to produce smart switches that would fit neatly into standard “Decor” style switch boxes. The design uses two PCBs. One is charged with handling the mains power side of things. It carries an SPDT relay for switching AC power, and a DC power supply to run the ESP32 itself. The controller board holds the microcontroller, a Neopixel as a status indicator, and a pair of buttons — one for switching the lights on and off, the other for resetting to default settings. The physical housing is 3D printed, and looks great with the glowing status indicator in the middle of the switch.

[Brian]’s switches are triggerable via MQTT, a web interface, and the physical button onboard the device itself. Having built the devices on his own, he’ll be well-placed to troubleshoot any usability or reliability issues that crop up in the future. That’s a lot more than we can say about most smart devices on the market!

14 thoughts on “When Your Smart Light Switches Stop Working, Build Your Own

  1. I’ve been wanting to do this for awhile but couldn’t figure out how to do the AC/DC conversion in such a tight space. I didn’t know about enclosed compact converters like the IRM-02-5. I’m looking forward to seeing what I can do with it!

    1. 100% Agreed!

      Not only is it tried and tested (Which to me is especially important when dealing w/ mains control and devices that have their fingers in my home security) but it also makes the devices more accessible to others who may want to build or use the project. Of course I am skipping over one of the main reasons why it makes sense to use Tasmota or another open source firmware, which is people don’t have to spend time learning how to use someone’s strange one off firmware and already know what they can do with it.

    1. I felt a audden ebbing in the force, as if hundreds of code inspectors and insurance adjusters cried out at once while reading this article.

      No, rolling your own mains switches and enclosures without UL certification does not meet NEC.

  2. Actually the latest versions of Tasmota also have Matter support for lights, switches and temperature.
    Tasmota is allot easier to set up than HAA but if you want a bit more complex HomeKit setup HAA is needed.
    I have a pool controller with lights waterfall and solar heater based on a Kincony KC868-A4 and HAA, I will do a write up when it’s complete.

  3. No matter what switches you use, a critical part is to clean the incoming power. I use the full suite of surge protectors, at the power entrance and every panel. I believe that’s why in more than a decade of use I’ve never experienced a mass-death of smart switches. (The failure rate has always been below 5%, and in many years 0.)

    1. If you don’t mind me asking, what do you use for whole-house surge protection? I’ve seen commercial installations but it was prohibitively expensive. TIA.

  4. The design fits the requirements, but there is from my point of view a missing requirement: minimize power consumption. Nothing done in that direction, starting with the always-powered relay (OK, only 50% of time statistically) is not acceptable nowadays. Plus WiFi, plus LEDs, … just to switch a light!

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.