Using Arduino, Firmata and Processing Together

Even with the power of a real ATmega328P microcontroller running at 16MHz, the 32Kb of memory space on an Arduino is not enough for larger projects. It would be great if we can harness the power of our PC to do the complex processing while the Arduino can be the platform for the sensors and motor controls. In this configuration, you can do much more, the only draw back is you do need to keep your PC tethered, by USB or Wifi. For some applications this is fine and preferred. In those cases, Firmata is one solution you can use to make this very simple.


Firmata is a generic protocol for communicating with microcontrollers from software on a host computer. It is intended to work with any host computer software package.


In essence it turns your Arduino into a slave with a simple provided sketch. Then using the Processing platform you can interface the Arduino via Serial bus and exposed API provided by the Firmata system. Firmata takes the leg work out of designing a custom software protocol layer any application will need to interface between the Arduino and PC, it does it for you.

Getting Started

First we must slave the Arduino:

1. Connect the Arduino board to the PC and open up the Arduino software.

2. Upload the sketch StandardFirmata from Examples/Firmata.


3. If you have an older Arduino, add a LED to pin 13 if you have a newer one you will already have a surface mounted LED to use.

Now we set up the processing environment:

1. First you need to download the Processing library.

2. Then unpack the compressed file and then copy the folder arduino to your Documents, libraries within your Processing Sketchbook folder.

3.Run the following code in Processing:

import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
int ledPin = 13;

void setup()
arduino = new Arduino(this, Arduino.list()[0], 57600);
arduino.pinMode(ledPin, Arduino.OUTPUT);

void draw()
arduino.digitalWrite(ledPin, Arduino.HIGH);
arduino.digitalWrite(ledPin, Arduino.LOW);


Now that we have both systems connected, there is  no need to compile and upload to the Arduino anymore.


In fact you can close the Arduino program and work exclusively in processing. This is just a simple test but establishes the base connection and work required before complex systems can be developed.

Here is the Arduino in mid blink.



I did run into an issue where the processing program refused to run. I got an ugly error message:

Exception in thread "Animation Thread" java.lang.IllegalAccessError:
 tried to access class processing.core.PApplet$RegisteredMethods from class cc.arduino.Arduino$SerialProxy

After some searching I found a thread that mentioned they too had this issue and it seemed to be related to a corrupt install of the Arduino library. A fresh install of the Arduino library folder fixed it for me.


8 thoughts on “Using Arduino, Firmata and Processing Together

  1. Pingback: Class 11 | Interaction Lab

  2. Pingback: DDV: comunicación Processing – Arduino | Wiki CMMAS

  3. So the Arduino library for Processing does not support the Arduino Mega and I was attempting to rewrite it but I have no idea what I am doing.

    Any chance that anyone else has already done this or could lend some help?
    I only need to read digital inputs if that helps.

    • Hi itbmac, sorry didn’t see this post until now.

      Processing itself has been around longer than Arduino. It was designed to allow designers access to code simple interactive demos/games. Processing itself is a platform to create programs to run on your desktop.

      Arduino took the Processing language and framework and extended it to the microcontroller.

      They look alike. In fact the only real difference to both versions is the color of the interface. One is more blue/green the other brownish.

      So, here you download and install Arduino software from their site (green/blue). This will let you write code into the chip of the Uno or other board you purchased.

      Firmata in this case provides a tiny sketch for you to copy and paste into the Ardunio software, download into the chip and save.

      Then fire up Processing on your desktop. Here Firmata also provides a simple program that will run on your desktop, and via serial connection (USB) will send commands to the sketch running on the Arduino chip.

      Think of the Processing as the puppet master and the Arduino the puppet.

      You need to install Arduino code into the Arduino board and Processing is only for your desktop applications.

      – Arduino -> microcontroller application

      – Processing -> Destkop application

      Hope this helps 😉

  4. Can i program my arduino over internet using processing software???? I need it in one of my project to program my arduino over internet..!!
    Thanks in advance..!!!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s