An Adventure in Hacking Arduino Firmata with NeoPixels

Jay Hayes

2 min read

Apr 1, 2015

An Adventure in Hacking Arduino Firmata with NeoPixels

Learn ALL the things! That’s basically the motto at Big Nerd Ranch. And in my last post, I wrote about how my team, The Artists Formally Known As (╯°□°)╯︵ ɥsɐןɔ, learned a lot of new things when we tackled hardware hacking with Arduino, NeoPixels and Artoo.

Arduino is a great platform for beginning to learning about hardware. If you’re into Ruby, you
might checkout Artoo, a robotics framework supporting a myriad of
platforms, including Arduino. During our Clash project, my team and I wanted to use Artoo
with NeoPixels, but there was no integration.

So we fixed it!

learn all the things


We packaged our integration between NeoPixels and Artoo into a rubygem
for your hacking convenience.


First, you need to prepare the Arduino by uploading our custom Firmata. This extends the Standard Firmata to add protocols for setting up and
communicating with NeoPixels. To get started:

  • Open the Arduino IDE.
  • Copy the custom Firmata from Github.
  • Upload it to your device.

arduino ide

If you need more help with setting up the Arduino, check out [their guides][arduino-guides].


Next, install our gem. This extends Artoo with support for NeoPixel LED strips
and matrices.

$ gem install artoo-neopixel

Blinky Lights

Now you just need to write something magical. Here’s an example script for a
NeoPixel 40 RGB LED Matrix that will light up your room:

# example.rb
require "artoo"
require "artoo-neopixel"

# Update the below port with your device's port
ARDUINO_PORT = "/dev/cu.usbmodem1411"

connection :arduino, adaptor: :firmata, port: ARDUINO_PORT


  driver: :neomatrix,
  pin: 6,
  width: MATRIX_WIDTH,
  height: MATRIX_HEIGHT,

work do
  # You should see a bunch of blinky, beautiful lights! WOWOW
  loop do
    # Generate some random coordinates
    x = (MATRIX_WIDTH * rand).round
    y = (MATRIX_HEIGHT * rand).round

    # Generate some random RGB values between 0 and 100
    red = (100 * rand).round
    green = (100 * rand).round
    blue = (100 * rand).round

    matrix.on(x, y, red, green, blue)

    # the matrix sometimes need a little time to keep up
    sleep 0.01

Run it and enjoy!

$ ruby example.rb

If you’ve played with Artoo at all, this will be completely familiar to you.
Either way, there isn’t too much going on here, but the resulting strobe of
blinky colors is quite satisfying!

Hack on!

We’re thankful to be able to open source this work. If you catch any gaping
memory leaks or anything at all, feel free to open an issue.

What will you make? Show us in the comments!

Angie Terrell

Reviewer Big Nerd Ranch

Angie joined BNR in 2014 as a senior UX/UI designer. Just over a year later she became director of design and instruction leading a team of user experience and interface designers. All told, Angie has over 15 years of experience designing a wide array of user experiences

Speak with a Nerd

Schedule a call today! Our team of Nerds are ready to help

Let's Talk

Related Posts

We are ready to discuss your needs.

Not applicable? Click here to schedule a call.

Stay in Touch WITH Big Nerd Ranch News