5. E-Textiles and Wearables I¶
Simple Push Sensor (Analog)¶
I started off by making a simple push sensor using conductive, silver-coated, knit fabric, a resistive fabric called Velostat, and a simple polyester felt. We tested the resistance of different fabric and yarns, and then connected them in a simple circuit with a 3V input. When the "button" is pressed, the material becomes less resistive, and the LED glows brighter.
More Analog Sensors¶
After learning the basics of the push sensor, I wanted to revisit some of my past swatches. Some of them were prototypes for programmable fabrics, and others I realized later could be good starting points. I'm looking forward to revisiting more of my swatches after this initial exploration.
I ended up finding a set of swatches that had been woven on polyester warps with a thin plied polyester/steel weft. I wasn't sure the steel would be conductive enough, but after testing them with a multimeter, I saw that they were actually much stronger than I had thought.
To test the idea, I used one of the samples and connected it to the simple LED circuit. The fabric was woven with a striped weft: the steel/polyester is on the top and the bottom portions, and the middle is a monofilament/nylon blend. As you can see below, when two components of the circuit are attached on the top and bottom of the fabric, the circuit is not completed. If the fabric is folded over, the circuit is completed and the light glows.
Fold Test from Isabelle D Camarra on Vimeo.
I was really interested in other ways that the conductivity/resistance could be a structural aspect of the fabric. I then found a second, dobby-woven swatch using the same steel/polyester yarn throughout. Along with conductivity, the steel yarn provides a really nice structure and stiffness to the fabric. When the fabric is folded and pleated, it holds that shape and bounces back to some extent, even after being repeatedly pulled apart.
The pleats change the shape and structure of the fabric, and also allow the resistance to get smaller. When the fabric is pleated tightly together, the resistance goes down, and in this case, the LED glows. When it's relaxed, the LED is dully lit, and when pulled apart, the LED is either dull or off depending where the attached wires are placed. I'm really excited that this works and looking forward to understanding what other movements and effects could be achieved with this method through more programming.
Conductive Swatch from Isabelle D Camarra on Vimeo.
IMG_5613 from Isabelle D Camarra on Vimeo.
Digital Sensors¶
I'm not a confident Arduino coder, so I started off with the basics, following some example tutorials. I was able to understand and modify the simple functions, like this flashing LED light.
Blink Test from Isabelle D Camarra on Vimeo.
Then I started to try to use my fabrics as part of the Arduino system, I hit a few road blocks. I wanted to convert my pleated analog sensor to a digital sensor, so I could control more kinds of functions eventually. This led me to a couple different areas:
I started off looking at the Analog Input example in Arduino. I figured that in order to use information from my sample for different effects, the Arduino needs to first be able to read the information in an analog way.
Code Below
int sensorPin = A0; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
// declare the ledPin as an OUTPUT:
pinMode(ledPin, OUTPUT);
}
void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
// turn the ledPin on
digitalWrite(ledPin, HIGH);
// stop the program for <sensorValue> milliseconds:
delay(sensorValue);
// turn the ledPin off:
digitalWrite(ledPin, LOW);
// stop the program for for <sensorValue> milliseconds:
delay(sensorValue);
}
I then realized that this example was geared towards a potentiometer. I wondered if I could use my fabric as a potentiometer, or whether this was the wrong area. I also wondered about the Sensor Value setting, and how I would decide what that was. I ended up playing around with that number a bit, trying out a few values between 0 and 1000, but I realized that the LED here glowed/flickered green no matter what I did with the fabric, and even if it wasn't attached at all.
From there I decided to try a different approach. I found a great online tutorial for capacitive sensors, and thought that this could be applied to the fabric swatch. These systems usually include a seperate conductive element and resistance node, but I thought that maybe since my fabric was variably resistant and conductive, it could take the place of the two.
Sample Code
#include <CapacitiveSensor.h>
int led = 13;
int state = HIGH;
boolean yes;
boolean previous = false;
int debounce = 200;
CapacitiveSensor cs_4_2 = CapacitiveSensor(4,2)
{
cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF); //Calibrate the sensor...
pinMode(led, OUTPUT);
}
voidloop()
{
long total1 = cs_4_2.capacitiveSensor(30);
if (total1 > 60){yes = true;}
else {yes = false;}
// to toggle the state of state
if(yes == true && previous == false && millis() - time>debounce){
if(state == LOW){
state = HIGH;
}
else
state = LOW;
time = millis();
}
digitalWrite(led, state);
previous = yes;
Serial.println(millis()-time);
delay(10);
}
It seemed promising, but I keep getting an error message on line 13 that says "expected unqualified-ID before '}' token." After some googling and trouble shooting, I learned that this probably means I need to get rid of the extra semicolon on line 12 after CapacitiveSensor(4,2);. However, when I got rid of that and rechecked, I get another error message saying "expected ',' or ';' before '}' token."
I'm wondering what area of code makes sense for this, and am now thinking maybe a State Change system makes more sense. I feel that there is a simpler (or at least different solution) then what I'm doing here.
Resolution¶
Because I was having trouble with the digital sensors, I decided to use arduino code to read the values of the conductivity of the fabric in different states. I did this using the Analog Read Serial function. This allowed me to see a chart of the values, and lead me to realize that although the fabric was conductive and could work as an analog sensor the active and inactive values (having the fabric fully stretched versus fully pleated) were not contrasted enough to successfully use the material as a digital sensor. I think a solution would be to add more resistive elements to the weave.