
SensorBox
While I’m a sort of reluctant Arduino user, I often use them for classes and workshops that I teach because they’re pretty easy to get started with and cheap. Lately, I’ve been a bit disillusioned though with the firmware examples available for using the Arduino with MaxMSP, and wanted to remedy that. I found that most of my students just wanted an easy way to connect sensors and switches to an Arduino and have that show up in Max. While the Firmata firmware is very well designed and offers a lot of features, I have been frustrated too many times by not being able to fix bugs in the code myself. Also, the reliance on the “arduino” abstraction has led to all sorts of problems with students who haven’t learned about file dependencies and search paths in Max.
My solution was to write a very simple and relatively efficient firmware called SensorBox that just gets the input from all the pins on the Arduino and sends it over serial to a Max patch. The communication protocol is hardly innovative, but it should give a good example of ways to efficiently transmit data over serial. The goal was to make everything simple and readable, and to avoid any voodoo, so that others can alter and fix the code as they please.
Also, since many real-world projects require more than 6 analog inputs, I wrote an alternate version of the SensorBox firmware called SensorBoxMux that allows you to configure any analog pin(s) for multiplexed input with an inexpensive 4051 8×1 IC. This offers the potential for up to 96 analog inputs on Arduino!
Download SensorBox firmware and Max 5 patches.