5. E-TEXTILES¶
Week5 E-Textiles
For week 5 we dived into e-textiles. a new and interesting area of personal computing electronics. With how small an arduino board or equivalent can be produced these days, the possibilities in adding them to clothes or textiles is a new but wide open frontier.
RESEARCH AND INSPIRATION¶
These projects were things that i thought were interesting and also somewhat feasible as first dive into e-textiles (besides the Google x Levi)
Plan of the week: - Learn basic electronic principles
-
Play around and experiment with simple circuits and a breadboard- ”plug and play” tool to prototype basic electronic projects.
-
Learn about analog and digital sensors. Their differences and advantages.
-
Complete our own digital and analog sensor, and time permitting incorporate into an e-textile of some kind
Important formulas at the base of all electronics…
Ohm's Law = Volt = I Current (amps) x R Resistance
(Watts) Power used / dissipated = Voltage x Current (amps)
RESOURCES¶
Good resources:
SparkFun - SparkFun
AdaFruit - AdaFruit
Digikey - Digikey
Tindie - Tindie
TOOLS¶
Arduino software V2.32
Adafruit Flora microcontroller
3.7V battery
PROCESS AND WORKFLOW¶
Building my own sensor.
HELPFUL INFO¶
The Difference Between Digital and Analog Sensors
- Digital Sensors: Provide a simple ON/OFF output based on a threshold. Ideal for detecting binary states like touch or pressure.
- Analog Sensors: Output a continuous range of values proportional to the applied input, enabling precise measurements (e.g., varying pressure levels).
What is Velostat?
- Velostat is a pressure-sensitive conductive material that changes resistance when compressed. It’s a key component in soft sensors for detecting touch, force, or flex.
MATERIALS¶
Velostat (or other piezoresistive materials) Conductive fabric or thread Non-conductive fabric (as a base layer) Wires or snaps for connections Microcontroller (e.g., Arduino)
INSTRUCTIONS¶
Cut Layers: Prepare a base layer, a layer of Velostat, and a conductive fabric top layer. Assemble the Sensor: Sandwich the Velostat between the conductive layers. Connect to a Circuit: Attach wires or snaps to the conductive layers. Test the Sensor: Connect to a microcontroller and measure changes in resistance to test pressure or touch response.
STEP BY STEP¶
Using my logo as a base shape I built first a digital (binary) sensor, and then after testing with a multimeter and some LEDs, turned it into an Analog sensor using a piece of Velostat.
When making a pressure button an analog sensor, you have to understand the ohm range of your sensor.
This is to best select a resistor in between your values. For my button my range was from around 50 to 150 ohms. This meant that a 100 ohm resistor would work best.
However for my final version my sensor is using the onboard resistor of the ADAfruit flora
This week I was pretty far outside of my expertise but it was very fun playing around with these electronics and being exposed to an ever widening field of possibilities. I decided to make a very simple function pressure sensor before trying to incorporate it into something larger or cooler
After completing the basic pressure sensor and finally grasping the basics I started playing around with the coding and on board NEO PIXEL LED.
Having very little coding experience, trying to figure it out the old fashioned way was a frustrating first foray into arduino. But after overhearing my classmate Neyla mention ChatGPT, (which i had somehow completely forgotten about), i embarked on a conversational spree with chatGPT and managed to get working code after a few prompts and refinements. Truly a lifesaver.
WOULD RECOMMEND FOR ALL BEGINNERS AND EVEN TO JUST SEE IF YOUR IDEA IS POSSIBLE.
Here is the initial prompt I used and the code that it gave me that my final iteration is running.
CODE EXAMPLE¶
I used the prompt "Can you write me an arduino code for an adafruit flora that uses a pressure sensor button to change the color of the neopixel?" to get the following code
#include <Adafruit_NeoPixel.h>
// Pin definitions
#define PRESSURE_PIN A0 // Analog pin where the pressure sensor is connected
#define NEOPIXEL_PIN 6 // Pin where the NeoPixel is connected
#define NUMPIXELS 1 // Number of NeoPixels (assuming 1 for this setup)
// Initialize the NeoPixel library
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
// Function to convert HSV to RGB
uint32_t Wheel(byte WheelPos) {
if(WheelPos < 85) {
return pixels.Color(WheelPos * 3, 255 - WheelPos * 3, 0); // Red -> Green
} else if(WheelPos < 170) {
WheelPos -= 85;
return pixels.Color(255 - WheelPos * 3, 0, WheelPos * 3); // Green -> Blue
} else {
WheelPos -= 170;
return pixels.Color(0, WheelPos * 3, 255 - WheelPos * 3); // Blue -> Red
}
}
void setup() {
// Initialize the NeoPixel
pixels.begin();
// Start with the NeoPixel off
pixels.setPixelColor(0, pixels.Color(0, 0, 0));
pixels.show();
}
void loop() {
// Read the pressure sensor value (0 to 1023)
int pressureValue = analogRead(PRESSURE_PIN);
// Adjust the sensitivity: Map pressure value to a narrower range, e.g., 100 to 900 for better sensitivity
int sensitivePressure = constrain(pressureValue, 100, 900);
sensitivePressure = map(sensitivePressure, 100, 900, 0, 255); // Map the pressure to 0-255 for color cycling
// Set the new color based on the pressure value (cycling through full color spectrum)
uint32_t color = Wheel(sensitivePressure);
// Set the NeoPixel color
pixels.setPixelColor(0, color);
pixels.show();
// Small delay for smooth transitions
delay(10);
}
RESULTS¶
VIDEO¶
FINAL IDEA¶
The final idea was this plushie monster creature.
When you press on the mouth, it will activate the sensor and make the eye glow and change color like in the video above. it is now just integrated into the fabric.
I unfortunately never got a good video of it working as i needed to take the flora out for use in a later weeks project.