Blink’n’Beat – Arduino Beat Sequencer

Anyone who gets started in electronics with Arduino is probably going to learn to blink an LED. A few years down the line, I still like blinking LEDs! I’ve also discovered various ways to create sounds on chip, including the tone() function, resistor ladders, and the MOZZI synth library (which is worth checking out). Of course, blinking lights, and making sounds at the same time is even better. But what if I could program a drum beat, synchronize a light to it, and then play a tone on top of it without even using buttons? THAT would be pretty cool!


  • Arduino Uno
  • Conceptinetics DMX shield (optional, only if you want the DMX light)
  • a DMX compatible light (again, optional)
  • breadboard
  • various resistors, LEDs, and pushbuttons
  • a speaker with an 1/8 inch male audio jack
  • alligator clips
  • wire, soldering iron, solder, patience

Screen shot 2015-12-12 at 3.04.37 PM

The black wire is the ground for the touch sensors. The white wires are the human half of the resistor-divider based touch system similar to that of the Makey Makey.
Because I lacked any sort of 1/8 inch audio connector I just soldered some solid core wire to alligator clips and hooked onto the appropriate sections of the male headphone connector into my speaker.

This project can be divided into three components: a sequencer, a synthesizer, and a DMX output section.

The sequencer records the time at which each instrument’s button is pressed over a time duration into an array. The tap method is used to set the tempo, wherein a button is pressed a few times, the average time between presses recorded and a stable beat generated.

The synthesizer section is based off the amazing(!) Mozzi audio generation library. All I did was configure Mozzi, load wavetables for a snare and kick drum, and write a loop to access the sequencer array and see if it was time to start playing the sample.

DMX is one of the industry standard communication protocols for controlling theater and DJ equipment. It’s basically serial with some level shifting and can be sent through several types of cables, including standard 3-pin XLR cable like for a microphone, depending on which Arduino Shield you use. The DMX code functions similarly to the synthesizer section; a loop is used to check if a kick or snare note is being played and turns the light on for a short time if so.
NOTE: Whether it’s my cheap DMX light or the library, somehow the bits encoding the channel value are being sent/interpreted backwards, so I wrote an RBO() (Reverse Bit Order) function that manually reverses the bits before sending them to the fixture.

The code is worth a read; in addition to the 3 components, there’s also a Button object (not really, it’s actually a struct) that handles debounce timings and a windowing function for the resistor dividers.

Code and Fritzing:

Leave a Reply

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

Time limit is exhausted. Please reload the CAPTCHA.