Thoughts of a geek

25 May 2019

Fairy light controller

Filed under: Computers, Electronics — Tags: , , , , , — qwandor @ 12:34 pm

One of my housemates has a lot of fairy lights. Most of them were battery powered, each by a little pack of 3 AA batteries, which seemed somewhat wasteful. They are great for parties, but turning them all on and off individually is kind of a pain too, so I wanted to make them mains powered, and controlled from Google Home. And as I mentioned in a previous post, I’ve been playing with ESP8266s recently, so I built a controller based on the D1 mini board.

The first version I prototyped with a dual H-bridge board I had sitting around, using each half-H separately so it could control 4 strings of fairy lights, just twisting some wires around the battery terminals. It was a bit messy though:

First prototype, fairy light controller V1

So next I made a somewhat neater version on some stripboard, using a dual H-bridge chip I had sitting around, but with a pair of screw terminals per output rather than just a single ground connection to make it easier to use. I also added some header sockets that could be used to put a resistor in series with the output easily. This meant that rather than being quite so hacky with wires twisted around the battery terminals I could cut the battery box off entirely, unsolder the resistor from there and put it into the socket on my board, and then just connect the wires from the lights themselves to the screw terminals. This made things a bit neater:

Fairy light controller V2, H-bridge chip on stripboard

I also happened to have a bunch of power darlington transistors sitting around, so I made an open-collector output version with them. This let me add the option of using a separate power supply for driving higher voltage loads, rather than just using the same 5V USB power supply as the D1 mini. It was also a bit smaller. (The white terminal block on the left is the power supply input, and the jumper next to it connects it to the 5V from the USB power supply instead.)

Fairy light controller V3, open-collector outputs and an optional separate power supply.

This worked well and was certainly an improvement, but stripboard is still a bit messy, so I decided to make a proper PCB for it. I also found a handy chip with 7 darlington drivers, so I used that. 4 channels still seemed enough so I hooked 3 pairs up together in parallel for higher current capacity. I designed the board on EasyEDA (link at the end if you want to order some for yourself) and ordered 10 copies from JLPCB in China (PCB prototyping services are amazingly cheap these days!) along with the parts, and a few weeks later they showed up.

Fairy light controller V4, all soldered up neatly.

It was indeed neater, so I think this will be the final version. It works well, controlling the fairy lights in the living room.

On the software side, I was able to share a bunch of common code (for the web admin interface and so on) with my previous smart button project. For integration with Google Assistant and Google Home I went via Sinric, which provides a server that the board can connect to, and then can connect to the Google Smart Home API. It’s still a wee bit of a hack at the moment unfortunately, as the Sinric Google Home integration isn’t properly launched so you can only use it in developer testing mode, but other than that it works well. You can track the status of the Sinric launch on GitHub.

If you’d like to make one for yourself, you can find the schematic and PCB design here on EasyEDA ready to print, and the source code and setup instructions here on Gitlab. (See the ‘Smart switch’ / qSwitch section.) And there are a few more photos here. Let me know how you get on!

[edit] Oh, and if I know you / you live in London, I have 9 spare boards and most of the parts available, so if you’d like one let me know. You’ll just have to get your own D1 mini and terminal blocks. Happy to help get it working too.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: