Electronics, music, electronic music! general geekery


Middle Aged Engineering Grum-P-Lab: connect and read sensor input

When I left off from Part 1, I had plugged the Teensy into the computer and loaded the flash program to make sure it works. The next phase involves loading Firmata onto the Teensy, and getting some sensor input into MaxMSP. Note that Firmata and MaxMSP are just two of many software possibilities. Other programs that are great for doing stuff with sensors include the free open-source PureData, and Processing applications.

To load Firmata onto Teensy, download and install the Teensy loader if you haven't already done so. Then, pick up the special Teensy version of Firmata from here. Follow the instructions for loading Firmata onto the Teensy and you're good to go.

For my first sensor I'm going with the pressure sensitive resistance pad. When you press on it, the resistance goes up! I have soldered it to the end of a 3.5mm male cable. One lead of the pressure pad is connected to the ground wire of the 3.5mm cable, and one to the positive wire (tip). You can ignore polarity for the pressure pad. This diagram shows the circuit (Teensy on the left, audio breakout on the right, pressure pad assembly is not shown - it's plugged into the breakout):

  • +5V to TIP
  • GND to GND (10k ohm resistor)
  • A0 (38) to GND

If you omit the +5V line all you'll get is noise. When I load the Max patcher and press the pressure pad, I can get a good signal. Woo-hoo! This could be set up to go to a pitch bender, bit crusher, purple spotlight, vacuum cleaner, or whatever. You can alter the response of the pressure sensor by placing other thin materials on top of it (if you're building it into something you will probably do this anyway). My feeling was that it tends to dampen the response a bit. This is good since at light pressure the reading is a bit jittery. Also you can play with the resistance on the +5V to change the high limit. 120k ohms worked for me but your mileage may vary. If you are building this into something a trimmer resistor might not be a bad idea here.

Here is a screenshot of the Max patcher. You can set it to print the analog values, and the other part flashes LED 6 for an easy way to make sure your serial connection is working.

And the code:


Announcing our first soundware product!

Salad Spynner is a set of seven Ableton Live racks and 213 drum hits harvested from the SonicCharge Synplant synth. This collection of sounds is replete with beeps, boops, blasts, fizzles, sizzles, and kerplonks, all infused with the unique character of Synplant. The racks feature macros that are tuned to deliver a wide variety of sounds. And it's a great value at $3.86! Available for purchase and immediate download in our online store.

Filed under: Uncategorized No Comments

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

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.