Skip to content

5. E-textiles


What are we doing this week?

Reference

This week has been an exciting journey into the world of electronics and coding as we explored the fundamentals of circuits and their applications. We began by understanding what a circuit is and the various types of circuits, laying the groundwork for our practical learning. Our introduction to Arduino opened up new possibilities, allowing us to dive into coding and control hardware in innovative ways.
As we progressed, we experimented with combining hard materials—like wires and components—with soft materials such as fabrics. This fusion not only enriched our understanding of circuit design but also prepared us for our upcoming assignments, particularly for "Wearables". By creating both digital and analog sensor circuits, we put our lessons to the test.

Tools


What is a circuit?

This week we have explored the basics of circuits, which are essential for powering many of the devices we use every day. A circuit is simply a closed loop that allows electricity to flow. We started by looking at the main parts of a circuit, like resistors, LEDs, and microcontrollers, each of which plays an important role in how electricity moves and works.
We will also learned about the different materials used in making circuits. Understanding how these components and materials interact is crucial for building effective circuits.

Reference

How do they work?

Circuits work by creating a path for electric current to flow. When you connect a power source, like a battery, to various components, electricity travels through the circuit, allowing devices to operate. Here are some key components and their functions:
  1. Power Source: This provides the energy needed to drive the current, commonly a battery or power supply.

  2. Conductors: Wires made of conductive materials, like copper, allow electricity to flow between components. For this assignment we used conductive thread and conductive tape.

  3. Resistors: These limit the amount of current flowing through the circuit. They are crucial for protecting sensitive components, such as LEDs, from too much current.

  4. LEDs (Light Emitting Diodes): These light up when current passes through them. They require a certain amount of voltage and current, so they must be paired with a resistor to prevent damage.

  5. Switches: These allow you to open or close the circuit, controlling whether the current can flow.

Tips for Creating Circuits

Things to Avoid:

  1. Incorrect Component Values: Using the wrong resistor value can lead to too much current flowing to an LED, causing it to burn out. Always calculate the correct resistor value for your components.

  2. Short Circuits: This occurs when there is an unintended path for the current, which can lead to overheating or damage. Ensure connections are secure and well-planned.

  3. Overloading Components: Make sure each component can handle the voltage and current it will receive. Check the specifications to avoid damaging parts.

  4. Poor Connections: Loose or poorly soldered connections can create resistance or intermittent failures. Always ensure good contact between wires and components.

Things to Do:

  1. Plan Your Circuit: Sketch your circuit diagram before building. This helps you visualize the connections and components needed.

  2. Test Your Circuit: Before powering up, double-check connections and component placements. A multimeter can help verify that everything is connected correctly. This step will save you a lot of time!!!

  3. Use a Breadboard: For prototyping, use a breadboard to easily make changes without soldering. This allows for quick testing and adjustments.

  4. Follow the Correct Polarity: Pay attention to the polarity of components like LEDs. Connecting them backward can prevent them from working or damage them.

Reference

Types of circuits

Reference

Building in parallel

Building circuits in parallel is a common method used in electronics that allows components to be connected alongside each other rather than in a single line.

Reference

In a parallel circuit:

  • Multiple Paths: Each component is connected to the same voltage source but has its own path for current to flow. This means that if one component fails, the others can still function.

  • Voltage Consistency: All components in a parallel circuit receive the same voltage, which is equal to the voltage of the power source.

  • Current Division: The total current flowing from the power source is divided among the parallel branches. The amount of current through each branch depends on the resistance of the components in that branch.

  • LEDs: When connecting multiple LEDs in parallel, each one will shine brightly at the same voltage.

Circuit Language

Here is some helpful information you may need to draw a circuit plan and to understands others work.

Reference


Working with Arduino

Reference

This week most important lesson is learning about Arduino, a popular open-source platform that makes it easy to create electronic projects. Arduino includes both hardware —a small programmable board —and software that helps you write code to control various electronic parts. Arduino is used for many different projects, from simple tasks like making an LED blink to more complex creations like robots and smart home devices.

First steps

Getting started with Arduino is both exciting and confusing! So let's take it step by step.
  1. Install the Arduino IDE: Download and install the Arduino Integrated Development Environment (IDE) from the official Arduino website. This is where you'll write and upload your code.

  2. Connect Your Arduino: Use a USB cable to connect your Arduino board to your computer. This will also power the board.

  3. Select Your Board and Port: In the Arduino IDE, go to Tools and select the type of Arduino board you are using. Then select the appropriate port.

  4. Understand the Arduino board:

Reference

Understanding the code

One of the first things you need to know when working with Arduino is understanding that this program works with code. The code is the way you communicate with the Arduino board.
  • int ledPin = 13;: This line sets the LED pin to 13, which is often where the built-in LED is located on Arduino boards.

  • setup() function: This runs once when you power the board. It sets the pin mode for the LED as an output.

  • loop() function: This runs repeatedly. It turns the LED on, waits for a second, turns it off, and waits another second, creating a blinking effect.

Common Problems and Solutions

  1. Upload Issues: If you encounter an error when uploading your code, check that you’ve selected the correct board and port in the Arduino IDE. Also, ensure the board is properly connected to your computer.

  2. LED Not Lighting Up: If the LED doesn’t blink, verify the wiring. Make sure the longer leg of the LED is connected to the correct pin and that the shorter leg is connected to ground (GND).

  3. Code Errors: If you see error messages in the IDE, carefully read them. They often indicate issues. You can also copy the error message and google it.

  4. Power Issues: If the board doesn’t power up, check the USB connection and try a different cable or port.


Results

Digital circuit: Loves me / Loves me not

I created a digital circuit inspired by the classic children's game of picking petals from a flower, asking the question "loves me / loves me not." This art piece combines both visual appeal and interactive elements, inviting viewers to engage with it in a playful way.
To bring this concept to life, I used colorful fabrics to create an embroidered flower design. The petals are crafted to represent the playful nature of the game, each one symbolizing a choice in the “loves me” or “loves me not” game.
Incorporating what we learned this wekk, I integrated a digital circuit using LEDs and a button. When the button is notpressed,the LEDs light up. However, to add an interactive twist, pressing the button turns the lights off.
This project not only showcases the beauty of embroidery and fabric art but also highlights the fun of digital circuits. It demonstrates how technology can enhance traditional play, creating a unique and engaging experience for anyone who interacts with it.

Reference

Reference

Analog sensor: Twinkle, Twinkle, Little Star

I created an analog circuit using the Arduino Uno board, a water sensor, and several LEDs for my art piece, inspired by the children’s song "Twinkle, Twinkle, Little Star." This project combines creativity and technology to create an interactive experience that captures the essence of the song.
To bring the theme to life, I crafted a fabric star, representing the star mentioned in the song. The use of colorful, hand-sewn LEDs adds a whimsical touch, making the star shine brightly.
The circuit incorporates a water sensor that detects the water level. When the sensor is submerged to a certain level, it triggers the LEDs to fade in and out, mimicking the twinkling effect of a star.

Reference

Reference

Here you ca find the Arduino code I used

// Define the pins
int waterSensorPin = A0;  // Water level sensor connected to analog pin A0
int led = 3;           // the PWM pin the LED is attached to
int brightness = 0;    // how bright the LED is
int fadeAmount = 7;    // how many points to fade the LED by

void setup() {
  // Initialize serial communication at 9600 bits per second
  Serial.begin(9600);
  // Initialize the LED pin as an output
  pinMode(led, OUTPUT);
}

void loop() {

  // Read the input on analog pin 0
  int sensorValue = analogRead(waterSensorPin);

  // Print out the value you read
  Serial.print("Water Level: ");
  Serial.println(sensorValue);

  // Check if the water level is above a threshold
  if (sensorValue  > 400) {  // Adjust the threshold as necessary
    analogWrite(led, brightness);

  brightness = brightness + fadeAmount;
    if (brightness <= 0 || brightness >= 255) {
    fadeAmount = -fadeAmount;
  }
  } else {
    digitalWrite(led, LOW);   // Turn the LED off
  }

}

Helpful Codes

int led_pin = 3; //define the pin where the Led is connected

void setup() {

  pinMode(led_pin, OUTPUT); //define pin of the Led as an output

}

void loop() {

  digitalWrite(led_pin, HIGH); //turn the Led on   
  delay(1000);                 //wait 1000millisecond 
  digitalWrite(led_pin, LOW);  //turn the Led off 
  delay(1000);                 //wait 1000millisecond

}
/*
  Fade - part of the Examples of Arduino IDE

  This example shows how to fade an LED on pin 9 using the analogWrite()
  function.

  The analogWrite() function uses PWM, so if you want to change the pin you're
  using, be sure to use another PWM capable pin. On most Arduino, the PWM pins
  are identified with a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11.

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/Fade
*/

int led = 3;           // the PWM pin the LED is attached to
int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by

// the setup routine runs once when you press reset:
void setup() {
  // declare pin 9 to be an output:
  pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  // set the brightness of pin 9:
  analogWrite(led, brightness);

  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade:
  if (brightness <= 0 || brightness >= 255) {
    fadeAmount = -fadeAmount;
  }
  // wait for 30 milliseconds to see the dimming effect
  delay(30);
}
 /* we read the value of a digital sensor connected to pin digital_sensor_pin and
 * we print it on the Serial Monitor
 */

int digital_sensor_pin = 8;     //change the pin, where the sensor is connected?
int digital_sensor_value = 0;

void setup() {
  // put your setup code here, to run once:
  pinMode(digital_sensor_pin, INPUT); //define the pin as INPUT
  Serial.begin(9600);

}

void loop() {
  // put your main code here, to run repeatedly:
  digital_sensor_value = digitalRead(digital_sensor_pin); // read the sensor 

  Serial.println(digital_sensor_value); //print the value
  delay(100);

}
 /* this skecth is a modification of the example button!!
 */

int digital_sensor_pin = 7;     //change the pin, where the sensor is connected?
int digital_sensor_value = 0;
int led_pin = 3; //change the pin of the Led

void setup() {
  // put your setup code here, to run once:
  pinMode(digital_sensor_pin, INPUT);
  Serial.begin(9600);
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(led_pin, OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
  digital_sensor_value = digitalRead(digital_sensor_pin);

  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if(digital_sensor_value == HIGH){
        // turn LED on:
      digitalWrite(led_pin, HIGH);    
  } else {
        // turn LED off:
      digitalWrite(led_pin, LOW);    // turn the LED off by making the voltage LOW

  }  

}
 /* with this sketch we read the analog sensor connected to pin analog_sensor_pin
 */

int analog_sensor_pin = A0;   //change the pin, where the sensor is connected?
int analog_sensor_value = 0;

void setup() {
  // put your setup code here, to run once:
  pinMode(analog_sensor_pin, INPUT);
  Serial.begin(9600);

}

void loop() {
  // put your main code here, to run repeatedly:
  analog_sensor_value = analogRead(analog_sensor_pin); //read the Voltage of the pin sensor

  Serial.println(analog_sensor_value); // print the value on the Serial monitor
  delay(100);

}