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:

Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

No trackbacks yet.