New Year’s Cherry (1/1/2017)


Idaho is kind of weird. I’m just going to open with that to avoid a lengthy explanation. In a nutshell, the big thing in Boise for New Year’s is the “Potato Drop.” Think the New York ball drop, but with a potato and probably more pride for tubers than you’ve ever seen. A smaller town outside of Boise wanted to do something different, so they started doing the “Cherry Rise” in 2016. This whole thing probably makes at least a little more sense now.

For the second year, the plan was to make everything more reliable, add more lights, and add a confetti cannon inside the cherry. Oh, and the whole thing needed to be done on a shoestring budget. My task was to write the cherry’s software to control and coordinate everything. Everything was built around a Raspberry Pi from the year before, and there was a countdown clock on the cherry that was made from circuits of Christmas lights glued into laser cut plastic panels. For the year before, everything worked but it needed a lot of careful handling, and was limited to the countdown clock and a few lights.

The first thing I wanted to do was rewrite all of the code and clean things up, so I wrote out everything that the cherry needed to do, and started with the countdown clock. Everything was in Python, and at this point I was competent enough to write decent code. Since the countdown clock was essentially two seven-segment digits driven by a relay board, one relay per segment, I figured it would be easiest to write a class to enumerate the GPIO pins that needed to be used to trigger the relays that lit up each digit. Calling a digit returned a list of pins that could then be set to high, turning on the desired number. After some debugging and putting wires back in the correct places, it worked well enough that I could move on to the next part and come back later if there was time.

The next thing to do was figure out how the lights on the outside of the cherry worked. They were web lights that had one button on a control box that changed the lights’ pattern, and then just turned on when power was applied. Luckily, they didn’t have persistent memory so turning them on made them run the first pattern instead of the last one they were set to. Two more relays connected to the GPIO pins gave control of the lights, and let you progress forward through the patterns. This was much easier than the countdown clock, since I didn’t implement any complicated control logic. There was just a class for the lights with methods to turn them on/off, and to change the pattern.

For the confetti cannon, the other team members decided to modify a leaf blower to suck in confetti from a bag, and blow it out through the cherry stem, so all I needed to do was turn it on and off. This was probably the easiest task, since it just required setting a variable for a relay connected to another GPIO pin.

With all of the components put together, I tied it all together in a main method, and added a feature so that the cherry could automatically start its countdown sequence 10 seconds before midnight on the day it was turned on, as long as it at least momentarily had an internet connection to sync the time with. A real time clock module would have probably been a good idea to add, but nobody thought of it at the time. As a backup, there was also a button that could be pressed to trigger the countdown sequence if there was either no internet connection, or if the automatic timer failed, but we also used it for testing to make sure everything worked. There’s a video below of me testing the countdown with a drill press instead of the leaf blower.

 

Previous
Previous

3D Printer Vacuum Bed

Next
Next

Rotary Steam Engine