5. E-Textiles¶
I found e-textiles fascinating and magical but very far from me. i started this assignement from scratch since electronics is a completely new world. so i started to know its elements and basics. i don't hide the fact that a small mistake can be the cause of your prototype not working. so you have to be patient and persevere to get rewarding results.
Circuit¶
Circuit is a path for Electricity to flow move: stream moving electrons create current how the electronsmove: from + to -
- VOLTAGE (V) is the electrrical force between two points
- CURRENT (I) speed with which the electronic charge flows
- RESISTANCE (R) Ohms amount of material thatresist current flow For measuring voltage,current and resistance we need multimeter
Ohms law: V = I x R
- Electrons are lazy: the electrical energy follows the path of least resistance downwards
- Electricity hates waste: all electrical energy in the circuit must be used
- Circuit is a system: different component play different role in the system of circuit
Materials¶
- we can use any conductive material any material that allowed the energy to pass
- Consider different proprieties : resistance, strechiness solderability, feel substrate + productive process.
Sensors¶
input > information or data that enters the system like a pressed button
-
Digital: is like a switch; immagine is like on/off
-
Analog: range of value, like a spectrum
-
momentary switches > Push the botton only stay open as long as you are pressing the conductive material toghether into contact
- toggle switches > are similar to momentary switch but they stay open so you don't have to press it.
- tilt switches > a conductive bead or pom-pom makes contact with the fabric patches based on location
Analog sensors¶
We can use resistance to get a higher range of values. By passing more current we can change the brightness of an LED, the frequency of a sound or the speed of a motor. Resistance > we can change the resistance in 3 ways
- 1) Distance: resistance increases with distance regardless of material type
- 2) contact > some materials are sensitive to pressure and decrease their resistance when pressure is applied
- 3) surface area > increasing the size of the area where electricity flows decreases resistance
Microcrontollers & Programming¶
Computers > Different computers are designed to do different things
ARDUINO¶
- HARDWARE: electronics physical object
- SOFTWARE: that we use for control the hardware
HYSICAL COMPUTING : is prototyping with the electronics
Components¶
- Boad > Arduino UNO purpose for using Arduino uno: control leds, read sensors, control leds based on interaction with sensors Method to use it: Make a circuit, write circuit code correctly
In the board you can connect input and output devices and connect them to minicontrollers
INPUT/OUTPUT PINS: We use the pins as the Arduino is able to read the voltage (V) through them and also control the volts (V)
Pin PWM: those with the symbol ˜
POWER PINS :
GND > are connected together so you can use whichever one you prefer
5/3.3 V > are always on
- Breadboard
In the bread board, the holes are connected to each other as can be seen in the picture > both vertically +/- and horizontally.
reasoning in lines and not in holes
5V > +
GRD > -
Arduino sketches¶
-
File > New
-
Void Setup and Void loop are critical, without them the sketch will not work
-
Void Setup : everything inside brackets {} works once.
-
Void loop : everything put inside brackets {} works repeatedly.
-
Arduino reads the sketch from top to bottom, line by line.
-
Gray words are notes not commands.
-
Written the sketch > Verify > Load the sketch.
-
ARDUINO REFERENCE : is the Arduino vocabulary that tells you functions and commands with examples. it is easily found on Google
-
Digital Write > ON / OFF Led.
-
Analog Write > intensity Led +
Digital Sensor¶
Simple Switch¶
To create a simple digital sensor, I cut two rectangles of plain fabric with a piece of fabric inside that was conductive on both sides and ran conductive wire over it; creating a sandwich with a sponge inside with a hole in the middle.
Digital sensor switch¶
-
We need to create a structure that has a resistor ( no lower than 5k Ω )
-
I followed the diagram above to connect the board to the breadboard and connected the USB cable to the computer.
-
I opened the Sketch given to us by Emma: 03_ read_DigitalSensor
-
Load Sketch
-
Arduino is now reading the circuit in the Serial Monitor.
Serial Monitor(magnifying glass in the upper right corner or tools > Serial Monitor): this is a tool to display the information sent from the Arduino UNO to the Computer. If I press the switch it shows me the number 0 while if I release it it becomes 1
Serial Plotter (Tools > Serial Plotter): is another way to display the information from the Arduino UNO to the Computer but through a graphical representation.
Digital switch +Led¶
* Disconnect the USB socket when making changes to the circuit.
-
In this case I simply added the led circuit following the diagram
-
I opened the sketch: 04_button_led ( check the sketch matches the circuit created)
-
Check the sketch
-
Plugh Arduino ONE to the Computer.
-
Upload the Sketch
Now when I press the switch the light turns off while if I release it it stays steady.
Analog sensor¶
Digital Switch¶
- Velostat
- Neoprene
- Conductive thread
the way you make your Analog Sensor has a big impact on the functionality of the sensor>(example. when the thread touches the fabric + is your sensor sturdy = more effective) Make the thread position evenly on the fabric, not just partially
Now it is possible to measure with the Multimeter:
-
6kΩ setting
-
you can measure the resistance
-
upon movement the value changes.
Analog sensor in Arduino¶
-
We are going to use Analog Pins ( A0, A1, A2....).
-
Resistors: Fix resistor and Variable resistor.
-
Follow the diagram to place the jumper wires.
-
Plug the USB cable
-
Open the 05_readAnalogSensor sketch.
-
Check if the pin definition is correct
-
Verify > Upload the sketch
-
Open the serial monitor or serial plotter: if I press the switch the numbers go down since the voltage changes.
To display the analog sensor in another graphical way, we can use the SMOOTHING sketch ( Example>Analog>Smoothing).
Load the sketch( remember to check if the pins shown are right).
View Serial potter: You can read how the values vary by pressing the analog sensor (from 0 to 1024).
- Each Analog Sensor has a different min and max this tool allows us to understand the values
Analog Sensor + Led¶
-
Follow the diagram to connect Arduino UNO to the Breadboard.
-
Open 07_ Pressure_led
-
Edit the definition of Analog Sensor map.
Map(analog_sensor_value,230,130,0,225) // You can change it
Constrain(analog_sensor_value,0,225) // You cannot change it
First find out the maximum and minimum variation of your sensor with the help of the SMOOTHING sketch (example: Min = 150 ; Max = 340 )
EXAMPLE:
map(analog_sensor_value,130,230,0,225)
map(analog_sensor_value,150,340,0,225)
Once the sketch is uploaded I can use it by pressing the switch and you will see that it changes light intensity in pressing the switch.