Hardware projects

ESP8266 lamp project

This is an old post from my old blog, posted on the 29th of January 2019!

Some time ago my dad and I made a couple of WiFi controlled lamps, with the help of the ESP8266 micro-controller. It’s a completely DIY project, and I wrote my own software for both the ESP’s, and the control server is running on our linux machine. In total we made three, but I’d really like to make a couple more.

We bought all the parts from Banggood, and for those three controllable lamps we spent about 37 euros in total. This means each unit costs a little bit over 12 euros, which is not too bad in my opinion. Especially because it has a sweet see through plastic cover on the front, so you can see each little LED blinking away.

Full parts list:

The first step of the project was prototyping. After hot gluing all parts together it looked something like this:

And after nervously connecting mains power to it, it worked without any sparks!

At this stage the relay could be controlled by the website front-end I had developed and tested beforehand.
Now it was a matter of putting everything in a small plastic and waterproof box, and making 2 more of them.
Of course I found better ways of making and connecting everything as I went.

All together in the box it looked like this:

And screwed in place:

For “safety” reasons we added an ordinary switch in series with the live wire going to the esp, and through the esp to the lamp. We did this because if anything went wrong we could just switch off power to the thing.
One side-effect from adding the switch in series is being able to switch off the lamp when you’re there without a phone. Because when the esp starts up it defaults in the off state, you can power-cycle the esp to switch off the lamp. Maybe it would’ve been nice to also be able to switch the lamp on using this method, but it would probably need some extra hardware, such as a capacitor and a resistor to remember the state of the lamp for the couple of seconds the esp didn’t have power.

Leave a Reply

Your email address will not be published. Required fields are marked *