8. Wearables¶
Research¶
Wearable technology is any kind of electronic device designed to be worn on the user's body. Such devices can take many different forms, including jewelry, accessories, medical devices, and clothing or elements of clothing. The term wearable computing implies processing or communications capabilities, but in reality, the sophistication among wearables can vary.
The most sophisticated examples of wearable technology include artificial intelligence (AI) hearing aids, Google Glass and Microsoft's HoloLens, and a holographic computer in the form of a virtual reality (VR) headset. An example of a less complex form of wearable technology is a disposable skin patch with sensors that transmit patient data wirelessly to a control device in a healthcare facility. Tech Target
References & Inspiration¶
-
BBOYHO Prototype Wearable LED Dance Harness
- Thermochromiconductive Top Fab Textiles, Barcelona, 2018
- Adafruit
EXAMPLES IN LAB¶
CHANGE THE COLOR OF FABRICS WITH THERMOCHROMIC PIGMENT¶
STEP 1¶
We mix in quantities according to what color tone we want, as we add more pigment to the white base then we will have a darker color.
STEP 2¶
We prepare our sublimation tools to be able to add the paint.
With some vinyl cuts made with the router we can even make personalized designs.
STEP 3¶
To begin we must make the following circuit, something that is used to make the connections more flexible is to be able to change the conventional cables with conductive tape and conductive wires.
MOSFET is a FET with an insulated gate where voltage determines conductivity of the device and is used for switching or amplifying signals.
This is the connection with the arduino.
We can see that when we activate the circuit the mosfet allows a certain amount of voltage to enter our conductive wire which will heat up and function as a resistance.
int valPoten;
int poten=A0;
int led=D7;
int heat=21;
int mapPot;
void setup() {
pinMode(poten,INPUT);
pinMode(led,OUTPUT);
pinMode(heat,OUTPUT);
Serial.begin(9600);
}
void loop() {
valPoten= analogRead(poten);
mapPot= map(valPoten, 0, 4095, 0, 255);
Serial.println(valPoten);
delay(250);
analogWrite(led, mapPot);
analogWrite(heat, mapPot);
}
CAPACITIVE SENSOR¶
This capacitive sensor is activated when any part of our body touches it. It is a fairly interesting and simple example to make since we only need a piece of metal and a 1mega ohm resistor.
The fact that we can use it with a piece of metal makes it very versatile and gives you many ways to activate it.
#include <CapacitiveSensor.h>
CapacitiveSensor cs_4_2 = CapacitiveSensor(4,2); // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
void setup() {
Serial.begin(115200);
}
void loop() {
long sensor = cs_4_2.capacitiveSensor(30);
Serial.println(sensor);
// if (sensor > 2000) {
// Serial.println("Touching!!!");
// } else {
// Serial.println("Nothing there!!!");
// }
delay(10);
}
STRIP RING¶
Controlling a ring of light is very useful, here is a simple example to do.
#include <Adafruit_NeoPixel.h>
#define PIN 3
#define NUMPIXELS 12
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
#define DELAYVAL 50
void setup() {
pixels.begin();
}
void loop() {
pixels.clear();
for(int i=0; i<NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(0, 120, 100));
pixels.show();
delay(DELAYVAL);
}
for(int i=0; i<NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(0, 0, 0));
pixels.show();
delay(DELAYVAL);
}
}
HEART SENSOR WITH STRIP RING¶
Something interesting that I wanted to achieve is to control this ring of light with the heartbeat, without a doubt it was not easy to do since the pulse sensor that I used reads a lot of noise and it is necessary to filter it, even so it is not perfect.
You can try to do this example with another pulse sensors like MAX30102
I used this code from h artsfw
int pulsePin = 0; // Pulse Sensor purple wire connected to analog pin 0
int blinkPin = 13; // pin to blink led at each beat
int fadePin = 5; // pin to do fancy classy fading blink at each beat
int fadeRate = 0; // used to fade LED on with PWM on fadePin
volatile int BPM; // int that holds raw Analog in 0. updated every 2mS
volatile int Signal; // holds the incoming raw data
volatile int IBI = 600; // int that holds the time interval between beats! Must be seeded!
volatile boolean Pulse = false; // "True" when User's live heartbeat is detected. "False" when not a "live beat".
volatile boolean QS = false; // becomes true when Arduoino finds a beat.
static boolean serialVisual = true; // Set to 'false' by Default. Re-set to 'true' to see Arduino Serial Monitor ASCII Visual Pulse
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 8
#define NUMPIXELS 16
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int delayval = 500; // delay for half a second
//--------------------------------------------------------------------------
void setup(){
pinMode(blinkPin,OUTPUT); // pin that will blink to your heartbeat!
pinMode(fadePin,OUTPUT); // pin that will fade to your heartbeat!
Serial.begin(115200); // we agree to talk fast!
interruptSetup(); // sets up to read Pulse Sensor signal every 2mS
#if defined (__AVR_ATtiny85__)
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
// End of trinket special code.
pixels.begin(); // This initializes the NeoPixel library.
}
void loop(){
serialOutput() ;
if (QS == true){ // A Heartbeat Was Found
// BPM and IBI have been Determined
// Quantified Self "QS" true when arduino finds a heartbeat
fadeRate = 255; // Makes the LED Fade Effect Happen
// Set 'fadeRate' Variable to 255 to fade LED with pulse
serialOutputWhenBeatHappens(); // A Beat Happened, Output that to serial.
QS = false; // reset the Quantified Self flag for next time
}
ledFadeToBeat(); // Makes the LED Fade Effect Happen
delay(20); // take a break
for(int i=0;i<NUMPIXELS;i++){
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(i, pixels.Color(0,0,255)); // Moderately bright green color.
pixels.show(); // This sends the updated pixel color to the hardware.
delay(2); // Delay for a period of time (in milliseconds).
}
}
void ledFadeToBeat(){
fadeRate -= 15; // set LED fade value
fadeRate = constrain(fadeRate,0,255); // keep LED fade value from going into negative numbers!
analogWrite(fadePin,fadeRate); // fade LED
}
MORE COMPLETE EXAMPLE¶
If you want to integrate all the other steps, here I leave some connections with code so that you can carry out the tests.
Basically what it does is that it controls the light ring with the heart rate and by connecting a capacitive sensor, when activated we turn on the circuit to heat the fabric that has thermochromic paint and it changes color.
You can make any custom embroidery, it will change color when the resistance is activated with a signal from the capacitive sensor
It is advisable to use a 9 V battery
Code
int pulsePin = 0; // Pulse Sensor purple wire connected to analog pin 0
int blinkPin = 13; // pin to blink led at each beat
int fadePin = 5; // pin to do fancy classy fading blink at each beat
int fadeRate = 0; // used to fade LED on with PWM on fadePin
volatile int BPM; // int that holds raw Analog in 0. updated every 2mS
volatile int Signal; // holds the incoming raw data
volatile int IBI = 600; // int that holds the time interval between beats! Must be seeded!
volatile boolean Pulse = false; // "True" when User's live heartbeat is detected. "False" when not a "live beat".
volatile boolean QS = false; // becomes true when Arduoino finds a beat.
static boolean serialVisual = true; // Set to 'false' by Default. Re-set to 'true' to see Arduino Serial Monitor ASCII Visual Pulse
int heat=21;
CapacitiveSensor cs_4_2 = CapacitiveSensor(4,2);
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 8
#define NUMPIXELS 16
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int delayval = 500; // delay for half a second
//--------------------------------------------------------------------------
void setup(){
pinMode(heat,OUTPUT);
pinMode(blinkPin,OUTPUT); // pin that will blink to your heartbeat!
pinMode(fadePin,OUTPUT); // pin that will fade to your heartbeat!
Serial.begin(115200); // we agree to talk fast!
interruptSetup(); // sets up to read Pulse Sensor signal every 2mS
#if defined (__AVR_ATtiny85__)
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
// End of trinket special code.
pixels.begin(); // This initializes the NeoPixel library.
}
void loop(){
long sensor = cs_4_2.capacitiveSensor(30);
if (sensor > 2250) {
Serial.println("Touching!!!");
analogWrite(heat, 200);
} else {
Serial.println("Nothing there!!!");
analogWrite(heat, 0);
}
delay(10);
serialOutput() ;
if (QS == true){ // A Heartbeat Was Found
// BPM and IBI have been Determined
// Quantified Self "QS" true when arduino finds a heartbeat
fadeRate = 255; // Makes the LED Fade Effect Happen
// Set 'fadeRate' Variable to 255 to fade LED with pulse
serialOutputWhenBeatHappens(); // A Beat Happened, Output that to serial.
QS = false; // reset the Quantified Self flag for next time
}
ledFadeToBeat(); // Makes the LED Fade Effect Happen
delay(20); // take a break
for(int i=0;i<NUMPIXELS;i++){
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(i, pixels.Color(0,0,255)); // Moderately bright green color.
pixels.show(); // This sends the updated pixel color to the hardware.
delay(2); // Delay for a period of time (in milliseconds).
}
}
void ledFadeToBeat(){
fadeRate -= 15; // set LED fade value
fadeRate = constrain(fadeRate,0,255); // keep LED fade value from going into negative numbers!
analogWrite(fadePin,fadeRate); // fade LED
}