5. E-textiles¶
Research & Inspiration¶

Ieva Marija Dautartaitė Fabricademy 2022
E-Textiles, also known as smart textiles, are basically fabrics that contain electronic components to make them function as wearables. These can provide different functionalities depending on the materials, coding, sensors and elements that are involved. There are two types of smart textiles: passive and active.
Passive: Also called “first generation” since they generally are not altered by an external or environmental conditions changes, there are fabrics that had been interfered to accomplish a specific task. For example, cooling fabric, It will help to regulate the body temperature but is not actively cooling. The addition of Microband technology to add antimicrobial properties to the textiles used in footwear, which helps in less odor.
Active: On the other hand, the active ones are those who are controlled by inputs and outputs. For example, the heating seats of cars, wearables like the athletes use to measure their vital signs, etc.

Sara Alvarez, Fabricademy 2021
I found interesting the way Sara Alvarez materialized both the digital and analog sensor in a glove, by fabricating a measuring glove, which can measure objects or distances just using your hand. The glove registers an increment in distance every time the finger tips touch.
Tools¶
- Led red 3mm
- XIAO RP2040
- Copper Tape
- Crocodile clips
- R 1k / 10k
- Type C, data wire
- Felt
- Wooden frame
- Embroidery hoop
- Toggle switch
- Soldering iron
All illustrations by Daniela Maldonado (me)
Process and workflow¶
The microcontroller that i used fot his assigment is the Xiao RP2040
-Xiao RP2040 layout, by Daniela Maldonado
Download and install¶
For this week assignment, we learn how to code, connect with both hard electronics and soft, how to create pressure sensors, etc. The first thing is to download the program Arduino. I download it from the website Seed Studio that is the one of the microcontroller, following the guide steps.
Since Arduino is a program that is compatible with lots of boards, I downloaded:
-The board manger to use the Xiao RP 2040 (Raspberry Pi Pico/RP2040)
-The library to give color to the neo pixels (Adafruit Neopixel)

Board Setup¶
There are two mayor steps that need to be done almost always when opening Arduino for the first time, after a long time of not working with it; and it is to select the type of board and the port in which we will be working to transfer the information.
Type of controller: Seed Xiao RP2040.

To connect the Xiao, it is needed a data wire, not a power one.
The port is normally the one with the higher number, since its basically the last one to be used, but it can vary from time to time.
IMPORTANT:Verify all your connection with a multimeter!
*I recommend to only change what I highlighted in white in each code All the codes that I used and developed for this week, where provided from my instructors in the local class
Blink¶
The first code that I tried was from the examples that Arduino already provides, called “BLINK”. It consist in making a led turn on and off automatically in loop.

I changed the pin number to the one I was going to use, and leaved the time, but that is something that can also be change depending on what we want to do. (1000 equals 1 second)

-Blink schematic, by Daniela Maldonado
+// C++ code - LED INTERMITENTE
void setup()
{
pinMode(D0, OUTPUT); // LED 1
}
void loop()
{
digitalWrite(D0, HIGH); // Enciende LED en pin D0
delay(1000); // Espera 1 segundo
digitalWrite(D0, LOW); // Apaga LED en pin D0
delay(1000); // Espera 1 segundo
}
Neopixels¶
Board¶
Then I tried to change the colors of one the Xiao leds. I used one code that my instructors provided me, but I changed the values to make colors that I wanted. This neo pixels wok with RGB codes=(red,green,blue). I search for the values in google.
![]()
-Neopixel board schematic, by Daniela Maldonado
#include <Adafruit_NeoPixel.h>
int Power = 11;
int PIN = 12;
#define NUMPIXELS 1
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pixels.begin();
pinMode(Power,OUTPUT);
digitalWrite(Power, HIGH);
}
void loop() {
pixels.clear();
pixels.setPixelColor(0, pixels.Color(15, 25, 205));
delay(400);
pixels.show();
pixels.clear();
pixels.setPixelColor(0, pixels.Color(103, 25, 205));
delay(400);
pixels.show();
pixels.clear();
pixels.setPixelColor(0, pixels.Color(233, 23, 23));
delay(400);
pixels.show();
delay(500);
}
External¶
Then I tried to do the same thing but with an external Neopixel. The first thing that I did was to #define both the Pin and the number of leds that I was gonna used.
Then I searched for the values to make purple, and since I wanted it to turn on and off, I simply changed the values to (0,0,0)
![]()
-Neopixel schematic, by Daniela Maldonado
#include <Adafruit_NeoPixel.h>
#define PIN 2 // Pin donde está conectado el Neopixel
#define NUMPIXELS 1 // Número de LEDs (ajusta si tienes más)
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pixels.begin(); // Inicializa el Neopixel
}
void loop() {
// morado
pixels.setPixelColor(0, pixels.Color(150, 0, 150));
pixels.show();
delay(1000);
// Apagar
pixels.setPixelColor(0, pixels.Color(0, 0, 0));
pixels.show();
delay(1000);
}
For this exercice I used a pad that extends the XIAO components designed by one of my instructors,Maricruz , she developed this in her fabricademy
Analog¶
I made a pressure sensor to turn on a led using velostat
What is velostat? Well, it is a flexible conductive material that electrically charges when pressure, this can be done by applying literall pressure, “pushing it”, or it can also be archive by manipulating it, like deforming it.
I followed this tutorial from YouTube, but it didn’t work for me, the lectures it had went from 170 to 180, and it wasn't enough to work with, so I modified by just leaving 2 pieces of Velostat instead of the three that the video say.

The velostat must be connected on one side to a Pin and to GND, and the other to the pin of 5V. In the code I indicated:
-
the pin of the velostat, the pin of the led.
-
Changed the values of the readings and the brightness of the led
-Velostat schematic, by Daniela Maldonado
int sensor_fuerza= D0;
int led=D9;
int lectura;
int brillo;
void setup()
{
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop()
{
lectura = analogRead(sensor_fuerza); // Resistance equals sensor reading (Analog 0)
Serial.print("Lectura Analogica = ");
Serial.println(lectura);
// Change the analog reading range (500-1023)
// We use in analogWrite 8 bits (0-255) configured in the map
brillo = map(lectura, 770, 1023, 0, 80);
analogWrite(led, brillo);
delay(100); //One hundred “ms” wait on each reading
}
Digital¶
To do a digital sensor I used a toggle switch to turn off and on a led.
Since it was a switch of three steps, I had to connect the positive to the side that I was going to use.
I indicated the pin switch and the led pin.

-Toggle Switch schematic, by Daniela Maldonado
const int pinSwitch = D0; // Interruptor conectado a D0
const int ledPin = D1; // LED conectado a D2
void setup() {
pinMode(pinSwitch, INPUT_PULLUP); // Pull-up activado (switch a GND)
pinMode(ledPin, OUTPUT); // LED como salida
digitalWrite(ledPin, LOW); // Asegura LED apagado al inicio
}
void loop() {
// Leer el estado del interruptor (LOW = ON, HIGH = OFF)
bool switchOn = digitalRead(pinSwitch) == LOW;
// Controlar el LED directamente según estado del switch
if (switchOn) {
digitalWrite(ledPin, HIGH); // Encender LED
} else {
digitalWrite(ledPin, LOW); // Apagar LED
}
// Pequeño retardo opcional para estabilidad
delay(10);
}
Buzzer¶
To use the buzzer first I needed to #define it, and so the musical notes with their numerical values at the beginning. I used a code that my instructors gave me, but I ask ChatGPT to give me more musical notes and a melody without Autor rights, so this melody´s autor is ChatGPT. The thing is that ChatGPT writes codes in a very complex way, so I just took the sequence of notes and wrote them into my code
ChatGTP Prompts
1. Hello chat, Please give me a 7-note melody (do re mi fa) that's copyright-free.
2. Now please give me one that has the aesthetics of a forest, like a fairy tale.
3. Now please develop an Arduino code. I need the numerical values of the notes.
4. Now please develop a two stanza melody, following the same aesthetics
With this prompts ChatGTP developed the following code:
/*
Melodía de bosque encantado (loop)
Autor: ChatGPT (libre de derechos)
Notas: Do - Re - Mi - Fa# - Mi - Re - Sol
*/
#define BUZZER_PIN 8
#define NOTE_C4 262
#define NOTE_D4 294
#define NOTE_E4 330
#define NOTE_FS4 370
#define NOTE_G4 392
int melody[] = { NOTE_C4, NOTE_D4, NOTE_E4, NOTE_FS4, NOTE_E4, NOTE_D4, NOTE_G4 };
int noteDurations[] = { 4, 4, 4, 4, 4, 4, 2 };
void setup() {
// Nada especial que hacer aquí
}
void loop() {
for (int i = 0; i < 7; i++) {
int duration = 1000 / noteDurations[i];
tone(BUZZER_PIN, melody[i], duration);
delay(duration * 1.30);
noTone(BUZZER_PIN);
}
delay(1000); // Pausa antes de repetir (puedes ajustarla)
}
The thing is that ChatGPT writes codes in a very complex way, so I just took the sequence of notes and wrote them into my code

-Buzzer schematic, by Daniela Maldonado
#define BUZZER_PIN 7
#define NOTE_DO 262
#define NOTE_RE 294
#define NOTE_MI 330
#define NOTE_FS4 370
#define NOTE_G4 392
#define NOTE_A4 440
#define NOTE_B4 494
void setup() {
pinMode(BUZZER_PIN, OUTPUT);
}
void loop() {
tone(BUZZER_PIN, NOTE_DO);//primera melodia
delay(300);
tone(BUZZER_PIN, NOTE_RE);
delay(300);
tone(BUZZER_PIN, NOTE_MI);
delay(300);
tone(BUZZER_PIN, NOTE_FS4);
delay(300);
tone(BUZZER_PIN, NOTE_MI);
delay(300);
tone(BUZZER_PIN, NOTE_RE);
delay(300);
tone(BUZZER_PIN, NOTE_G4);
delay(300);
noTone(BUZZER_PIN);
delay(500); // pequeña pausa antes de repetir
tone(BUZZER_PIN, NOTE_MI); //segunda melodia
delay(300);
tone(BUZZER_PIN, NOTE_FS4);
delay(300);
tone(BUZZER_PIN, NOTE_G4);
delay(300);
tone(BUZZER_PIN, NOTE_A4);
delay(300);
tone(BUZZER_PIN, NOTE_G4);
delay(300);
tone(BUZZER_PIN, NOTE_FS4);
delay(300);
tone(BUZZER_PIN, NOTE_B4);
delay(300);
noTone(BUZZER_PIN);
delay(500); // pequeña pausa antes de repetir
}
Fabric¶
After experimenting a little bit in a protoboard or directly to the Xiao, I selected some of the connections I made and passed them to fabric. Fisrt I did the velosts and in the second one I combined the buzzer, the switch and a manual interruption of a led.
I simply took all the elements that I used and changed them for softs: I used conductive tape, conductive thread, semi conductive, and some thin wires. I planed my connections paths before sewed them. I realize that I would have to make kind of like a bridges to connect everything to ground, since I was working with more than one element. So, I made this “bridges” with some felt and conductive tape so that I can place that over the other connections without risking them touching.

-Velostat schematic, by Daniela Maldonado

-Buzzer/led/switch schematic, by Daniela Maldonado
Soft switch¶

The switch must be connected on one side to the negative end of the LED and to GND. It will be a manual interruptor for the led to turn on/off.
-Soft switch eschematic by Daniela Maldonado