praxworld.com Electronics, music, electronic music! general geekery

5Mar/120

Handy Maxuino abstraction

If you like making Arduino talk to MaxMSP, there are few things as nice and simple as Maxuino. A while back I wrote about using Maxuino and Firmata, and included my own patch which I unfortunately named "Maxuino simplified". Looking at it now, it doesn't really simplify anything! It did help me with understanding how to use Maxuino, but that's about it. As I bust out my Arduino once again, I have done a bit of work to actually simplify using Maxuino in my patches (see the bottom of this post for the MaxMSP code). I encapsulated Maxuino into a patcher that you can load into a bpatcher object. The inlet accepts OSC messages to Maxuino, the output spits out messages from Maxuino. From the panel you can select a COM port and activate the Maxuino example GUIs since they do come in handy. Here is an action shot:

Another thing I do is use a coll to initialize my pin modes. Put your pin mode settings into the coll using this format:
1, /0/mode 1;
2, /38/mode 2;
3, /39/mode 2;

Connect the coll to the inlet of the Maxuino bpatcher and send a dump message to the coll.

Here is the MaxMSP code (copy to clipboard, open Max, select File, Open from clipboard). Be sure to install Maxuino into your Max search path.

Filed under: Arduino, MaxMSP No Comments
5Mar/120

Introducing the Middle-Aged Engineering Grum-P-Lab

If you like the idea of controlling music and other stuff using sensors, then you will probably love the Oplab from Teenage Engineering. It's a really smart, inspiring piece of kit which takes physical input (taps, gestures, pressure, shaking, etc.) and outputs the resulting signals in USB, MIDI, and even control voltage, which you can plug in to your favorite electronic instrument or software. I love the idea of Oplab, but I can't justify spending $300 on it. I figure I can create a microcontroller-based sensor-oriented I/O system with an eye toward modularity, expandability, and ease of use. I'm thinking that once the initial work is complete, it should be something I can just reach for and use with a minimal amount of fiddling around.
For a microcontroller, I chose the Teensy++ over Arduino. It's also AVR-based, it's got more pins, it's native USB/HID/MIDI, it's smaller (fits on a breadboard) and it's cheaper. You can even program Teensy boards using the Arduino software if the C language isn't your thing. You can pick up a Teensy for a measly $16, $24 for the Teensy++. The regular Teensy actually has a few more analog ins than the Teensy++ so that's one thing to consider.
As for the sensors, I put together an assortment of items including a piezo disc for a percussion sensor, a pressure-sensitive resistor pad, an accelerometer, and an ambient light sensor. Those should be a good starting point. To make it modular, I am using standard 3.5mm audio connectors to connect the sensors. For cables I picked up some 3.5mm male to male connector cables (the kind you use to hook your iPod to a stereo). I'll cut those apart, and solder the sensors on, probably with some heat-shrink to make everything tidy. This approach will also transition nicely to an enclosure should that stage be reached. For now, everything takes place on a breadboard, which the Teensy++ plugs directly into. Since Teensy supports USB, you don't need to fuss with a power supply (of course it can run on batteries if needed).

What a nice collection of items! If only I had some sort of special container to store it all in, like maybe a tray or something.
In terms of software, my first choice is MaxMSP and the Maxuino library. Maxuino requires the Firmata library to work. I wrote about this a while back: Interfacing MaxMSP and Arduino. In a nutshell, you load Firmata onto your Teensy (or other Arduino-compatible). Maxuino communicates using the OSC protocol, and facilitates I/O from within MaxMSP. My initial step is to make sure Teensy works by following the instructions here. I got a blink, so far so good!!! Next step: get a sensor and send a signal into MaxMSP.