9. Wearables¶
Research¶
Martina Fendi Anna Cain I also really liked the application of light on a wearable scarf as shown on the website of https://learn.sparkfun.com/tutorials/lilypad-safety-scarf#understanding-your-circuit
There wasalso this dress that repells people from coming closer that was very playful.
Tools¶
Important advice¶
Short-circuits are very common and it's often the root cause of problems in the circuit :)))
First exercise¶
During the lecture, we made a circuit that can withhold voltage and release it thanks to a MOSFET:
output : heat pad
This circuit has : - a MOSFET - a battery - Arduino board - Resistance 100 ohms - diode - heating pad
Since the heat was not hot enough to show on the swatches of thermoactive paint, I made a video with a blinking program on Arduino with a green LED.
Swatch #1: arm band for biking¶
Reference: daydreaming while biking image
Often when I bike, I let my eyes follow the landscape and when it's night time, I might be dangerous on the street. Therefore I made an arm band for biking that lights up when it's dark and says a message when it's light.
Material needed:¶
- Microbit with light detector and LED screen included - 3 neopixels - conductive yarn
1. I embroidered with the machine some conductive yarn on a shell fabric. 2. I hand sewn the neopixels 3. I coded on Microbit
Here is the Javascript reading :
let level = 0
let strip = neopixel.create(DigitalPin.P0, 3, NeoPixelMode.RGB)
basic.forever(function () {
if (input.lightLevel() == 0) {
level = input.lightLevel()
basic.showNumber(level)
led.plotBarGraph(
input.lightLevel(),
255,
true
)
strip.showColor(neopixel.colors(NeoPixelColors.Violet))
basic.showString("SLOW DOWN")
} else {
strip.showColor(neopixel.colors(NeoPixelColors.Black))
basic.showString("DAY DREAMING")
}
})
Swatch #2: rotating hood¶
I love this precious design from Hussein Chalayan, it's from is AW'07 collection. Such a visonnary.
I tested motors and soft connections. Motors worked with my circuit from the first exercise. I discovered thanks to my classmates Annabel and Claire that long soft connections were not conductive enough for my rotating hood circuit.
Diagram of circuit¶
PIR VCC → 5V
PIR GND → GND
PIR OUT → Arduino pin 2
Servo signal → Arduino pin 9
Servo VCC → external 5V recommended (or Arduino 5V if servo current is low)
Common ground between Arduino and servo/external supply
Code that includes a servo and a movement sensor¶
#include <Servo.h>
// --- Configurable pins & timings ---
const int pirPin = 2; // PIR sensor output
const int servoPin = 9; // Servo signal pin (PWM capable)
const int startAngle = 0; // starting angle
const int endAngle = 180; // end angle to move to
const int stepDelay = 8; // ms delay between angle steps (smaller -> faster, larger -> smoother)
const int holdAtEnd = 1500; // how long to hold at 180° (milliseconds)
const int holdAtStart = 300; // how long to hold at 0° after returning (milliseconds)
const unsigned long pirDebounce = 50; // debounce for PIR (ms)
// --- Globals ---
Servo myServo;
int lastPirState = LOW;
unsigned long lastPirChangeTime = 0;
bool motionHandled = false;
void setup() {
pinMode(pirPin, INPUT);
myServo.attach(servoPin);
myServo.write(startAngle);
delay(500);
lastPirState = digitalRead(pirPin);
Serial.begin(9600);
}
void loop() {
int pirState = digitalRead(pirPin);
unsigned long now = millis();
// simple debounce: accept state change only if stable for pirDebounce ms
if (pirState != lastPirState) {
if (now - lastPirChangeTime >= pirDebounce) {
// state changed and remained for debounce interval
lastPirChangeTime = now;
lastPirState = pirState;
if (pirState == HIGH) {
// rising edge detected
if (!motionHandled) {
Serial.println("Motion started — handling event");
handleMotionEvent();
motionHandled = true; // prevent re-handling while PIR stays HIGH
}
} else {
// falling edge detected (motion ended) -> reset for next detection
Serial.println("Motion ended — ready for next event");
motionHandled = false;
}
}
} else {
// no state change; update lastPirChangeTime so future changes can be debounced properly
lastPirChangeTime = now;
}
// small idle delay to avoid tight loop
delay(10);
}
void handleMotionEvent() {
// Smoothly move from startAngle to endAngle
if (endAngle >= startAngle) {
for (int a = startAngle; a <= endAngle; a++) {
myServo.write(a);
delay(stepDelay);
}
} else {
for (int a = startAngle; a >= endAngle; a--) {
myServo.write(a);
delay(stepDelay);
}
}
delay(holdAtEnd); // hold at end angle
// Smoothly move back to startAngle
if (endAngle >= startAngle) {
for (int a = endAngle; a >= startAngle; a--) {
myServo.write(a);
delay(stepDelay);
}
} else {
for (int a = endAngle; a <= startAngle; a++) {
myServo.write(a);
delay(stepDelay);
}
}
delay(holdAtStart); // small pause at start
}
video of rotating hood






