Skip to content

5. E-textiles

Research

E-textiles, or electronic textiles, are materials and garments that integrate electronic components and circuits into their structure. These textiles allow the combination of technology with fashion or functional applications, such as health, sports, or safety. They are characterized by the use of conductive materials, such as conductive threads or special fabrics, which enable the transmission of electricity and signals.

References & Inspiration

Paola Guimeráns is a prominent specialist in integrating STEAM education (Science, Technology, Engineering, Art, and Mathematics) with E-textiles and wearable technology. She is known for her innovative approach to teaching, which combines the arts with technology to foster creative and hands-on learning. She has worked on developing educational projects that allow students to explore and experiment with electronic textiles, making it easier to understand complex concepts in electronics and programming.

Guimeráns has collaborated with educational institutions, museums, and art centers to develop workshops and educational programs that promote the use of electronic materials in textile design. Through her work, she aims to empower people to become technology creators, exploring the intersection of fashion, technology, and education. Her approach not only focuses on teaching technical skills but also on inspiring creativity and innovation in the use of E-textiles to solve real-world problems or express artistic ideas.

She was my inspiration to start this week's project.


Tools

Process and workflow

The Arduino IDE (Integrated Development Environment) is a platform used to write, compile, and upload code to Arduino-compatible boards. It supports multiple programming languages like C and C++, and comes with built-in libraries for various components, making it easier to control hardware such as sensors, motors, and displays. It offers cross-platform compatibility for Windows, macOS, and Linux, and supports third-party board extensions. The IDE provides a user-friendly interface for creating and managing projects, suitable for both beginners and advanced users. First step: install Arduino. Second step: identify the program's workspace.

Compile

In this Arduino code, the built-in LED is controlled using a basic program. The setup() function, which runs once at the beginning, sets the LED pin as an output. The loop() function continuously toggles the LED on and off. When the LED is set to "HIGH," it turns on, and when set to "LOW," it turns off. Each state is maintained for one second, using the delay(1000) function, resulting in the LED blinking on and off repeatedly at one-second intervals.

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}
In this code for your Arduino Uno, different pins are controlled: the built-in LED, pin 7, and pin 8. Here's what happens step by step:

Setup Function: The pins are configured as outputs (LED_BUILTIN, 7, and 8).

Loop Function: The built-in LED is turned on for one second, then off for one second. Pin 7 is activated for one second, then deactivated for one second. There's a one-second pause. Pin 8 is then turned on for one second and off for one second. The sequence repeats indefinitely.

void setup()
void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
}

void loop()
{
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000); // Wait for 1000 millisecond(s)
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000); // Wait for 1000 millisecond(s)

  digitalWrite(7, HIGH);
  delay(1000); // Wait for 1000 millisecond(s)
  digitalWrite(7, LOW);
  delay(1000); // Wait for 1000 millisecond(s)

  delay(1000); // Wait for 1000 millisecond(s)
  digitalWrite(8, HIGH);
  delay(1000); // Wait for 1000 millisecond(s)
  digitalWrite(8, LOW);
  delay(1000); // Wait for 1000 millisecond(s)
}

This code is designed to control a NeoPixel LED strip using an Arduino. It cycles through different colors on a single LED by changing the RGB values in a sequence. Here's how it works:

The setup() function prepares the NeoPixel by setting up the power and initializing the LED strip. In the loop() function, it repeatedly changes the LED's color to different RGB values, with short delays in between to create a blinking effect. The code allows for creating dynamic lighting effects with the NeoPixel.

Include the Library- Go to Sketch > Include Library > Manage Libraries. Search for "Adafruit NeoPixel" and install it. Now, you can use the NeoPixel library in your projects.

include <Adafruit_NeoPixel.h

#include <Adafruit_NeoPixel.h>

int Power = 11;
int PIN = 12;
#define NUMPIXELS 1

Adafruit_NeoPixel strip(NUMPIXELS, PIN, NEO_RGBW + NEO_KHZ800);

void setup() {
  strip.begin();
  pinMode(Power, OUTPUT);
  digitalWrite(Power, HIGH);
}

void loop() {
  strip.clear();
  strip.setPixelColor(0, strip.Color(120, 120, 190));
  delay(400);
  strip.show();
  strip.clear();
  strip.setPixelColor(0, strip.Color(174, 32, 171));
  delay(400);
  strip.show();
  strip.clear();
  strip.setPixelColor(0, strip.Color(225, 199, 89));
  delay(400);
  strip.show();
  delay(500);
}

Video

With XIAO RP2040

The Seeed Studio XIAO RP2040 is a compact microcontroller featuring a dual-core ARM Cortex M0+ processor, running up to 133 MHz. It offers 264KB of SRAM, 2MB of flash memory, and multiple interfaces, including 14 GPIO pins, I2C, UART, and SPI. Its small size (21x17.8mm) makes it ideal for wearable and small projects. Compatible with programming platforms like MicroPython, Arduino, and CircuitPython, it is designed for flexibility and ease of use in electronics projects.

describe what you see in this image describe what you see in this image describe what you see in this image describe what you see in this image describe what you see in this image

Button

In this code, using the XIAO RP2040 microcontroller with the Arduino IDE, the basic functionality remains the same as with an Arduino. The code reads the state of pin D0 (input) and controls pin D9 (output) accordingly:

Setup Function: Configures pin D0 as an input and pin D9 as an output. Loop Function: Continuously checks the state of pin D0. If D0 is HIGH, pin D9 is set to HIGH, activating the connected component. If D0 is LOW, pin D9 is turned off. This code essentially functions as a digital switch to control an output based on an input signal.

When using XIAO RP2040, ensure the correct pin mappings are used, as they might differ from the standard Arduino boards.

describe what you see in this image describe what you see in this image describe what you see in this image

int state;
void setup() {


 pinMode(D0, INPUT);
 pinMode(D9, OUTPUT);



}

void loop() {
  state=digitalRead(D0);
  if(state==HIGH)
  {
    digitalWrite(D9, HIGH);

  }
  else{
    digitalWrite(D9, LOW);


  }

}

Velostat

Velostat is a conductive and flexible material known for its piezo-resistive properties. This means that its electrical resistance changes when pressure is applied or when it is deformed. When the velostat is pressed, its resistance decreases, and when the pressure is released, the resistance increases. This characteristic allows it to be used as a pressure, force, or flex sensor.

To function as a sensor, velostat is typically placed between two layers of conductive material, such as copper tape or conductive textiles. When pressure is applied to the velostat, the resistance between the conductive layers changes, which can be measured with a microcontroller or electronic circuit to detect variations in the applied pressure or force. It is commonly used in pressure-sensing devices, force sensors, or even in e-textile applications.

I researched on YouTube how to make a force sensor with velostat.

Prepare

describe what you see in this image describe what you see in this image describe what you see in this image describe what you see in this image

Programing

To work with the velostat, I researched that Velostat can act as a force or pressure sensor because it is a piezoresistive material, meaning its electrical resistance changes in response to applied pressure. When pressure is applied to Velostat, its conductive particles are compressed, decreasing the material's resistance and allowing more electrical current to pass through. This change in resistance can be measured and used to detect varying levels of force or pressure, making it useful in applications such as wearable electronics, touch sensors, and flexible circuits.

I searched for pressure or force sensor codes on TinkerCad and found one created by Valeria López Cazabal that used an Arduino. I decided to try it out and started learning from the code to understand it better and adapt it for my Xiao.

schematic

int sensor_fuerza= 0;
int led=9;
int lectura;
int brillo;
void setup()
{ 

  pinMode(led, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
lectura = analogRead(sensor_fuerza); // La Resistencia es igual a la lectura del sensor (Analog 0)
Serial.print("Lectura Analogica = ");
Serial.println(lectura); 
// Cambiar el rango de la lectura analógica (0-1023)
// Utilizamos en analogWrite 8 bits (0-255) configurados en el map
brillo = map(lectura, 0, 1023, 0, 255);
analogWrite(led, brillo); 
delay(100); //Cien “ms” de espera en cada lectura
}

Results

```

In the Arduino "Serial Plotter," this code would show a real-time graph of the values of the lectura variable, which corresponds to the force sensor reading on analog pin 0. Here’s what you might observe:

Analog reading of the force sensor:

The value of the lectura variable is printed on the serial monitor and ranges from 0 to 1023, depending on the force applied to the sensor. If you apply more pressure on the sensor, you will see the values on the graph increase. When you reduce the pressure, the values will decrease. Behavior of the curve on the graph:

The graph in the "Serial Plotter" will move upward when the reading is higher (more force) and downward when it is lower (less force). Since the code includes a delay(100), the readings are updated every 100 milliseconds, meaning the graph will have a temporal resolution of 10 readings per second. Changes in the LED brightness:

Although the "Serial Plotter" does not directly show the LED brightness, the code adjusts the LED brightness on pin 9 according to the force applied to the sensor. The more force you apply, the higher the lectura value will be, and consequently, the brighter the LED will glow. In summary, the "Serial Plotter" will show a graphical representation of the force sensor's behavior over time, visualizing how the analog values change with the pressure applied to the sensor.

Video

---