In mid December we decided to throw a New Year’s Eve party for our friends and I decided to do something a bit different. This gave me just under three weeks to create an exciting way to get the New Year’s Eve party moving into 2016 – The Party Button.
I’ve seen two previous party buttons – the older one from 2008 and a more recent. These are both very good, however I wanted to use a different song and our existing Christmas lights to create a fun party starter! Here it is…
At the core of this scene is a Raspberry Pi 2 controlling an 8-channel relay and an ESP8266 wifi module hidden inside an emergency stop button. The Pi is running a simple node.js server which waits for a GET request to ‘/start’ from the ESP8266. From there the code in the Pi simply starts the song and turns relays on/off depending on the milliseconds that have passed.
Soldering wires directly onto the batteries allowed them to fit inside the emergency stop casing. The ESP8266 module is running a simple script which was written in the Arduino IDE. It can be found here on my GitHub. This just waits for the button to be pressed and then sends the HTTP GET request to the Raspberry Pi’s IP address. There is a flag set so that it doesn’t post twice.
The Raspberry Pi and Relays
I knew I was cutting it fine on the timings of this project (there was a definite deadline and it was only two weeks away!) One idea that was explored was using LightShowPi to do Fast Fourier Transforms on the music files and set of different relays depending on the frequency of the song notes. Unfortunately this didn’t work for me because the song – Final Countdown by Europe – had very definite musical ‘layers’ and the FFT routine did not pick out these. Also I wanted to set off additional relays at specific time intervals and LightShowPi doesn’t currently allow for this, although I’m sure it will in the future.
In the end I came across this instructables which did a very similar thing to what I was doing and gave the starting points to the Python code. It did mean however that I had to do a VERY manual process of listening to the song many, many times and writing down the millisecond of each beat of the drum, keyboard and vocals in a text file! You can see my Pi code and sequencing file here. Also here you can find the node.js server code that waits for the HTTP GET request to start everything off as well as the code to turn off my Samsung TV and WeMo switch as soon as the button is pressed.
Once everything was tested I bought a cheap plastic box and got some wood to fit in the lid and bottom. To these the hardware was screwed and cable tied in order to keep everyone safe and to stop things moving around. The sockets were bought from a local hardware shop and supermarket and the relay from eBay. I also purchased a very cheap USB sound card as I found this gave much better sound output from the Pi.
- Christmas Tree providing the ‘drum beat’
- Blue ceiling lights for the ‘keyboard’
- Red fireplace lights for the ‘vocals’
- Smoke machine
Each of these were mains powered and were simply turned on/off at the right point in time with the music.
The smoke machine worked slightly differently in that it had to stay powered to heat the smoke liquid. This instead was activated by connecting a wire to its remote lead and using the relay to act as its switch at the right time.
How I would improve on this
Time was a big issue in this project. I worked on this on the run up to Christmas Day but the real programming and hardware building happened on the 27th – 30th. On these days the alarm was set for 6:30am just to work on this! Inevitably some things didn’t make it… I wanted to incorporate my LED Matrix Sign, having it say ‘Final Countdown’ every time it was sang as well as having it flash when the siren was activated. Additionally I did want some things to happen wirelessly using some other Raspberry Pi’s. For a start I wanted to suspend the inflatable guitars from the ceiling and have them release via servo on the guitar solo part of the song – that would have been really cool. Secondly I wanted to set off some lights in the other room using a small relay, but that also got the cut.
It’s been one of the most entertaining things I have made and people seem to really enjoy watching it so that’s what counts. It certainly set up our New Year’s Eve party!