dec 08
This semester I have been focusing on getting the Arduino to talk with Processing.
There are several components of the final product:
My work in this tutorial was focused mainly between learning how to use the basic functions of processing, exploring sound libraries and fabricating and bug-fixing neoprene bend sensors. Though I feel like I wandered quite a bit, I now know how to use a few more tools that were previously opaque to me. Though user friendly, I've run into some of processing's limitations. I'm curious what is available for languages with better supported and/or more fully featured sound libraries. Puredata and a few other visual programming languages come to mind but maybe that is a waste of my time as sound is only one of many possible outputs from an interesting way of input.
Arduino Code:
Throughout the semester, the Arduino code has not changed a great deal. As the Arduino code issimply reading and sending, adding more analog inputs is particularly easy: the code easily fits on one screen. In the beginning of the semester when I didn't quite know how serial with Arduino worked, I had several iterations of different formatting of the string that was sent. The last most-recent implementation uses <'s and >'s around a comma separated list.
The present version works well but it seems there could be a slightly more elegant implementation with a 'for' loop and fewer repeated print statements. I suppose the upside of this way is that I can see exactly what is being sent.
Processing Code:
Most of the time I spent working on the processing sketch was in bug fixing. In my initial, most naiive implementation, the string sent by the Arduino was not checked for overall length so sometimes it would recieve too few or too many inputs and throw a "list index out of range" error.
if (inString != null) {
if (inString.length() > 0) {
println("\n" + inString);
//test whether the string begins with '<' and ends with '>' :
if((inString.charAt(0) == '<') && (inString.charAt(inString.length()-1) == '>')){
// convert to an array of ints, trimming off the '<' and '>' :
int incomingValues[] = int(split((inString.substring(1, inString.length()-1)), ","));
//reject the array of inputs if it is not of the specified length:
if(incomingValues.length != num_inputs){
print("incomingValues.length does not equal num_inputs!");
}
Once error checking for the incoming string was in place, the processing sketch no longer crashes out unless the USB cable is disconnected while it is running (a reasonable reason to crash).
Just recently I realized that the number of analog inputs on the base model arduino is limited to 6. It appears that unless I buy a more sophisticated model, I will have to settle for 6 inputs. If I wanted to go more in the direction of data-glove, there seems like there should be a way to patch digital pin to digital pin to get more kinds of inputs (example, pin 1 to pin 5 causes an octave shift up. Pin 1 to pin 4 shifts an octave down).
Bend Sensors:
Before this semester, the only bend sensor I had made was the one that was created for the gadgets class. It took me several repetitions of making and debugging each sensor to figure out what was causing the lack of range.
For the first sensor I tried to make I was stingy with conductive fabric and overeager with conductive thread. The initial purchase of the conductive fabric (~$30 for a 12"x52" piece from lessEMF.com) seemed expensive at the time but since I only use small pieces at a time, the cost per unit is relatively cheap.
During Thanksgiving break I bought a package of (surprisingly effective) fabric adhesive. By fusing a piece of conductive fabric to one side, I was able to have a quick and easy way to make contact points on each end of the sensor. By simply cutting out a small square of the now adhesive-backed fabric, I bypassed meticulously sewing on each small swatch of fabric.
(Image: comparing old and new methods. (see ))
In their present state, it takes me roughly an hour of work to make a single sensor. I discovered that since much of the work is repetitive, if I brought the materials with me to classes and/or meeting times I could work on them while doing other things.
Though these sensors are less cheap in terms of time spent per unit than the commercial ~$15 model, I enjoy having the option of customization and I favor the tactile qualities of neoprene over thin plastic.
I wonder what is available on the hardware end to smooth the output of the sensors. I've heard of using capacitors for this purpose but I don't understand how I'd go about doing this. I'll see what Alex has to say about it.
For the sewing of the sensors, the biggest problem was stitching around the edges. The inital few sensors barely had enough room around the edges for the cut pieces of velostat so I changed how I was sewing to not cross into the available area. The way that appears in a majority of the final sensors actually pushes up the middle a slight but so the cross section of the sensor has a slight space around the resistive (velostat) layers. This is slow but it seemed to work better than the faster alternative. (picture of types of sewing)
I discovered that if I did not draw the conductive thread tightly across the inside of the neoprene the sensor would lose a good deal of sensitivity.
Possibilities for improvement:
I'd like to explore machine stitching the sensors with thread that is flexible and thin enough to feasibly machine sew. I looked briefly at Plusea's flickr stream and found a few images of machine sewn sensors. These seem to sacrifice the hand sewn edge which is nicely finished for a rougher but far quicker solution.
The material that is used for the final 6 sensors that were used in the construction of the tone generator are not made of particularly elastic material. I'd like to experiment using newer stretchier material.
With this writeup I've included several documents:
-resistor_ranges_bend_sensor_12-08-11.txt contains my notes on the guesswork of getting the bend sensors roughly calibrated.
-several process photos:
--12-01: photos of peel and stick adhesive
--12-07: photos of finished sensors and carefully sorted resistors
--12-08: photo of completed object and comparisons with older poorly made sensors.