Tom Van den Bon and Sebastian Schocke of Binary Space, a makerspace in the Vaal Triangle, have put together this build challenge for their members. Follow their lead and you can have a unique and awesome colour changing WiFi lamp in just a couple of hours.
What is it?
For December at Binary Space we wanted to do something a cheerful and colourful. We got together to design and build a low power LED table or ceiling lamp that connects to your home WiFi. Once assembled and connected you can change the colour tone to any one of 16 million colours from the RGB gamut.
And it’s easy to put together too.
- What do you need?
- Acryllic sides (laser cut or hand tooled)
- 3D printed bracket (or access to a 3D printer. As an option you can 3D print the base too)
- Nucleo STM32 Development Board
[su_accordion][su_spoiler title=”Details” style=”fancy”]The ESP8266 module is a new wifi module which recently surfaced. It’s very cheap, simple to use and available locally. It also supports our ‘play with new tech’ goal. While the ESP8266 packs quite a punch with a onboard 32bit micro controller we decided to use it purely as a wifi module and not as the main controller. This complies with our time limitation and not having time design a custom PCB.[/su_spoiler][/su_accordion]
- ESP8266 Wifi Module
[su_accordion][su_spoiler title=”Details” style=”fancy”]For the main controller we settled on a Nucleo development board. Why not the usual Arduino that you see in a lot of the projects these days? Two reasons, it’s cheaper than the Arduino and you get a 32bit microcontroller with lots of flash and ram (way more than the Arduino). The nucleo also has arduino shield compatible pin connections so all those arduino shields you own won’t go to waste. The nucleo is also supported by mbed (developer.mbed.org), so development is almost just as easy as an Arduino. The mbed IDE is also online so you don’t even need to install development tools to program for it.[/su_spoiler][/su_accordion]
- Set of WS2811 RGB LEDs
[su_accordion][su_spoiler title=”Details” style=”fancy”]Lastly we settled on some WS2811 led’s. These are addressable RGB Led’s and will be providing the light source for our lamp. They have a pretty complex and time specific protocol, but there are libraries written for these LED’s for pretty much every development kit out there so using it should be simple.[/su_spoiler][/su_accordion]
Time to build Two hours
As with every Binary Space project we had a few goals for our lamp.
- Since the year is ending and all the businesses are closing for the holidays we had to design it around components which we could get locally. There also wasn’t any time for custom PCB’s so all the electronics needed to be plug and play.
- Cost is always a factor around our monthly projects. Lots of members like to build something new every month so it can’t cost too much.
- The project needs to use some kind of new technology. As with any Maker we like to learn new technologies and experiment with new products.
- Apart from power we didn’t want our lamp to be connected to anything. There is no point in having a pretty lamp and then have it wired to a permanently powered computer (With all the Eskom problems of late that would just be irresponsible). This requirement means our lamp should be wireless. Most homes have WiFi routers so having it connect to your local WiFi network seemed like the logical way to do it. It also opens up our project to be part of the interwebs.
- The lamp should be easy to use. I like to call this the partner acceptance factor. If you can build something that your partner will allow to be displayed in your house and can operate at the same time then we are halfway there. This also make it easier to get authorization to spend funds on future projects. If our lamp is connected to our WiFi network then I want to be able to control if from my smart phone.
Putting it together
While Sebastian started looking at the code for our electronics I started working on the lamp enclosure. We have access to a laser cutter and a 3D printer so prototyping only take hours and not days/weeks. This is the great part of being a member of your local hackerspace. You get access to tools you normally wouldn’t be able to afford on your own.
Creator’s notes – Click here for how we designed the parts
The lasercut box was easy to do with my OpenSCAD script and the nucleo model I used to create the original base came in handy to determine the screw holes.
To hold the WiFi module in place I designed something that attaches to the base plate next to the Nucleo with M3 bolts. It took a few iterations to get it just right, but with the 3D printer it was easy enough to have a few prototypes after a few hours.
The electronic parts are connected to upright pins on each board using via regular breadboard jumper wires. It’s simple but effective. See the table below for reference as to which cable to connect where.
The external power supply (7v-12v) connects to the VIN and GND jumpers on the Nucleo.
Flash the firmware to the controller board by dumping the firmware on the Nucleo mass storage device (it enumerates as a memory stick when you plug it into a PC via USB).
[su_accordion][su_spoiler title=”How we created the firmware” style=”fancy”]
For the firmware we decided to use mbed. Just as the Arduino library simplifies development on the AVR (the microcontroller on the Arduino development board), so does the mbed library simplify it for the Nucleo.
The WiFi module we use has serial (UART) interface so setting it up and communicating with it is as simple as sending AT commands to it. There isn’t a lot of official documentation for this module (at least not in English), but it’s been very popular for the past couple of weeks and lots of hackers around the world has figured out pretty much everything there is about module. There is even an online community just for this module.
The module was hooked up and Sebastian had it configured and running pretty quickly. The current code design starts the module in SoftAP mode. This means that all your devices would see it as a regular wireless router.
The module has basic commands for sending data over the network and even has a built-in TCP/IP server that can accept multiple connections. Sebastian created a mini webserver running on the Nucleo which makes use of the TCP/IP server on the module for communications.
For the LEDs we had a look to see if there was any existing libraries that could talk the ws2811 protocol. We found a few and decided to settle on this one. Some changes had to be done to the code to make it work with the different nucleo development boards but soon we had the ws2811 led’s blinking and flashing.
Whats next ?
We now have a working prototype of our WiFi connected RGB lamp. It looks and works great!
The web server currently only has one feature: connect to the lamp and change the colour of the LED. It’s simple, but it’s the base on which we can now build more features on.
The members of BinarySpace will build their own RGB lamp for our December monthly project. The project page is here.
Should you want to build your own then you will find all the design files and source code repositories on the project page.
We are pretty happy with the hardware side of the lamp. We have spoken about creating a custom PCB in the new year to simplify the lamp even more and make it a bit more rounded off.
On the firmware side we still have lots of plans. Among them we want to improve the web interface, allowing you to setup the WiFi configuration and also to change the mode of the module to connect it to existing networks. We would also like to add an API so that you can change the colours from other scripts/programs. For example, change the color based on the current Eskom status.
Be sure to check the project page for updates to this project and let us know how it can be improved.
Tom Van den Bon founded BinarySpace, and every month he sets his members a project. The idea behind the project is that there is something to do for members who want to build something and learn new technology, but don’t have a specific project of their own. Previous projects included a pocket-sized robot arm and an infinity mirror.
[All images courtesy Tom Van den Bon/Binary Space]