5. E-Textiles and Wearables I

The main purpose of this week’s session is to understand and learn the basics of soft circuits and how to build them using different conductive materials to make sensors, switches and actuators. Moreover, learning how to embed the soft circuits in garments and wearables through soft-hard connections is also highlighted.

Important Concepts

  • Electricity:

Electricity is the flow of electrons around a closed path (i.a. circuit) from negative to positive poles of the battery. The flow of electrons is measured in the direction of the EMF which is acting from positive to negative. While the electrons are moving, an electric current flows in the opposite direction to their movement. In other words, the current moves from high potential/ voltage to low potential/ voltage.

The flow of current is dependant on: 1- The strength of the battery (or source voltage/ EMF).

2- The type of the material used (resistance).

3- The amount of power needed by the load (e.g. light bulb).

  • Resistance and Ohm’s Law:

Electrical Resistance is the property of an electrical element to oppose the flow of the current passing through it when a voltage is applied across the element. Mathematically, it is represented as the ratio of the voltage to current which is referred to as Ohm’s Law.

R=V/I where, R = resistance, V = voltage across the electrical element and I = current flowing through the electrical element.

  • Electric Circuit:

An electric circuit is a closed conductive path where electrons flow due to the effect of electromotive force. The circuit consists of a power source (i.e. AC or DC), electronic components , conductive path (i.e. wires) and a switch (optional). Circuits are usually connected in series or parallel. Where the current is the same for the series circuit and voltage is split (i.e. the summation of the voltage drop across all components equals the supply voltage) and the voltage drop across all components in paralel connections is the same while the current is split.

  • Conductive Materials:

Conductive materials are those which can conduct electricity. Conductive textiles can be made with metal strands woven into the construction of the textile or by conductive yarns which are conductive -metal-coated-. There are several types of conductive materials that are available in the form of fabrics, threads or tapes and inks (check here). There are some common properties that need to be considered when selecting the conductive material such as:

1- Resistance which is usually measured in Ohms per square inch and mentioned in the datasheet.

2- Stretchiness whither it is for woven, knit or nonwoven fabric.

3- Solderability -needs to be tested before using the material-.

4- Substrate and feeling of the material on the body.

  • Continuity Test

This is one of the most important tests in electronics prototyping and testing. It is simply achieved using the multimeter by setting it to the sound wave/ diode icon, refer to the link to understand more about using multimeter to perform different tests. The following figure represents simple illustration to use the multimeter for continuity test.

Soft Electronics

Electronics where the circuit is made of soft connections that enable circuits of being flexible and suitable for wearable applications. In order to embed the electronic circuit within a fabric, the electronic components hard leads need to be treated differently and some special conductive materials need to be used. The two most important conductive materials to explore are; the conductive thread and conductive fabric. Both materials have special conductive properties that allow them to act as conductive path to pass the electric current when the circuit is powered.

Conductive Thread

This is one of the most interesting materials I have even seen! It seems like the regular gray thread; however, if you use the continuety test with the multimeter you will hear "Beep!" which means it is conductive. I have bought some amount of bobbins from Adafruit Inductries for few dollars.

Other than the fact that it is conductive, it is quite thick which make it difficult to deal with and to sew like the regular thread. I have watched the videos below to understand how to deal with conductive thread using hand sewing.

Conductive Fabric

This is another interesting material that has conductive properties/ low resistance and can be used in soft circuits to design traces or some components (e.g. switches and potentiometers). Just like the conductive thread and other conductors, this material has a resistance value that increases with the length of the material. I have ordered EeonTex conductive fabric from Sparkfun and this material has resistance of 8Ohm - 105Ohm/ sq.

The Assignment of the Week

To make at least one analog and one digital sensors and to interface sensors with actuators. Also, to learn how to embedd electronics in wearable applications and how to establish soft-hard connections.

The Used Equipment, Tools and Software

  • Conductive fabric
  • Colored felt
  • Condcutive thread
  • Regular threads
  • Sewing needles
  • Scissors
  • LEDs and Neopexil RGB strip
  • Piezo buzzer
  • Snap buttons
  • Beads
  • Multimeter
  • Breadboard and some electronic components (resistors and voltage regulator)
  • LilyPad board
  • Sewable battery holders
  • Coin cell batteries
  • Long nose jewelry pliers
  • Heat transfer vinyl
  • Silhouette Cameo 3 (Vinyl cutter)
  • Silhouette Studio software
  • TinkerCAD
  • Arduino IDE

The Process

  • Analog and Digital Sensors:

Switches and Push Buttons: In electronics a switch is a small device that can make or break the circuit. There are so many different types of switches and push buttons (momentary switch), however, they all act the same when the button or switch is turned on. Electrically speaking this means that one terminal of the switch is connected to the other making a path for the current to flow. The two terminals are nothing but two conductive parts. In soft circuit the situation is the same except for that the conductive parts need to be soft conductive material such as conductive fabric. The tutorial prepared by Liza has been very useful to make understanding and implementing different soft switches very easy.

  • Toggle switch:

The toggle switch is a type of electrical switch that is identified by the presence of handle that makes it possible to control the switching of electric current/signal from a power supply to a device or within a device. The toggle switch keeps the state according to the position of the handle. The push button does not have this feature as it is momentary switch. In soft circuits, the toggle switch should be represented by two pieces of contactors/ conductors that will sustain the state of switching as long as they are in contact with one another. This can be achieved using two sewable metallic snaps that should be complementary pair. The following figures illustrate this.

In this assignment, I have developed three different projects one to illustrate the concept of digital switch/ sensor, another one to demonstrate the concept of an analog switch/ sensor and the last one was to explore the use of a controller board connected to different circuits using toggle switching.

1- Building soft digital momentory switch

I have followed this tutorial to design the soft switch. First I simply designed the circuit in TinkerCAD software as follows. I have used momentary push button instead of the soft switch and simulated the circuit as follows.

The tools setup:

I have used Silhouette Cameo to cut the design and then to implement it using the iron to transfer the design to fabric. One of my favourite quotation is for Walt Disney; "If you can Dream it, you can do it.".

My design.

Then the leads for the LED should be curled using the pliers to be sewable.

After designing and testing the switch, I have simply added an LED and a battery and I sewed the whole circuit as in the TinkerCAD schematics with the soft switch instead of the push button.

It was very nice and challenging to embed the components into the fabric (felt) especially that the thread is not the regular one. Therefore, I tried to make the components' connections tight and the traces strong and proper. I have also protected the final circuit for short circuit by adding another peice of felt at the back. Before testing the circuit, I have used the multimeter to do the continuity test to ensure the proper connections to the proper terminals.

Testing the soft switch.

The final result was not very satisfactory fo me as the LED was a bit dimpped but it was very great to see the result. A better alternative for the LED could be using one of the LEDs in an LED strip as they are very bright.

2- Building the analog switch

First, I have designed a simple circuit using the same design as the first schematics with push button replced with a 1KOhm variable resistor. When changing the position of the dial the brightness of the LED will change due to the change in resistance and accordingly the amount of current flowing through the circuit.

This project was very interesting for me, I have again used Silhouette Cameo to cut a nice design that can be attached to a shirt but for testing purpose I made a small design on a peice of black felt.

The following image shows the setup for the soft circuit design and sewing.

It was very nice to see the LED illuminating when the golden bead touches the conductive fabric.

When sliding the bead along the conductive fabric, the brightness of the LED was changing as shown in the following video due to the change in resistance.

3- Interfacing a controller board with soft circuits

  • The Designed Circuit

First I have designed the circuit on TinkerCAD and then I have implemented it over a breadboard.

For me, it was more convenient to test the circuit using breadboard and a regular Arduino Uno board. First, I have opened Arduino IDE software and included Adafruit Neopixel library. Then, I have opened one of the examples from Neopixel library "Button Cycler" which is mainly designed to demonstrate using an input device (button) to trigger changes on the lighting pattern of the NeoPixel. When the button is pressed it will change to a neopixel.

I have excecuted the following code and got the result shown in the following video.

  • The Code
// Simple demonstration on using an input device to trigger changes on your
// NeoPixels. Wire a momentary push button to connect from ground to a
// digital IO pin. When the button is pressed it will change to a new pixel
// animation. Initial state has all pixels off -- press the button once to
// start the first animation. As written, the button does not interrupt an
// animation in-progress, it works only when idle.

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
 #include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif

// Digital IO pin connected to the button. This will be driven with a
// pull-up resistor so the switch pulls the pin to ground momentarily.
// On a high -> low transition the button press logic will execute.
#define BUTTON_PIN   10

#define PIXEL_PIN    9  // Digital IO pin connected to the NeoPixels.

#define PIXEL_COUNT 16  // Number of NeoPixels

// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);
// Argument 1 = Number of pixels in NeoPixel strip
// Argument 2 = Arduino pin number (most are valid)
// Argument 3 = Pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)

boolean oldState = HIGH;
int     mode     = 0;    // Currently-active animation mode, 0-9

void setup() {
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  strip.begin(); // Initialize NeoPixel strip object (REQUIRED)
  strip.show();  // Initialize all pixels to 'off'
}

void loop() {
  // Get current button state.
  boolean newState = digitalRead(BUTTON_PIN);

  // Check if state changed from high to low (button press).
  if((newState == LOW) && (oldState == HIGH)) {
    // Short delay to debounce button.
    delay(20);
    // Check if button is still low after debounce.
    newState = digitalRead(BUTTON_PIN);
    if(newState == LOW) {      // Yes, still low
      if(++mode > 8) mode = 0; // Advance to next mode, wrap around after #8
      switch(mode) {           // Start the new animation...
        case 0:
          colorWipe(strip.Color(  0,   0,   0), 50);    // Black/off
          break;
        case 1:
          colorWipe(strip.Color(255,   0,   0), 50);    // Red
          break;
        case 2:
          colorWipe(strip.Color(  0, 255,   0), 50);    // Green
          break;
        case 3:
          colorWipe(strip.Color(  0,   0, 255), 50);    // Blue
          break;
        case 4:
          theaterChase(strip.Color(127, 127, 127), 50); // White
          break;
        case 5:
          theaterChase(strip.Color(127,   0,   0), 50); // Red
          break;
        case 6:
          theaterChase(strip.Color(  0,   0, 127), 50); // Blue
          break;
        case 7:
          rainbow(10);
          break;
        case 8:
          theaterChaseRainbow(50);
          break;
      }
    }
  }

  // Set the last-read button state to the old state.
  oldState = newState;
}

// Fill strip pixels one after another with a color. Strip is NOT cleared
// first; anything there will be covered pixel by pixel. Pass in color
// (as a single 'packed' 32-bit value, which you can get by calling
// strip.Color(red, green, blue) as shown in the loop() function above),
// and a delay time (in milliseconds) between pixels.
void colorWipe(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait);                           //  Pause for a moment
  }
}

// Theater-marquee-style chasing lights. Pass in a color (32-bit value,
// a la strip.Color(r,g,b) as mentioned above), and a delay time (in ms)
// between frames.
void theaterChase(uint32_t color, int wait) {
  for(int a=0; a<10; a++) {  // Repeat 10 times...
    for(int b=0; b<3; b++) { //  'b' counts from 0 to 2...
      strip.clear();         //   Set all pixels in RAM to 0 (off)
      // 'c' counts up from 'b' to end of strip in steps of 3...
      for(int c=b; c<strip.numPixels(); c += 3) {
        strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
      }
      strip.show(); // Update strip with new contents
      delay(wait);  // Pause for a moment
    }
  }
}

// Rainbow cycle along whole strip. Pass delay time (in ms) between frames.
void rainbow(int wait) {
  // Hue of first pixel runs 3 complete loops through the color wheel.
  // Color wheel has a range of 65536 but it's OK if we roll over, so
  // just count from 0 to 3*65536. Adding 256 to firstPixelHue each time
  // means we'll make 3*65536/256 = 768 passes through this outer loop:
  for(long firstPixelHue = 0; firstPixelHue < 3*65536; firstPixelHue += 256) {
    for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
      // Offset pixel hue by an amount to make one full revolution of the
      // color wheel (range of 65536) along the length of the strip
      // (strip.numPixels() steps):
      int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
      // strip.ColorHSV() can take 1 or 3 arguments: a hue (0 to 65535) or
      // optionally add saturation and value (brightness) (each 0 to 255).
      // Here we're using just the single-argument hue variant. The result
      // is passed through strip.gamma32() to provide 'truer' colors
      // before assigning to each pixel:
      strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
    }
    strip.show(); // Update strip with new contents
    delay(wait);  // Pause for a moment
  }
}

// Rainbow-enhanced theater marquee. Pass delay time (in ms) between frames.
void theaterChaseRainbow(int wait) {
  int firstPixelHue = 0;     // First pixel starts at red (hue 0)
  for(int a=0; a<30; a++) {  // Repeat 30 times...
    for(int b=0; b<3; b++) { //  'b' counts from 0 to 2...
      strip.clear();         //   Set all pixels in RAM to 0 (off)
      // 'c' counts up from 'b' to end of strip in increments of 3...
      for(int c=b; c<strip.numPixels(); c += 3) {
        // hue of pixel 'c' is offset by an amount to make one full
        // revolution of the color wheel (range 65536) along the length
        // of the strip (strip.numPixels() steps):
        int      hue   = firstPixelHue + c * 65536L / strip.numPixels();
        uint32_t color = strip.gamma32(strip.ColorHSV(hue)); // hue -> RGB
        strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
      }
      strip.show();                // Update strip with new contents
      delay(wait);                 // Pause for a moment
      firstPixelHue += 65536 / 90; // One cycle of color wheel over 90 frames
    }
  }
}

I have simulated this code in TinkerCAD and got the following patterns.

I replicated the circuit using real components and it was very interesting to see the result.

  • Embedding the LilyPad with the rest of the circuit

Next step is to imbed the design to the fabric. I wanted to design a cute unicorn medal for my niece's bag. I have used colored felt and heat transfer vinyl to design the unicorn.

For making the design convinient I have used LilyPad instead of Arduino Uno board. However, it was very challenging to supply the Neopixel from the LilyPad as it can provide +3.3V only while the Neopixel requires +5V. To fix this power issue, I have supplied the Neopixel strip from Arduino and connected the grounds of the two boards together. To power the LilyPad board, I have used USB cable. For a better design, I need to power the LilyPad using LiPo battery and to use logic level converter to provide +5V from the +3.3V of the LilyPad. I have used snap button instead of the slider switch.

I have tested the circuit by powering the LilyPad and Arduino Uno together.

After that, I secured the circuit on the felt pieces by simply sewing the felt into the back covering layer and I have also applied Kapton tape to places where the conductive thread was not sewed to avoid short circuits.

Final result.

Electronics with Paper Crafting

Embedding simple circuits with simple tools like LEDs and copper tape was very interesting for me to integrate within my craft work. I made a simple birthday card on cardstock paper and designed a simple circuit for an LED that flashes when the cupcake paper is tapped or pressed. The configuration is very simple and is using Flap/ Tap switch as demonistrated in the following diagram.

My birthday card is here :)

Future Improvements

  • Power management: use LiPo battery to power the LilyPad board and then to obtain +5V using the level shifter board.
  • Make the design compact and soft by stuffing it with felt or cotton.
  • Use the sewing machine with the conductive thread to have proper strong connections and to prevent sort circuits that can be achieved using regular thread along with conductive thread as shown in the following video.

DIY Workshop During COVID19 Quarantine

During COVID19 period we have done several interesting workshops realted to e-textiles and wearables. This first workshop was related to input devices such as soft switches; while the second was related to output devices -refer to Wearables II-.

The following video is a basic tutorial for the soft circuits.

Useful References