Skip to content

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

These projects were things that i thought were interesting and also somewhat feasible as first dive into e-textiles (besides the Google x Levi)

Pin Sensor Gauntlet

Levi x Google jaquard

Batteryless E-Textile

LED fabric

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

Quote Dani told the class,

    from Adam Savage:

“The only difference between science and fucking around is writing it down”

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 and Tools

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.


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

---