Upcoming and OnDemand Webinars View full list

Hacking Arduino Firmata with NeoPixels

Jay Hayes

We recently had our annual app-building competition, Clash of the Coders.
It’s a fantastic opportunity for us nerds to experiment with unfamiliar
technologies, stretching ourselves and our tools. It’s all about learning, a
fundamental value of Big Nerd Ranch. After an intense 72-hour coding marathon,
our team (The Artists Formally Known As (╯°□°)╯︵ ɥsɐןɔ, yep) came out with
an online, multiplayer game equipped with clients crossing four platforms: iOS,
Android, Web… and Arduino!

The Clash

Our project was a great opportunity to get familiar with hardware. Thanks to
the kindness of fellow nerd Chae O’Keefe, we had plenty
of Arduino hardware and the brilliant idea to incorporate
individually addressable NeoPixels, maximizing the aesthetic of our
physical client 😄.

arduino client

Eventually, we settled on using Artoo, a robotics framework written in
Ruby, to communicate with the Arduino. We chose it because of our familiarity with
Ruby (and by the time we got around to working on the Arduino client there was
only seven hours left in the competition).

Unfortunately, we quickly hit a showstopper. Artoo communicates with Arduino
hardware using the Firmata protocol. Firmata doesn’t have support
built in for NeoPixels.

So the adventure began…

Serial for Breakfast

In the early hours of the last day of our competition, we began peeling back
the layers of software used to communicate between Artoo and Firmata. We
quickly figured out that communication with Firmata is done with specially
formatted serial messages containing command bytes. These bytes indicate the
purpose of the message, such as a write to a digital pin.

gh screenshot

Thankfully, the Firmata designers had the forethought to consider others’
desires to extend the protocol. This is accomplished via SysEx messages,
interestingly part of the MIDI standard. By defining custom
SysEx commands, we were able to send special messages to Firmata which were
received, triggering routines to setup and control NeoPixels!

Hack on!

We had an absolute blast this year! If you’re interested in the nitty gritty
details, check out my upcoming post, out next week. And don’t forget to show us what you make in the comments below!

Not Happy with Your Current App, or Digital Product?

Submit your event

Let's Discuss Your Project

Let's Discuss Your Project