5. E-textiles¶
Research¶
This week’s assignment focused on hands-on exploration of E-textile technologies. Therefore, I practiced through the following four foundational activities: ON/OFF circuits, digital and analog stretch sensors, and a diaper wetness sensor. These activities reflect the current state and future potential of smart textiles for wearable and healthcare applications.
1. ON/OFF Circuit¶
Textile-based ON/OFF circuits use conductive threads or printed tracks to create electrical pathways within fabric. A switch (such as a snap button or pressure pad) controls current flow, enabling or disabling devices like LEDs. Textile circuits are a fundamental building block for smart garments, allowing integration of basic electronic functions while maintaining fabric flexibility and comfort.
2. Wearable Stretch Sensor (Digital)¶
These sensors use stretchable, conductive yarns or fibers. When the fabric is stretched, resistance changes. By setting a threshold, the sensor outputs a digital HIGH/LOW signal, indicating significant deformation. Recent advances in weavable strain-sensing yarns and piezoresistive nanofiber sensors enable robust, repeatable detection of body movements, supporting gesture recognition and posture monitoring.
3. Analog Stretch Sensor¶
Similar to the digital version, but provides a continuous analog output proportional to the degree of stretch. This allows for detailed monitoring of motion or strain. High-sensitivity, wide-range analog textile sensors have been developed using materials like graphene, silver nanowires, and carbon nanotubes, enabling real-time tracking of subtle and large-scale movements.
4. Diaper Wetness Sensor¶
Moisture-sensitive sensors are integrated into textiles using conductive or humidity-responsive materials.When wet, the sensor’s resistance or capacitance changes, triggering a digital alert. Textile-based humidity and wetness sensors, including origami paper-based and fully textile seam-line designs, offer low-cost, flexible, and reliable solutions for hygiene monitoring in infant and elderly care.
Objectives:¶
- Understand conductive paths and switching mechanisms in fabrics.
- Develop textile-based sensors for motion, gesture, and moisture detection.
- Explore real-world applications of e-textiles in healthcare, wearable tech, and interactive garments.
References & Inspiration¶
References:¶
- PolyU E-Textile Research: Capacitive touch integration in woven structures
- Arduino Tutorials: Digital and analog sensor integration
- Diaper Wetness Sensor Studies: Textile-based moisture detection
- Stretch Sensor Applications: Gesture recognition, posture monitoring, motion sensing, Sensors 2021; 21(15): 5014
Inspiration:¶
Smart wearable garments for fitness and rehabilitation.
Healthcare applications: real-time infant or elderly care monitoring.
Interactive textiles in fashion technology.
Tools¶
- Materials: Conductive thread, carbon-coated yarn, Knit fabrics, Conductive fabrics
- Electronics: Arduino Uno, wires, breadboards, LEDs, Resistors
- Software: Arduino IDE, Wokwi simulation platform.
- Measurement: Multimeter (for resistance testing), basic sewing tools.
Process and workflow¶
ON/OFF Circuit¶
- Circuit Setup in Wokwi:
- Place an Arduino Uno on the Wokwi workspace.
- Connect the LED’s anode (long leg) to digital pin 13.
- Connect the cathode (short leg) to GND through a 220 Ω resistor (to prevent burning out the LED).
- Ensure all connections are properly simulated in Wokwi. - Code Preparation:
- Open the Arduino IDE in Wokwi.
- Use the following blink code:
// Simple LED ON/OFF (Blink) Program
// Works perfectly in Wokwi simulation
int ledPin = 13; // LED connected to digital pin 13
void setup() {
pinMode(ledPin, OUTPUT); // set pin 13 as output
}
void loop() {
digitalWrite(ledPin, HIGH); // turn LED ON
delay(1000); // wait 1 second
digitalWrite(ledPin, LOW); // turn LED OFF
delay(1000); // wait 1 second
}
- Click the “Play” button in Wokwi to run the simulation.
- Observe the LED blinking ON for 1 second and OFF for 1 second repeatedly.
4. Testing & Verification:
- Ensure the LED turns ON and OFF without errors.
- Verify the delay timing matches the code (1-second interval).
- Check for correct pin connections if the LED does not blink.
5. Optional – Textile Implementation:
- Replace jumper wires with conductive thread sewn into fabric.
- Connect an LED using conductive thread paths.
- Confirm the LED still responds to the Arduino digital output.
Outcome:
- LED blinks continuously at 1-second intervals in the Wokwi simulation.
- Demonstrates basic ON/OFF switching, which is foundational for interactive textiles and wearable electronics.
Wearable Stretch Sensor (Digital)¶
- Circuit Setup in Wokwi:
- Place Arduino Uno on the workspace.
- Connect the potentiometer middle pin to A0 (analog input).
- Connect one side pin of the potentiometer to 5V and the other to GND.
- Optionally, connect an LED to digital pin 13 (with a 220 Ω resistor) to indicate “stretched” threshold. - Code Preparation:
- Open Arduino IDE in Wokwi.
- Use the following code to read analog values and calculate sensor resistance:
// Analog soft (resistive) sensor simulation using potentiometer
// Simulates fabric strain or pressure sensor using voltage divider
const int sensorPin = A0; // Analog input pin
const int ledPin = 13; // LED output (optional)
const int R_PULLUP = 10000; // 10k resistor
float Vcc = 5.0;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
int raw = analogRead(sensorPin); // 0–1023
float Vout = (raw / 1023.0) * Vcc; // Convert to volts
// Calculate Rsense using voltage divider formula
float Rsense = (R_PULLUP * Vout) / (Vcc - Vout);
// Display sensor readings
Serial.print("Analog: "); Serial.print(raw);
Serial.print(" | Voltage: "); Serial.print(Vout, 2);
Serial.print(" V | Rsense: "); Serial.print(Rsense, 0);
Serial.println(" ohms");
// Threshold indicator (simulating “stretched” state)
if (raw > 600) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
delay(200);
}
- Upload & Run Simulation:
- Click “Play” in Wokwi to start the simulation.
- Turn the potentiometer knob to simulate fabric stretching.
- Observe the serial monitor showing analog readings (0–1023), voltage, and calculated sensor resistance (Rsense). - Testing Thresholds:
- Analog readings above 600 simulate a stretched state.
- LED turns ON when stretched, and OFF when relaxed.
- Adjust threshold values as needed for different sensor materials or stretch ranges. - Optional – Textile Implementation:
- Replace potentiometer with stretchable resistive yarn sewn into fabric. - Connect one end to 5V and the other to analog input with a pull-up resistor. - LED can provide a visual indicator of stretching. - Real-time readings can be logged via serial monitor or mapped to interactive applications.
Outcome:
- Successfully simulated analog fabric strain sensor in Wokwi.
- Observed continuous voltage changes corresponding to stretching.
- LED accurately indicated threshold-based stretched state.
- Provides foundational workflow for developing wearable analog sensors in textiles.
Analog Stretch Sensor¶
- Circuit Setup in Wokwi:
- Place an Arduino Uno in the Wokwi workspace.
- Connect the potentiometer’s middle pin to A0 (analog input).
- Connect the two outer pins to 5V and GND, forming a voltage divider.
- LED connected to digital pin 13 (onboard LED used for visual feedback). - Calibration:
- Take 20 initial readings from the analog input to determine the baseline (unstretched state).
- Average these readings to set a stable reference for “0% strain.”
- This step ensures the sensor accounts for initial variations in resistive fabric or potentiometer. - Code Implementation:
- Use the following code to read the analog input, calculate strain percentage, and trigger the LED:
// Wokwi simulation of a wearable strain sensor
// Potentiometer simulates resistive fabric stretch sensor
const int SENSOR_PIN = A0; // analog input from sensor
const int LED_PIN = 13; // onboard LED
int baseline = 0; // stores baseline reading
void setup() {
Serial.begin(9600);
pinMode(LED_PIN, OUTPUT);
// --- Calibration: average of 20 samples ---
long sum = 0;
for (int i = 0; i < 20; i++) {
sum += analogRead(SENSOR_PIN) ;
delay(50);
}
baseline = sum / 20;
Serial.print("Baseline: ");
Serial.println(baseline);
}
void loop() {
int sensorValue = analogRead(SENSOR_PIN);
// Convert analog value (0–1023) to approximate strain percentage
// Simulated: 0% strain = baseline, 100% strain = 200 above baseline
float strainPercent = constrain(((float)sensorValue - baseline) / 2.0, 0, 100);
// Display readings
Serial.print("Analog: ");
Serial.print(sensorValue);
Serial.print(" | Strain(%): ");
Serial.println(strainPercent);
// Turn on LED if strain above threshold (e.g., 30%)
if (strainPercent > 30) {
digitalWrite(LED_PIN, HIGH);
} else {
digitalWrite(LED_PIN, LOW);
}
delay(200);
}
- Running the Simulation:
- Start the Wokwi simulation.
- Rotate the potentiometer to simulate fabric stretching.
- observe serial monitor outputs for analog readings and strain percentage.
- LED turns ON when strain exceeds the threshold (30%), and OFF when below. - Testing & Verification:
- Verify baseline calibration is stable.
- Adjust threshold or scaling factor if strain mapping is too sensitive or not responsive.
- Confirm that LED feedback corresponds accurately with simulated strain. - Optional – Real Textile Implementation:
- Replace the potentiometer with stretchable resistive yarn sewn into fabric.
- Connect one end to 5V, the other to analog input with appropriate pull-up/down resistor.
- Baseline calibration can be repeated on the actual fabric sensor for accurate strain measurement.
- LED or other outputs can provide visual or haptic feedback for wearable applications.
Outcome:
- Calibrated strain sensor successfully simulated in Wokwi.
- Continuous strain readings mapped to percentage values.
- LED correctly indicates when strain exceeds threshold.
- Workflow provides a reliable method to implement wearable resistive sensors in textiles for motion, posture, or gesture detection.
Diaper Wetness Sensor¶
- Circuit Setup in Wokwi:
- Place Arduino Uno in the Wokwi workspace.
- Connect the middle pin of the potentiometer to A0 (analog input).
- Connect the other two potentiometer pins to 5V and GND, forming a voltage divider.
- Connect LEDs:
- Green to pin 2
- Yellow to pin 3
- Red to pin 4
- Each LED connected through a 220 Ω resistor to GND. - Code Implementation:
- Open Arduino IDE in Wokwi.
- Use the following code to read analog sensor values, determine moisture levels, and light corresponding LEDs:
// Smart Diaper Moisture Level Indicator (Potentiometer simulation)
#define SENSOR_PIN A0 // Potentiometer middle pin
#define GREEN_LED 2 // Dry
#define YELLOW_LED 3 // Wet
#define RED_LED 4 // Full
int sensorValue = 0;
void setup() {
Serial.begin(9600);
pinMode(GREEN_LED, OUTPUT);
pinMode(YELLOW_LED, OUTPUT);
pinMode(RED_LED, OUTPUT);
}
void loop() {
sensorValue = analogRead(SENSOR_PIN); // Read analog value (0–1023)
Serial.print("Sensor Value: ");
Serial.println(sensorValue);
// Thresholds for Dry, Wet, Full (adjust as needed)
if (sensorValue > 750) {
// Dry diaper
digitalWrite(GREEN_LED, HIGH);
digitalWrite(YELLOW_LED, LOW);
digitalWrite(RED_LED, LOW);
Serial.println("Status: DRY");
}
else if (sensorValue <= 750 && sensorValue > 450) {
// Wet diaper
digitalWrite(GREEN_LED, LOW);
digitalWrite(YELLOW_LED, HIGH);
digitalWrite(RED_LED, LOW);
Serial.println("Status: WET");
}
else {
// Full diaper
digitalWrite(GREEN_LED, LOW);
digitalWrite(YELLOW_LED, LOW);
digitalWrite(RED_LED, HIGH);
Serial.println("Status: FULL");
}
delay(500);
}
- tart the Wokwi simulation.
- Adjust the potentiometer to simulate different moisture levels.
- Observe serial monitor showing analog readings and corresponding status messages: DRY, WET, FULL.
- LEDs light according to the simulated diaper status:
- Green = Dry
- Yellow = Wet
- Red = Full
4. Testing & Threshold Adjustment:
- Confirm each LED lights correctly at different analog values.
- djust threshold values (750, 450) based on actual sensor calibration or material characteristics.
- Verify system responsiveness with simulated moisture changes.
5. Optional – Real Textile Implementation:
- Replace potentiometer with absorbent conductive fabric sensor.
- Sensor resistance changes with wetness; Arduino reads voltage via analog pin.
- LEDs or a mobile/IoT alert system can provide visual or remote notification of diaper status.
Outcome:
- Smart diaper moisture simulation successfully implemented in Wokwi.
- Three-level moisture detection clearly indicated by LEDs and serial output.
- Provides a foundation for real-world e-textile diaper sensors for infant and elderly care.
Videos from Youtube¶
Results¶

Diaper dry, wet and full output
This week’s e-textile activities successfully demonstrated the integration of electronics into fabrics. From basic ON/OFF circuits to advanced stretch and moisture sensors, participants gained hands-on experience in designing wearable electronics with practical applications in healthcare, motion tracking, and interactive garments.







