WiFi-Connected, Raspberry Pi Controlled, Synced Up IOT Parade Lights

Background

Each year my high school marching band participates in a few local Christmas parades. On these occasions the band directors let us decorate ourselves and our instruments. A lot of people will use tinsel or little LED strings, and that inspired be to design, build, and program these WiFi-connected, battery-powered lights that sync up together to create cool animations for my entire flute section to wear

My Past Attempt

This wasn’t actually my first attempt to make these parade lights, two years prior (last year we didn’t have a parade due to covid), I had this idea and tried to make it work. That version was much more simple, each light just consisted of an Arduino Nano, the lights, and a 9v battery to power it all. All of the lights were running the same code, and they would be synced up by having everyone press the reset button on the microcontroller at the same time. This didn’t end up working very well, and the lights got out of sync within a few seconds because of fluctuations in the Arduino’s crystal oscillator, not to mention their extremely short battery life because of the high power lights and low capacity 9v batteries. I knew my next version had to be very different.

Prototyping and Design

I started off with just making 4 of the units for testing and development of the software. Each unit also consisted of a 3D printed case to house the ESP8266 on the battery pack.

A few months before the parade, I got started planning and prototyping. After some research and testing, I decided that the hardware of each lights would consist of a string of 17 Individually addressable Neopixel lights, an ESP8266 WiFi microcontroller, and a 3 AA battery back. I wanted to keep this system as simple and cheap as possible, so there was no voltage regulators and the LEDs and ESP32 were powered directly off the battery pack. I did lots of testing with running the units through their discharge curve to make sure all of the electronics would function properly.

The units are powered on through the switch on each battery case, and it is worn around the chest and secured back to itself using Velcro.

Software

This was the most challenging part for me. I needed a way to have all of the lights communicate together to stay synced. My solution consists of a main Raspberry Pi “Server,” which creates a WiFi hotspot that all of the ESP8266s connect to. The Pi then sends out UDP broadcast packets to all of the lights, which the lights decode and use the information to display animations.

The animations are stored on a single text file in the Pi. Each line of the text file consists of 14 bytes * the number of lights that are being controlled. Each light has an identifier number, so even though each light receives the entire packet which contains the data for all of the lights, it parses out the 14-byte section which corresponds to that light, allowing for individual control. The first 2 bytes controls what the light does, so instead of telling the light exactly what to do with each pixel in its string, it has a certain number of preset animations that can be selected. This simplifies animation creation. For example, 00 corresponds to do nothing, 01 corresponds to set the color of the strip, 02 corresponds to a fade in to a specific color, and so on. The next 9 bytes in the packet are the 8-bit RGB color values which some of the animations use, and the final 3 bytes are a delay value that some of the animations also use; for example how long to fade in for, or how long to display the rainbow animation. 
 
I originally thought I was going to have to use my more power Raspberry Pi 3b+ for the server, as I found that the original Raspberry Pi Zero wasn’t powerful enough to create the WiFi hotspot and send out the beacons accurately every time. Coincidentally, right as I was coming into this issue, the new, and more powerful, Raspberry Pi Zero 2 was released, and I was able to get my hands on one before they completely sold out. It was absolutely perfect, because it was very tiny and easy to have on me during the parade, but was powerful enough to have no problem running everything. 

Final Preparations

After getting a prototype system that worked, I went and created the rest of the 15 strips for all the members of my section, and expanded the animations for all the lights. The Raspberry Pi Zero 2 W server was mounted on top of my Christmas tree hat for best coverage and powered by a portable battery. Because the server is able to individually address each of the lights, and I knew where everyone would be during the parades, I was actually able to have some animations move through the section.

Results

Day of these parade I brought these to my section and showed each person how to power them on and wear them. Once we got set up before the parade, I got some videos of the animations playing in my section. Take a look! They were a hit, everyone in the band and the band directors loved them, and apparently the directors had a few people asking about them after the parade!

Update: Following Year’s Parade

After the success of these I brought them back for the following year’s parade. Although my section was a bit smaller, they were just as much of a hit!

Leave a Comment

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