Tuesday, October 30, 2012

Use a Sound Card to Measure Flex Sensor Data

Overview
This post is an example measuring the data from a flex sensor without using a microcontroller, a breadboard or any soldering equipment.

Instead, we can use a sound card to send an audio signal through the flex sensor. The flex sensor will - when acting as a voltage divider - change the amplitude of the audio signal. The output from the flex sensor is then connected to the audio input of the sound card, where the amplitude is measured and converted to data that can be used to control musical parameters.

The following flow chart presents an overview of this process: 










Materials Needed

Hardware
1 x 100kΩ resistor

 
 5 x alligator leads


2 x 6.5mm / 0.25 inch mono audio jacks - remove the outer shell


1 x sound card in addition to your computer's internal sound card



1 x flex sensor



Software
• DAW such as Ableton Live
Flex Max patch
Max 6 or Max Runtime













Step-By-Step

The sound card without any connections or components. 




Connect an audio jack to the left output of the sound card. Note that the long leg is ground and the short leg is signal. 




Connect an audio jack to the left input of the sound card. Note that the long leg is ground and the short leg is signal.   




Connect the output signal leg to an alligator lead. 




Connect the other end of the alligator lead to one of the two legs of the flex sensor. It doesn't matter which one. 




Connect an alligator lead to the other leg of the flex resistor. 




Connect the other end of the alligator lead to one of the two legs of the 100kΩ resistor. It doesn't matter which one. 




Connect the same leg of the resistor as used in the previous step to the audio input signal. 



Connect the other leg of the resistor to audio input ground. 




Connect audio output ground to audio input ground. 



Load up the flex Max patch.  Double-click on the ctlout object and select your destination MIDI device. This device will be controlled via the flex sensor using continuous controller #1 on MIDI channel #1.



In Max, go to  Windows > Audio Status. Set the Audio to 'On'. In the Input Device and Output Device menus, select the relevant sound card - i.e. the one that was used for both audio input and output in the previous steps.


Finally, map your MIDI CC1 to parameters and enjoy!

0 comments: