Howto: Arduino + Firmata = Easy Hardware!

I’ve been playing with microcontrollers for over a decade now, and have hands-on experience with PIC, ARM, 68HC11, and MSP430 devices.  Usually, it’s a long slow road where you (1) pick a processor to buy, (2) pick a device programmer, (3) pick a compiler, (4) read the processor documentation, (5) find/fix example code until it compiles, (6) program the chip, (7) figure out why the lights aren’t blinking.  It’s usually very painful, takes a few days at the very least, and every new task or chip is just more work.

But this is easy!

  1. Buy an Arduino Uno R3 for about $30.  Lots of places have the hardware, including Amazon (and cable) or SparkFun (and cable).  The cable is an ordinary USB A to B cable, with the thick square end like on most USB printers.
  2. Download and unzip the Arduino 1.0 IDE.  (On Linux, you’ll also need to “sudo apt-get install gcc-avr avr-libc” to get the compiler.)
  3. Open the IDE’s “Drivers” folder.  Right click “Arduino UNO R3.inf” and hit “Install”. Plug in the Arduino, and it should show up as a serial port (something like COM3 or /dev/ttyUSB0.)
    1. The very similar Arduino Duemilanove 2009 board doesn’t need drivers; it shows up as an ordinary FTDI USB to serial device.
  4. Start up the IDE by double clicking Arduino.exe, and:
    1. Choose File -> Examples -> Firmata -> StandardFirmata.
    2. Hit File -> Upload.  The TX and RX LEDs will flicker as the device is programmed.
    3. The Arduino now responds to the serial Firmata command protocol.
  5. Download the Firmata Test Program, run it, and choose the “Port” from the menu (like COM3 or ttyUSB0.)
  6. Click pin 13 on and off, and watch the LED blink!  You can set any pin to input (reading low or high voltage) or output (producing low or high voltage), and many pins have other functions available like analog input, PWM(pulse width modulation), or servo control.  Just click and drag to interact with all the pins!
    Pin descriptions for Firmata connected to Arduino.
    Firmata Test showing all the pins for a live connected Arduino.

The beautiful thing about this is you don’t have to figure out how to enable analog inputs, initiate ADC conversions, correctly set the PWM control registers, or set interrupt modes–it’s pure plug and play!

2 thoughts on “Howto: Arduino + Firmata = Easy Hardware!”

  1. I have tested firmata on Arduino Duemilanove, it doesn’t work well as expected. But other board like UNO does work. I doubted if Arduino Duemilanove has enough RAM to support Firmata.

    And the firmata for Arduino calls malloc() without free().

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>