A human-sized drum machine built with a Raspberry Pi, LEDs, and Go
This project is maintained by siggy
This is the story of building Beatboxer:
Around 2008 I saw Nine Inch Nails perform Echoplex using a drum machine that occupied the entire stage:
I loved it, I wanted to build something like it.
Eight years later in 2016 I had a converstion with my friend Nick about his Arduino integration into The Krawler’s fire poofers, he mentioned the lack of library and developer support being a pain point. He said he’d use a Raspberry Pi the next time, since it’s pretty much just a Linux computer. This caught my attention. It’s a UNIX system, I know this. That was the catalyst to look for an excuse to play with a Pi.
About a week after chatting with Nick, I attempted to replicate Nine Inch Nails’ drum machine on a web page, using as little code as possible. The result was a few hundred lines of JavaScript, HTML, and CSS, I called it Beatboxer:
This was a fun project, I learned a bit about AudioContext for playing sounds and requestAnimationFrame for timing.
Go has recently become a favorite programming language of mine. Rewriting Beatboxer in Go was a great excuse to play with the language a bit more.
Beatboxer transmits input from a keyboard to LEDs, a console renderer, and a drum loop. The Go language really shines here in allowing explicit definition of these concurrent threads, with communication via Go Channels. This whole architecture is summarized nicely in Beatboxer’s main.
Reading and playing back audio files in Go turned out to be more work than in JavaScript. I eventually found a pair of excellent Go libraries, youpy’s go-wav for reading wavs, and gordonklaus’ Go bindings for PortAudio for outputting sound.
I found an awesome collection of high quality drum samples at 99sounds.org. It’s free for download. Throw them a donation if you appreciate their work. I found their 808 beats to be just want I needed. I reached out to confirm they were OK with me using their samples in a public art project, Tomislav replied a few hours later with full support.
With a working prototype in Go, I returned to thinking about building a physical drum machine. Burning Man 2017 provided a concrete deadline for added motivation.
I began brainstorming a structure with my good friend @yet, who pointed out that a long, flat structure like the one used by Nine Inch Nails would not fare well in the gale-force winds of the Black Rock Desert. He suggested wrapping the drum machine into the shape of a phone booth, as a more compact structure would be much easier to build, transport, and support.
A few days later I described the project to my good friend Jhon. Jhon’s background in electronics and industrial design exceeds just about anyone I know, and he immediately suggested I reshape the phone booth as a pyramid. I loved the idea. At the time I did not realize the added complexity a shape like this would require, but in the end it was worth it.
To build a pyramid, I naively thought I could simply design four triangles, do some linear calculations for the angles, and all would fit together. Fortunately my good friend and owner of Three Bears Furniture, @jneaderhouser, pointed me to this excellent compound miter calculator. This helped me determine that, based on triangles 6 feet tall by 2.5 feet wide, I needed 46.244° side bevels and 77.975° base bevels. I was able to confirm this all worked by building Beatboxer in SketchUp:
For the full SketchUp file, click here.
As the physical form continued to coalesce, I knew I’d need buttons to enable beats, and LEDs to provide feedback. I began researching addressable LEDs. Like Go, this was another domain where I was looking for a personal project to enable learning more about. Arduino seemed to be the platform of choice for working with LEDs. I opted to build the project around a Pi, aware that I was going a bit against the grain.
Fortunately the amazing folks at Adafruit had a tutorial on controlling NeoPixel LEDs with a Raspberry Pi. Even more fortuitious, the library used in the tutorial, jgarff’s rpi_ws281x, came with a Go wrapper!
I cannot emphasize enough how helpful Adafruit is for projects such as these. Their tutorials and documentation are awesome, and they provide all the materials needed to follow along.
Controlling NeoPixels from a Pi requires building a circuit board, something I had zero experience with. I again enlisted @yet’s help to learn how to solder wires, chips, and resistors. In short order we had a Pi controlling NeoPixels.
The rpi_ws281x LED library uses hardware PWM on the Raspbery Pi to communicate with the LEDs. Unfortunately this conflicts with the Pi’s onboard sound card. To get around this, I disabled the onboard sound and installed a Plugable USB Audio Adapter. For more details on the config changes, have a look at the external sound card
section of this repo’s README.md.
For user input, I wanted to use 64 large buttons to toggle beats. The Pi does not have enough pins to handle this many without other chips or boards. I had read about hacking apart a computer keyboard and wiring buttons into it, via Instructables in two articles: Hacking a USB Keyboard and Create External Buttons For Your Keyboard. This was a compelling option, as the software was already built to accept keyboard inputs, no additional coding or GPIO programming required. It’s a fun hack, though wiring 64 buttons into a tiny keyboard PCB yields this tangle of epicness:
Determined to hack this keyboard, I again enlisted much soldering help from @yet to wire 30 pins from the keyboard pcb to an Adafruit perma-proto board. From there we wired up 64 combinations of the 30 pins. For those interested in the pinouts of an AmazonBasics Keyboard, have a look at this code.
In deciding on the material for the exterior of the pyramid, my friends @yet and Brian MF Horton suggested plywood, but a desire for transparent material, to allow LEDs to shine through from the inside, led me to plastic. In the end we built the base and a halo out of plywood, as an homage to this initial design, and our shared fondness for Tom Sachs’ Love Letter to Plywood.
I had no experience working with or manufacturing plastic. Fortunately, the good folks at TAP Plastics SF, and specifically my new friend at TAP, Jacobo, were extremely helpful in guiding me. I submitted the overall triangle dimensions for C&C manufacturing. The trickier part was producing those precise bevel angles so the triangles would fit together perfectly, and align with the ground. Jacobo took it upon himself to cut the bevels by hand. I had ordered up five triangles instead of four in case anything broke. I ended up with five perfectly shaped triangles. When put together, the four tops of the triangles fit with absolute precision, I cannot thank Jacobo and TAP enough for their work on this.
With software, electronics, and materials proven out, last was actual assembly. As with all the collaboration on this project, I simultaneously realized I needed help and found a friend extremely willing to jump in. My friend Brian, who could build a house if he had to, and had experience constructing things to withstand the elements at Burning Man, understood well before I did what was required to assemble Beatboxer. I showed up at his house expecting to ask some questions, and he had a complete internal skeleton designed, with materials sourced and ready to assemble. In one evening we went from plastic pieces to a sturdy pyramid. Brian built a complete internal structure out of PVC pipes, very strong and lightweight.
Without Brian’s help I would have assembled this thing with glue and tape and it probably would have collapsed on day one.
While helping me with bevel angles, my woodworker friend @jneaderhouser also advised me to build a prototype. I forewent this step in favor of SketchUp, concerned I did not have time for additional construction. One week before the event that decision came back to bite me. I had purchased 64 red arcade buttons to be mounted in the pyramid sides, which would toggle the beats. As I assembled Beatboxer for the first time, I quickly realized that the buttons were so deep that they collided on the corners of the pyramid. I needed shallower buttons, but the holes in the pyramid had been cut specifically for the diameter of these larger buttons. Again a friend, @oceanphoto, swooped in to save the day. He quickly 3D printed mountings to allow smaller buttons to fit tightly in the pyramid holes:
With all the pieces in place, my good friends Rob and @cecbayan provided some space on their trailer next to their insane riding-lawnmower-turned-tank, The Krawler, to transport Beatboxer from the Bay Area to the Black Rock Desert.
Upon arrival setup went surprisingly smooth. The awesome folks at The Artery guided us to our placement location. The rest of the week was spent swapping and charging batteries and speakers, which proved a bit more challenging due to Beatboxer getting a lot more use than anticipated (an exciting problem to have). In the end it was fully functional roughly 90% of the week, with outages only due to batteries. The structure, buttons, and electronics held up to the elements.
2017 and 2018, respectively:
I originally set out to build Beatboxer on my own, to see if I could, and also because I did not want to burden friends who already had amazing projects on their own plates. Though I quickly found that I was in way over my head, I fortunately also found folks who were extremely willing to get involved. Without everyone jumping in, there is no way this project would have happened. I cannot thank everyone enough.
As I learned to work with LEDs, I found opportunities to work with other artists to help light their own projects. While Beatboxer used about 300 LEDs, these projects demanded a bit more. Applying the same powering methods to these larger projects resulted in some melted electronics, necessitating a power redesign. Fortunately my friend Tom quickly provided a wiring diagram to overcome these power issues:
To download the source Fritzing shareable sketch file, click here (requires the Adafruit Fritzing Library). To view this project directly on the Fritzing site, head over to the NeoPixels on Mutant Vehicles project at fritzing.org.
With additional components and design complexity, my friend @oceanphoto jumped back in and 3D printed some awesome enclosures to keep everything safe from the elements, and even included ethernet ports to be able to update the Pi without opening the enclosures:
Another requirement for these projects was faster boot time. With vanilla Raspian I was seeing 30 second boot times. This was fine for Beatboxer where it was left running all night, but too long for a mutant vehicle that should be illuminated as soon as possible when it’s turned on. I switched to Raspbian Lite and disabled as many services as I could, eventually getting boot time down to around 7 seconds. For full details on these config changes, have a look at the First Boot section of this repo’s README.md.
With power and boot time sorted, we were ready to apply these LEDs to three more projects.
The Krawler is Rob and @cecbayan’s riding-lawnmower-turned-tank. It also shoots fire from eight poofers mounted on top. Here we added 480 LEDs along the bottom frame in a streak-like pattern, to highlight some of the amazing manufacturing and engineering that went into this vehicle.
The Crane of Remembrance is a 15-foot tall replica of a Port of Oakland crane, and a tribute to the victims of the Ghost Ship Fire. Our friend Rob is an Oakland firefighter, and was onsite during the incident. He inspired our group to build the Crane. The lighting included 540 LEDs, 240 in a beating heart, and 300 in two strands extending across the top. The heart beats at 36 BPM, and the strands display 36 lights at a time, one for each person lost in the fire.
The Fish is Brian’s mutant vehicle, built on top of an airport luggage carrier. This year was the Fish’s tenth year at Burning Man. This turned out to be the most ambitious lighting project, involving 2040 LEDs, all mounted in its four fins. Each side fin alone has 720 LEDs, and the top and back fins have a combined 600. Painting with LEDs on a canvas like this turned out to be quite a thrill:
Thanks for reading. If you have any questions or comments, you can file an issue against this repo in Github, or just hit me up on Twitter at @siggy.
Published 2017.10.02. Updated 2019.05.17 with 2018 content.
If you are interested in seeing Beatboxer in person, it will be on display Saturday, 2017.10.14 at SF Decompression. Come say hi!