Intro: WiFi Controlled LED Wedding Table Pieces
I recently got married and although my now Wife did most of the planning, I wanted to also put my stamp on the wedding and this is the project I came up with it.
In this instructable I will be showing you how I made WiFi controlled LED lamps that we used as table centers. There was 9 lights in total, each of them were connected to the WiFi and all worked in sync with each other.
In the first GIF you can see an example of all the lights all changing colour at the same time, while in the second GIF you can see them changing at different times to create a pattern.
While you might not have need for 9 of these lamps, I highly recommend building one as I think it looks great and the total price for one lamp is about €10.
Let's get started!
Step 1: Watch the Video
I've made a video describing the project where I will cover the same things as I do in the instructable, so if interested definitely check it out!
Step 2: What You Will Need
As weddings are already expensive enough, and I had nine of these to make I wanted to keep the price down as much as possible! Here is a list of everything I used in this project:
Each light is made up of the following:
- Ikea Grono lamp (€7 @ Ikea) - This is the glass vase/surround.
- Wemos D1 Mini Clone* (€2 @ Aliexpress) - This is a Arduino board with built in WiFi for €2 delivered, what's not to love! It's based on the popular ESP8266 chip.
- 16 Neopixel Ring (€1 @ Aliexpress) - A really cheap and easy way to have colour changing LEDS that only uses one GPIO pin of your Arduino
- 2 x 1200maH battery banks (€3 for both @ Poundland) - As I was using these as table centers in a banquet room, I needed these to be battery powered. I needed around 5 hours of run time and this was the cheapest way of doing it! I'll go into more detail on this later.
I also 3d printed something to attach everything to, this is optional, or could be replaced by anything, even something like Popsicle sticks, you'll see in a later step where its used.
To control the lights from one central point I used the following:
- Raspberry Pi Zero W (~€12 anywhere) - This is the latest pi zero with built in WiFi, any Pi with WiFi should do.
- Nextt Wifi Router (€12 @ Aliexpress) - Any router could be used for this job, but this one is particularlly nice as it's absolutely tiny and is powered by a micro USB cable
* = Affiliate link
Step 3: Overview of the Project
In this step I'll give a quick overview of what is involved in the project
The router hosts a WiFi point, this network will not have internet, but we don't need it. If the venue has WiFi it might be possible to use that but its good to have a network that you can test before bringing to the venue so you can be sure everything is working!
All the Arduino boards and the Pi connect to this network.
The lights are controlled by a phone/computer that is also connected to this network via a web interface on the Pi
Step 4: Software for Arduino Boards (McLighting)
Each of the Arduino boards are running a software called Mclighting, which a purpose built sketch for controlling Neopixels using an ESP8266 based board.
It comes with a really good web interface which is great for trying out different colours and huge range of different patterns.
The LEDs can also be controlled via REST API, websockets (which I use for this project) or even MQTT
Step 5: Software for the Raspberry Pi (Node-RED)
The software on the PI that we will be using to communitcate with the Arduinos is called Node-RED
It's almost like having your own personal IF this then that (IFTTT), you create flows which are a series of different sequences or events that are caused by different triggers.
If you have a spare Pi I would definitely recommend trying this out, its really configurable and easy to use.
Step 6: Assembling the Light
The circuitry for the light is actually very straight forward
First solder the Neopixel to the Arduino as shown in the second picture, I recommend using stranded wire as it is more flexible for bending
For the battery, the cheapest way of getting the required run time was combining to cheap power banks. NOTE: Before starting this part, make sure you charge both cells and measure them with a multimeter, they should read around 4.1 - 4.2V
Open up both power banks, and desolder the cell from one of them. Be very careful when desoldering here as your iron and the solder are conductive and this is a live circuit!
You then want to solder the cell onto the circuit of the other cell (I found there was room on the other side of the circuit board). When you are happy with this connection you should hot glue it place.
The 3D printed part is just an X, which can be found here if you want it! You could use popsicle sticke or basically anything that lets you hold everything together.
Hot glue the Neopixel ring to the center of the X on top of it. Apply a small amount of hot glue to the bottom of the X near one side, this is where the battery will go (take a look at my pictures to see this in more detail, its off to one side, but not right at the edge) Place the X upside down in the vase, and press the battery down onto the glue and let it dry.
You should now be able to take it out, reinforce with more hot glue. you should now be able to everything back into the lamp the right way around and it should be level
Step 7: Installing McLighting
If you have never used the ESP8266 or Arduino before, we will need to a little bit of software setup. I have a dedicated video for this. It's only 5 minutes long and goes through everything you need to setup.
If videos are not really your thing, check out lesson 2 of Becky's awesome IoT Class, it goes over everything you need as well.
Before you move to the rest of this step you should be able to upload a simple sketch to your ESP8266 (such as the blink example mentioned in both the video and Becky's lesson)
Next you will need to download the software from McLighting's GitHub page. Extract the zip file when its downloaded.
In the Arduino IDE, open the ino file in the folder you just extracted.
In definitions.h change #define ENABLE_MQTT to anything else (as shown in the 3rd picture)
We now need to install some libraries that are required by McLighting, there is a list of them on the projects github, it probably worth going by that list in case the lbirary updates (which would cause this instructable to be out of date). At the time of writing, 3 of the libraries can be installed from the Arduino library manager ( Sketch -> Include Library -> Manage Libraries ): WifiManager, Adafruit Neopixel and Websockets
The only one that isn't on the library manager is WS2812FX one, you will need to download that from Github as we did with Mclighting, although we don't need to extract it this time. When downloaded go to Sketch -> Include Library - Add Zip and add the zip that you just downloaded.
You should now be able to compile the code to check everything is working
Step 8: Modifications to McLighting Sketch
We need to make some small changes to the McLighting sketch.
In definitions.h we need to change PIN and NUMLEDS to match what we have (in my case its D3 and 16)
We also need to change the HOSTNAME as it needsto be unique for all the different lights.
Now in the actual sketch, in the setup method we need to add a static IP address for each ESP8266, add the following line after WiFiManager is first initialized (replace X with a unique number for each one)
wifiManager.setSTAStaticIPConfig(IPAddress(192,168,1,X), IPAddress(192,168,1,1), IPAddress(255,255,255,0));
Finally we need to turn off the onboard LED as it can be seen through the vase, its also in the setup method, there is a comment before it "//keep LED on", you want to change this to
You now want to program your board with this sketch.
Step 9: Configuring WiFiManager
If everything went ok your LED ring should now be lighting up Blue, this indicates that it has launched the config mode of WiFiManager
I've talked about WifiManager in a few short videos before, basically it's a really cool piece of sofwtware that allows you to configure your WiFi settings on your ESP8266 without re-programming it.
Your ESP8266 will have created a WiFi network with the same name that we set for the HOSTNAME in the previous step. Connect to this with your phone or laptop
Just like a public Wifi network you should be redirected to the WiFimanager page, enter in the SSID and password of the WiFi network on the router that we will be using for the project
When you save it it will restart the device, your LED ring should now be cycling through a rainbow sequence, this means that it has connected to the network.
Step 10: Uploading the Web Interface
Although we don't technically need it for this project, there is one final step to finalise the setup of McLighting.
Open your browser and type in the IP address of the Arduino, you will see a page not found message.
add '/upload' to the end of the IP address, click the choose file button , navigate to the extracted McLighting folder from the earlier step and go to clients -> web -> builds, upload both these files.
Now when you go to the IP address you should now see the web interface. You should spend some time playing around with the different settings and patterns available, there is a lot!
Step 11: Setting Up the Pi
Node-RED comes pre-installed on the Raspbian, which is the most common OS that people use on their PI
The easiest way to install Raspbian is using the Noobs installer, which you can download from here.
Check out the video above or this link here for information on how to set it up.
When Raspbian is installed, connect to the WiFi network that the Arduino's are on.
You can launch Node-RED the same way as shown in the image above, but realistically you want it to run as a service, so it will run every time your PI turns on. To do that you want to open up a terminal and type in the following:
sudo systemctl enable nodered.service
You will also need to get the IP address of your PI, the easiest way to do that is to type the following into the terminal:
Step 12: Configuring Node-RED
Now from a computer on the same network as the PI we can open a web browser and enter in the PI's ip address followed by :1880 (e.g. 192.168.1.10:1880). This should open the Node-Red web interface.
The first thing you want to do is drag an inject node from the options on the left to center of the screen. Double click on this node
This will pop up a screen as shown in the second picture, for the payload option you want to click the drop down arrow and change it to String, in the text box you need to type =rainbow this will eventually send the command to start the rainbow animation to the Arduino. To see a full list of commands available check out the McLighting github page here. We also want to name node something meaningful in the Name field and click Done
Next we want to select a websocket node from the output options and drag it to the right of out inject node. Again we want to double click on this to edit it.
Under the Path option, select Add new websocket listner and click the edit button beside it (the pencil)
In this screen we want to type the following into the path option:
ws://192.168.1.X:81/ (X should be replaced with the actual IP address of your device.)
Click the Add button
Now give the node a name that is meaningful for being able to identify this light (I just numbered them 1 - 9) and click Done.
Now we just need to connect the output of the Make Rainbow node to the input of our new websocket node. When you have them connected with a line, click the Deloy button up the top right of the screen. You should see a connected status message under the websocket. Now if you click the Make rainbow button (the blue square to the left of the node) you should see your light change colour!
Now you just need to repeat the step of created the websocket node for each light, you can connect each of the inputs to these to the output of make rainbow, this will create the effect of them all changing at the same time.
Play around with the different options in node red to create different sequences etc! A nice simple one is to add a delay to before the input of each one to offset when they change
Step 13: Conclusion
This was a really fun project to do. I was very happy that I could make my tinkering and making part of our big day!
I was really happy how it turned out. I think the lights look really well, and as i mentioned earlier i think its well worth making even one of these as a side lamp, I think the fact that out can make one for €10 is amazing.
I really can't recommend McLighting and Node-RED enough, they are both really excellent pieces of software and made this project possible as I only had a few days to get it sorted!
As always, if you have any questions on any part of the process please let me know and I will be happy to try help.
Thanks a lot!