Arduino USB - getting it running on OSX with Pd and Max/MSP
Arduino is “an open-source physical computing platform based on a simple i/o board and a development environment that implements the Processing/Wiring language. Arduino can be used to develop stand-alone interactive objects or can be connected to software on your computer (e.g. Flash, Processing, MaxMSP).”
A good starting point is to read the Arduino HOWTO webpage - also available as an offline page in the Arduino IDE Help menu > HOWTO.
Then, following the HOWTO instructions, do the following:
- first, install the FTDI Virtual Com Port drivers (v2.1.6) for Mac OS X from FTDI’s website
- download the Arduino IDE software
- run the macosx_setup.command in the Arduino software folder
- connect the Arduino and run the IDE software
- select the correct serial port in the IDE Tools > Serial Port menu. For the USB version, for me, I used /dev/cu.usbserial-1B11. I left the Serial Monitor Baud Rate at the default 9600. Note: apparently, “the tty’s are for incoming (to the system) calls; the cu’s are for outgoing (from the system) calls (”cu” == “call unix”);”, according to this mailing list post. A further note, from GPSBabel, is that (at least for their software), using the tty port “will block trying to open the serial port and the only solution will be to unplug the adapter.”
- reset the Arduio (using the small reset button on the board)
- open and upload the firmware of choice
And that was it.
Arduino interface software
The main application of interest to me is using Arduino as a (nice and cheap) sensor interface - to read external sensor analog and digital inputs into other software environments.
For this purpose, I tried Pduino, SimpleMessageSystem and Gomalab solutions, all linked from the Arduino Playground Pd interface page. Gomalab didn’t seem to come with any firmware, so I didn’t investigate further at this stage.
Pduino interface for Pd
I loaded Hans Christof Steiner’s Pduino firmware, then the arduino-help patch for Pd. I modified the patch to set the comport device to the correct /dev/cu.?????? port, then clicked the relevant parts of the patch and saw numbers coming from the analogue ins of the arduino.
For the latest version of Pduino firmware, go to the sourceforge page here. Unfortunately, the v1.14 firmware didn’t work for me - it made all analogue inputs move continually (with apparently random data), even if I’d only selected one of them in the patch. So for now, I’m sticking to the older firmware on Hans’ website.
SimpleMessageSystem
SimpleMessageSystem firmware has interfaces for Pd, Max/MSP and Processing. Make sure you get the latest version of the library from Thomas Ouellet Fredericks’ code webpage. I was able to get the Max version going easily, just by changing the port number argument in the serial port object to suit my system - trying each number and watching the Max console to see which device it mapped to, until I found the Arduino’s usbserial device. For Pd, I found that on OSX, I had to load the correct comport device name with a loadbang (using the object: “devicename /dev/cu.usbserial-xxx”), otherwise I couldn’t get output from comport (a strange issue, i know). Other than that, SimpleMessageSystem made it easy to use the Arduino as a sensor interface, getting analog data out in both Max and Pd.
some other arduino links
- NekkosStuff’s (unnamed) Art Installation page
- Another nifty project is Todbot’s quick and dirty breadboard prototyping “shield” (daughterboard), described on his blog here.