Introduction: Learning Platform for E-textiles

The main idea of the project is to create a modular e-textile learning/testing component bundle. The project allows students to learn and test e-textile possibilities by plug-and-play method. There is no soldering needed when modules are ready. Students can produce their own code and use it with the modules. Modular e-textile concept can be added to all kind of textile projects. For example it can be used for tuning readymade clothing or for selfmade products.


The modules are

  • hand sewed LED-diffuser module,
  • Li-Ion battery module,
  • battery charger,
  • main logic module with sound sensor,
  • button module and
  • sliding switch module

Main logic is run by Raspberry pi Pico microcontroller, which is programmable with Arduino programming language, C/C++, Micro Python or Circuit Python. Modules are connected via JST RCY connectors and crimp connectors. All casings of modules are 3d printable.


Disclaimer:

This project is prototype to test how e-textiles could be taught and learned. All modules are in prototype phase. Use, test or remix idea freely. Author of this instructions take no responsibility of your implement. Project includes LiPo battery and electronics which can be dangerous if handled wrongly.

Supplies

Tools:

Soldering iron + Solder

3D Printer + see-through filament (Formfutura HDclass used in this projekt)

Wire stripping pliers

Sewing needle

Sewing tread

Heat-shrink tube


Parts:


1x                 Raspberry pi Pico

1x                 SEN-12642 SparkFun Sound Detector.

1x                 POLOLU-1917. 0.1" (2.54mm) Crimp Connector Housing: 1x20-Pin. 

3x                 JST-RCY Connector

1x                 Pin-Strip 1x20-pin: height.8,4mm, R.2,54mm 90°

24x               LilyPad LED

1x                 LilyPad Slide Switch

1x                 Button 12mm x 12mm

1x                 OKY3402-1 Li-ion Battery Micro USB Charger Module Charging Board with 5V 1A

10m              Wire 0.5mm red

10m Wire 0.5. black

Step 1: Main Module (Raspberry Pi Pico + Sound Detector)

The main module contains Raspberry pi Pico microcontroller, SparkFun SoundDetector(SEN-12642), Pin-strip (90 decrees angle, 20 pins, and 2,54 pin spacing) and JST RCY connector to connect battery.


Solder:

  • battery JST connector + to VSYS(pin 39) and - to GND(pin 38)
  • Pin list to the whole left side (pins 1-20)
  • Sound detectors connections:

VCC to 3v3(pin 36)

GND to AGND(33)

AUDIO to ADC0(31)

ENVELOPE to pin 21

GATE to pin 22

(Sound detector's gain can be adjusted with a resistor, I have used 12k resistor in R17 spot

to lower gain about 20 DB, resistor in in R17 affects the values in the code.)


3D printing:

Print the main module box and lid. I have used PETG filament. It can be printed whit PLA or ABS instead.

  • 0.15 layer height
  • 20% infill


download .stl file for main module.

Step 2: Sewable LED Diffuser

LED difuser is 3D printed with clear PETG filament.

  • 0.1 layer height
  • 100% infill
  • No support


I got best results printing diffusers individualy. If you add multiple diffusers to the same print it might cause bad printing results (parts moving, etc.).



Soldering:


-In the example two LEDs are in series, but can be done also with one led. Adding more than 2 LEDs in same pin needs more current than microcontroller can give. If wanting to do more LEDs in series yo need to add transistor/mosfet acting as switch.

-Dupont connector is solder free. With thin pliers you can achieve good crimping. Adding rubber shrink is advised.

-If you use multiple LEDs, they can share same ground. See schematics.

Sewing:

  • Make a small hole to garment where the LED is (about 3-4mm)
  • Pull soldered LED trough the hole
  • Snap the LED to the diffuser and sew the diffuser like a button


Different approaches:

  • LEDs can be attach also with metal snaps. (See last Photo)


Led diffuser file (.stl)

Step 3: LiPo Battery Charger

Battery charger uses JST RCY connector and a charger module OKY3402-1 Li-ion Battery Micro USB Charger Module Charging Board with 5V 1A. (If your battery has different connector use that, it's adviced not to charge more than 1350mA battery)

3D printing:

  • 0.1-layer height
  • 100% infill
  • PETG, PLA or ABS

Soldering:

  • Make a connector.
  • Crimp connectors to short wires about 1cm.

Solder connector to + and -. Make sure that battery’s + goes to charger + and - to -. (Red to red, black to black!)

Charger box file(.stl)

Step 4: Battery Box

Box for: 3,7V 1350mAh 5x37x59mm LiPo battery.

3D printing:

  • 0.15-layer height
  • 20% infill
  • No support


Assembly:

  • But battery into a box
  • Wires comes out from a small hole on the side of the box
  • Clue lid to a place with super clue (or clue that fits best to used filament material).


Battery box file (.stl)

Step 5: Button

Sewable button cover

Solder:

  • Solder wires to button pins
  • Crimp male Dupont connector to the another ends of the wires
  • Snapp the button to the cover (super clue can be used if fit is too loose).

3D printing:

  • 0.1 leyer height
  • 100% infill

Sewing:

  • Make a small hole to a garment
  • Pull wires trough a hole
  • Snap the button to the cover
  • Sew the button cover like you sew regular buttons

The button works as a programmable button in the main module. Another wire goes to a pin and another to GND (or VCC and pin. It depends if you use pull-up or pull-down in the code).


Button cover file (.stl)

Step 6: Slide Swich ON/OFF

LilyPad Slide Switch

LilyPad Slide Switch can be used as a switch between the battery and the main unit as on/off switch or it can be used as a programmable sliding switch in the main module pins (Pin, GND pull-up or VCC, Pin pull-down).

Solder:

  • Solder wires to the switch
  • Attach JST RCY connector to the ends (no need to cut battery's ready-made wires, just ad swich with the connector)


3D Printing:

  • 0.1-layer height
  • 100% infill

Sewing:

  • Make a small hole to the fabric
  • Pull wires from the hole to the back side of the fabric
  • Snap switch to the sewable cover
  • Sew cover to the fabric

Slide switch file (.stl)

Step 7: Proof of Concept - LED Vest

Vest with 24 LED lights blinking according to sound. Code of the program is written in Arduino programming language. Sound sensor is SparkFun’s sound sensor. LEDs are connected in pairs to the main board. Pairing LEDs enable using LEDs without transistor. Board pins can handle the current of two LEDs on its own. Main logic unit is powered by one Li-Ion battery and distributes power to sensor and LEDs. Wiring between modules is done by a thin electric wire. Wiring is possible to do with a conductive thread, but the connections are not as reliable as with soldered wire.


Battery and main module has their own pockets and all the wiring goes between main garment and lining. Shape of the vest is draped on model. Vest is acting as proof of consept. Vest's code is made with Arduino IDE using Arduino programming language.

Step 8: Code

//Sound reacting LEDs - Louder the sound more leds blink
//Parts - Raspberry pi PICO - SparkFun SoundDetector with 12k resistor in R17 to lower gain - 15 leds
//CC - ShareAlike


#include <Arduino.h>


// Led pins. --- GND is pins 3,8,13 and 18
#define PIN_1 1
#define PIN_2 2
#define PIN_3 4
#define PIN_4 5
#define PIN_5 6
#define PIN_6 7
#define PIN_7 9
#define PIN_8 10
#define PIN_9 11
#define PIN_10 12
#define PIN_11 14
#define PIN_12 15
#define PIN_13 16
#define PIN_14 17
#define PIN_15 19

// Number of leds in pin array.
#define PIN_NUMBER 15


//Led pin that acts as indicator to sound sensor signals.
#define PIN_LED_OUT 20


//arrays for pins - makes random blink possible.
byte PINArray[PIN_NUMBER] = { PIN_1, PIN_2, PIN_3, PIN_4, PIN_7, PIN_6, PIN_7, PIN_8, PIN_9, PIN_10, PIN_11, PIN_12, PIN_13, PIN_14, PIN_15 };


//sound Sensor pins
#define PIN_GATE_IN 22
#define IRQ_GATE_IN 21
#define PIN_ANALOG_IN A0 //PIN 31 as analog input.


//sound soundSensor configuration.
void soundISR() {
int pin_val;


pin_val = digitalRead(PIN_GATE_IN);
digitalWrite(PIN_LED_OUT, pin_val);
}

void setup() {


// open serial port, set the baud rate to 9600 bps. Allows to test sensor functionality with serial monitor.
Serial.begin(9600);


//pinMode to all led pins.
for (int i = 0; i < PIN_NUMBER; i++) {
pinMode(PINArray[i], OUTPUT);
}
// configure soundSensor input to interrupt.
pinMode(PIN_GATE_IN, INPUT);
attachInterrupt(IRQ_GATE_IN, soundISR, CHANGE);
}

void loop() {


int value;


// Check the envelope input.
value = analogRead(PIN_ANALOG_IN);
// Convert envelope value into a message.
Serial.print("Status: ");


// If sound is low one random led blinks at half second intervals.
// Note: with changing values you can manipulate the sound sensors acting values.
if (value <= 515) {
Serial.println("Quiet.");
digitalWrite(PINArray[random(15)], HIGH);
delay(500);
digitalWrite(PINArray[random(15)], LOW);
delay(500);
}


// If sound is moderate random 3 leds blinks at quarter second intervals.
if ((value > 515) && (value <= 520)) {
Serial.println("Moderate.");
digitalWrite(PINArray[random(15)], HIGH);
digitalWrite(PINArray[random(15)], HIGH);
digitalWrite(PINArray[random(15)], HIGH);
delay(250);
digitalWrite(PINArray[random(15)], LOW);
digitalWrite(PINArray[random(15)], LOW);
digitalWrite(PINArray[random(15)], LOW);
delay(250);
}


//If sound loud, all leds blinks fast.
else if (value > 520) {
Serial.println("Loud.");
digitalWrite(PINArray[15], HIGH);
delay(150);
digitalWrite(PINArray[15], LOW);
delay(150);
}
}

Step 9: Summary & References

Summary

I have tried to achieve a concept of modular learning platform in field of e-textiles. On the age of 3D printing and affordable microcontrollers it's possible to make technology learning easier and more accessible. In this project there has been an attempted to achieve those goals. Parts of the project are on cheaper end. All electronics cost in total about 20-50 € depending on amount of LED’s and the place where the parts are bought. Tools are off course more expensive, that said I assume that places that give technology education has some of them already.

Project has still its problems: the connections to main module could be smaller and more robust. More sensor modules could be fabricated, which would mean more possibilities to innovate one’s own e-textile projects. 

I’m currently thinking modules with light sensor and how to implement motors to e-textile projects.




Reference:


J, Blum. 2020. Exploring Arduino. John Wiley & son, Indianapolis, Indiana.


Arduino Reference

https://www.arduino.cc/reference/en/

Raspberry pi Pico, Datasheet

https://datasheets.raspberrypi.com/pico/pico-datasheet.pdf

SparkFun SoundDetector, Hookup guide

https://learn.sparkfun.com/tutorials/sound-detector-hookup-guide