Andy's Blog

A handful of ramblings...
Font size: +
9 minutes reading time (1803 words)

Light and Circuit Control


I had mentioned a long time ago that I was working on some solutions for light switches. At that time there were not a lot of out of the box solutions that weren't Z-Wave or Zigbee based. Additionally, my old home mostly relied on lamps rather than ceiling lights leaving a few popular options at that time - Sonoff, commercial WiFi switches, or WiFi light-bulbs.

The Path from There to Here

As mentioned before, home automation began for us with a need to give my wife, who was significantly disabled at the time, an easy and useful way to control parts of our home. For her at that time(2018), this meant being able to control lights first and foremost. At that time, she was recovering from a pretty devastating failed surgery to resolve a fractured vertebrae. She was unable to walk without assistance and was mostly in a wheelchair or had limited ability to walk with a walker. Just going around dealing with lights was difficult and dangerous.

I started where many at that time started - Sonoff inline switches. In my 8 month article, all except one of the lights shown in that banner image are controlled by Sonoff switches. Now, I did stretch their use by modifying them to be used in printed wall switch enclosures but those were pretty quickly replaced.


Next came reflashing existing switches. I ran across a you-tuber named Travis Griggs who's channel DigiblurDIY was a well timed and well presented treasure trove of information on exactly the things I needed to know. There I was introduced to Tuya Convert and Tasmota and the switches that he had already converted from cloud based firmware to locally controlled goodness. I stocked up converting almost all of the wall switches in my home.

Unfortunately, that ride came to an end when Tuya Convert, a program used to unlock the factory cloud based Tuya firmware used on many smart switches on the market, stopped working. It was during this time that I decided to design my own switches.

Next Chapter - Self Designed and Built - Sanctuary Labs

It wasn't just Tuya Convert that made me realize that I couldn't rely on hacks and work arounds. In 2020-2021 during COVID, several things started to change. First, there was signs that a new home automation communication protocol might actually come to life. Although skeptical, I had hope that one day, I could buy a device off the shelf that would work without the cloud and was really mine regardless of the support of the company that made it. Although a lot has advanced on that front, I'm still waiting. Yes, Matter is around and in some cases the devices that are Matter based will work with Home Assistant out of the box. However, many lack full functionality locally and others still require a cloud based app to get them started. No thank you.

Second, during that same time, companies with home automation devices were dropping like flies. Some would close up shop overnight leaving people literally in the dark and others were closing up their APIs so that third party programs like Home Assistant could no longer use them. In reality, this was were I drew the line. I have an electronics and coding education - time to put it to work for us.

I had already been working on several devices like a bedside control panel, a headboard controller, a weather station and several sensor devices so, I started to work on a wall switch. By this time we had grown into our home automation system enough to know what was missing.

Unlike many others, our schedules are not based on regular sleep schedules so many of the typical time based automations and conditions didn't apply to us. We still use manual switches (personal preferences at play here) to control most lights. The system does turn on the lights in the house at dusk and will shut off most lights in the early morning that are left on but we choose to control lights by scenes. Every room has 4 standard scenes - Evening, Late Night, Away, and Off. So, the first wall switch I designed was to include 3 scene buttons and one button to control the circuit its on.

I designed this first iteration to handle 16A of current which was another complaint I had with the typical commercial switches that usually rated from 5-10A max. I also kept the design simple and used known reliable power supplies for the MCU. On the main board there are 4 buttons, a LDR (light level sensor) and an motion sensor. I used Tasmota for the firmware.

These proved to be reliable and in the 3 years I've had them in use, they have been more reliable than the commercial devices. However, they aren't perfect. For one they required SMD components on both sides of the board which increases cost and complexity of manufacture. They also do not have a status light on them for indicating WiFi status or status of the relay in the case of porch lights. So, for version 2 I refined the design a bit.


So, what is Sanctuary Labs? I have had a fair amount of interest in some of my designs and while most of what I've made is has been released as Open Hardware, I wanted to develop an entity in case I decide to sell devices. While this hasn't happened yet, I am designing devices under that banner. More on that at a later date.

Current Work

This switch handles a lot of what I wanted to accomplish but I need a few more devices which are in the works currently.

First, I need a dimmer. Currently I'm using Martin Jerry dimmers and have liked them but they have some odd quirks and unreliable behavior due largely to their two controller Tuya setup. I want to make a simpler option that works with Tasmota out of the box. Yes, I know that MJ has started making a line of switches that come with Tasmota, but as I have learned bitterly, that may change tomorrow. Best to be prepared today.

Second, I need a 3-way switch. There are several switches on the market that are 3-way switches each of them have the same problem - they all have a small signal current that run through the load to detect if the second switch is on or off. Ordinarily this is not a big deal but if you use cheap LED bulbs you find that they will flash intermittently.

Third, I need a fan and light control switch. Admittedly, this one is pretty low priority. Sonoff makes a good fan controller and I just haven't needed to dig into this as I have spares but it is on the list.

Fourth, I am working on a presence switch. Yes, I know that the switch I have already designed has a motion detector but these are pretty unreliable if you have pets or the switch is near an outside door. Plus, as I wrote about in Home Automation - Year 4, I have been working on a security system that is all about personal safety. Part of this is knowing who is where in the house. This switch design incorporates a camera and on board ML code to identify people in a room. The unique bit is that the image processing is entirely on device. No images are sent anywhere and you can't stream images or video from the device. This camera is entirely private.  This one is moving along at a pretty fast clip and I should have a prototype built in a few weeks. More on this soon.

So, What's with this WiFi Fixation?

By now, you may be wondering why I'm not using Z-Wave or Zigbee? They are local, established and supported in Home Assistant. Well, honestly, these are fine options and a lot of people use them successfully. If I had come into home automation within the last couple of years, I might have gone that way.

You should know that when I first got started with Home Assistant, Zigbee support was spotty at best and that there were a lot of people having trouble with some devices working and others not. I didn't bother with it at that time and that kind of design decision affects future choices. That's it.

I didn't go with Z-Wave because I do use Z-Wave locks and have had nothing but trouble with Z-Wave devices dropping out or just disappearing - back a few years ago. When they moved to Z-Wave JS and I finally got things readopted, things have been pretty solid. However, the bad taste was placed and I didn't go back to using it past what I had already invested in.

In the end, WiFi works. Pundits say that you'll saturate your network and things will stop working. Nonsense. If you have a crappy WiFi setup, sure. However, why in this age would you not invest in your home network if you are going to the trouble of building a "smart home?" I have a 100+ year old home with plaster and oak walls, multiple brick fireplaces, surrounded by a electrically dense neighborhood. We have no trouble streaming 1080p movies to multiple TVs, 11 security cameras, and over 60 other WiFi home automation devices. No problem.


Related Posts



No comments made yet. Be the first to submit a comment
Already Registered? Login Here
Tuesday, 23 July 2024

Captcha Image