Golan Levin and Collaborators

Flong Blog + News

Installing Arduino with Firmata for MaxMSP and Processing in OSX

8 July 2010 / code, external, reference

Firmata is a library which allows environments like Processing and MaxMSP/Jitter to communicate with the Arduino microcontroller over USB. More specifically, Firmata allows these environments to treat the tethered Arduino as a transparent interface board for communicating with sensors and actuators. This means that students learning MaxMSP or Processing can execute a reasonable subset of physical computing projects without ever having to program the Arduino itself (so long as their Arduino board has been programmed, once, with Firmata).

This blog post gives instructions for how to get Firmata working with both Processing and MaxMSP on Mac OSX 10.6.3. The information is current as of 8 July 2010, but is naturally certain to change. The context for this blog post is that I’m working with my university’s Computing Services staff to develop an administrator’s disk image for some new Macs that have just arrived. I prepared the information below for this crew, who are talented IT professionals that happen not to have domain expertise in arts-computing platforms. To the best of my knowledge, this information has not yet been compiled in any one place, but is rather distributed around the Internet in too many pages, some of which are out of date. I welcome comments and corrections.

————————————————————————————-

The specific list of 8 installation packages are as follows.
Detailed instructions for installing and testing these packages
can be found in the sections below.

  1. Arduino IDE version 0018: arduino-0018.dmg
  2. Drivers for Arduino boards: FTDIUSBSerialDriver_10_4_10_5_10_6
  3. Firmata version 2.1+ for Arduino: firmata.tar.gz
  4. Max/MSP/Jitter 5.1.3 or later: e.g. Max5_42462.dmg
  5. OSC-route external library for Max: OSC-route_1.17.1.tar.gz
  6. Maxuino library for Max v.009: maxuino-009.zip
  7. Processing version 0186, processing-0186.dmg.
  8. Arduino for Processing library, processing-arduino-0017.zip.
————————————————————————————-
Installing Arduino:

Overview of instructions below:

  • Install Arduino programming environment
  • Install FTDIUSBSerialDriver, a serial driver for Arduino boards
  • Install Firmata extension library for Arduino
  • Test Arduino installation

Installing the Arduino IDE:

Install the FTDIUSBSerialDriver v2.2.14:

  • This is a crucial serial driver for Arduino devices.
  • Make sure the Arduino app is not running.
  • Double-click on arduino-0018.dmg;
  • You will see a yellow package, FTDIUSBSerialDriver_10_4_10_5_10_6
  • Click on the package and follow the instructions.
  • You will need to enter the administrator password.
  • To check this installation, launch the Arduino app;
  • From the menu bar, navigate: Tools->Board->…
  • You should see a list of about a dozen different Arduino boards.

Installing the best version of the Firmata (2.1+) library for Arduino:

  • Make sure the Arduino app is not running.
  • In Applications, Right-click on the Arduino app, “Show Package Contents”
  • Navigate to (Arduino)/Contents/Resources/Java/libraries
  • You will see a library entitled “Firmata”. We want to replace this, so delete it or move it somewhere else.
    (Note: this replacement will not be necessary in Arduino-019 and later versions)
  • Download http://maxuino.org/wp-content/uploads/2010/02/firmata.tar.gz.
  • Replace the “Firmata” library included with Arduino-018 with this downloaded version.
  • Note: this downloaded version has the same release number (2.1) but is improved.
  • To check this installation, launch the Arduino app;
  • From the menu bar, navigate: Sketch->Import Library->Firmata
  • In the text area of the sketch, you should see two lines:
    #include <Boards.h>
    #include <Firmata.h>

Testing the installation of the Arduino IDE:

  • Obtain an Arduino Duemilanove board and USB cable.
  • Connect the Arduino board to a USB port.
  • Launch the Arduino app.
  • Open the “Blink” example:
  • Navigate from the menu bar: File->Examples->Digital->Blink
  • Choose the appropriate board:
    Navigate the menu: Tools->Board->”Arduino Duemilanove or Nano w/ ATmega328″
  • Guess and select the serial port on which the Arduino board is connected:
    Navigate the menu: Tools->Serial Port->/dev/tty.usbserial…
    (Note: you may need to test several different serial ports…)
  • Navigate: Sketch->Verify/Compile
  • Navigate: File->Upload to I/O Board
  • The Arduino board should twinkle briefly;
    then it should Blink on/off once per second.

————————————————————————————-
Installing Max/MSP/Jitter with Firmata:

Overview of instructions below:

  • Install MaxMSP/Jitter
  • Install OSC-route “external” for MaxMSP
  • Install Maxuino library

Install MaxMSP/Jitter:

Installing OSC-route, an external for MaxMSP

Installing Maxuino, a library for MaxMSP:

  • From: http://www.maxuino.org/?p=58
  • Download: http://www.maxuino.org/wp-content/uploads/2010/04/maxuino-009.zip
  • Unzip maxuino-009.zip
  • Drag the unzipped folder maxuino-009 into the Applications/Max5/ application folder, at the same level as the “Cycling ’74” folder, etc.
  • Launch the MaxMSP app.
  • Now we will add Maxuino to the MaxMSP Search Path:
  • Navigate the menu bar in MaxMSP: Options->File Preferences…->
  • Click the + sign at the bottom left of the File Preferences window; this adds a new path.
  • Press the “Choose” button and select the maxuino-009 folder.
  • Make sure the checkbox in the Subfolders column is checked.
  • Double-click on the “userpath_3” name, and change it to “Maxuino”
  • Close the File Preferences window and quit the MaxMSP app.
  • Instructions for testing the Firmata bridge to MaxMSP are below.

————————————————————————————-
Testing the Firmata bridge from MaxMSP to Arduino

First, in Arduino:

  • We assume you have installed and tested the Arduino IDE as described above.
  • With the Arduino board connected to a USB port, launch the Arduino app.
  • Check that the board type is correct: Tools->Board->”Arduino Duemilanove or Nano w/ ATmega328″
  • Check that the USB port is correct: : Tools->Serial Port->/dev/tty.usbserial…
  • Open the example program, File->Examples->Firmata->StandardFirmata
  • Navigate: Sketch->Verify/Compile
  • Navigate: File->Upload to I/O Board
  • The Arduino board should twinkle briefly….

Then, in MaxMSP:

  • Double-click “MaxMSP” to launch the application.
  • Navigate the menu bar in Max/MSP: File->Open….
  • Open the Max patch file:
    Applications/Max5/maxuino-009/examples/maxuino-example-GUI.maxpat
  • For the next instructions, please refer to the attached image, “max-test-firmata.png”
  • You will see a dark green window, with a light green section called “Digital Pins”
    on the right half of the screen, with pins numbered from 0…53.

  • In this section, find Pin 13, which is under the “3” to the right of the large “10”.
  • Click on the little white box which says “in”; this will reveal a small pulldown menu.
  • Using this menu, set Pin 13 to become an output instead of an input.
  • Now click the gray button labeled “out” which is two buttons below the white button.
  • The button will turn yellow and report “OUT” in all-caps;
    Meanwhile, the orange LED on the Arduino will light up.
  • Clicking on the “OUT” button once again will turn off the Arduino’s LED.

Possibly helpful additional web pages:
http://www.cycling74.com/docs/max5/vignettes/core/file_preferences_window.html#searchpath
http://www.soundplusdesign.com/?p=1305
http://www.maxuino.org/?p=58

————————————————————————————-
Installing Processing with Firmata:

Overview of instructions below:

  • Install Processing development environment
  • Install Arduino for Processing extension library
  • Check that the library is installed.

Install “Processing” version 0186:

Instructions for installing “Arduino for Processing” Library:

  • After installing the Processing app in the Applications directory,
  • Make sure the Processing app is not running.
  • From: http://www.arduino.cc/playground/Interfacing/Processing
  • Download: http://www.arduino.cc/playground/uploads/Interfacing/processing-arduino-0017.zip
  • Right-click on the Processing app, to “Show Package Contents”
  • Navigate to (Processing)/Contents/Resources/Java/libraries
  • Unzip “processing-arduino-0017.zip”, which produces a folder called “arduino”
  • Drag the “arduino” folder into the “libraries” folder. It will be at the same level as “dxf”, etc.
  • Now we will put the “Arduino examples” in the correct place:
  • Create a new folder in (Processing)/Contents/Resources/Java/examples/Library/ called “Arduino”.
    You should now have: (Processing)/Contents/Resources/Java/examples/Library/Arduino
  • Open (Processing)/Contents/Resources/Java/libraries/arduino/examples
    You will see 3 folders, for “arduino_input”, “arduino_output”, “arduino_pwm”
  • Drag these 3 folders into (Processing)/Contents/Resources/Java/examples/Library/Arduino.
  • To check this library installation:
  • Double-click “Processing” to launch the application.
  • In the menu bar, navigate to Sketch->Import Library….
  • In the resulting pulldown menu, you should now see: arduino among the other libraries.
  • Navigate the menu bar: File->Examples->Library->Arduino
  • You should see “arduino_input”, “arduino_output”, “arduino_pwm”.
  • Instructions for testing the Firmata bridge to Processing are below.

————————————————————————————-
Testing the Firmata bridge from Processing to Arduino

First, in Arduino:

  • We assume you have installed and tested the Arduino IDE as described above.
  • With the Arduino board connected to a USB port, launch the Arduino app.
  • Check that the board type is correct: Tools->Board->”Arduino Duemilanove or Nano w/ ATmega328″
  • Check that the USB port is correct: : Tools->Serial Port->/dev/tty.usbserial…
  • Open the example program, File->Examples->Firmata->StandardFirmata
  • Navigate: Sketch->Verify/Compile
  • Navigate: File->Upload to I/O Board
  • The Arduino board should twinkle briefly….

Then, in Processing:

  • Double-click “Processing” to launch the application.
  • Navigate the menu bar: File->Examples->Library->Arduino
    You should see “arduino_input”, “arduino_output”, “arduino_pwm”.
  • Open the example project “arduino_output”.
  • Navigate the menu bar: Sketch->Run
    You will see a small blue window with 14 boxes.
  • Click the leftmost box while observing the Arduino board.
    The Arduino’s LED should light up.
  • Click the leftmost box again.
    The Arduino’s LED should turn off.


Comments are closed.

« Prev post:
» Next post: