Introduction: Photocell Sensor Garment
Photocell sensor garment connected to sewable LEDs // Coded with Arduino UNO
Step 1: Create the Garment
For my garment I used:
- Organza, wool roving (felted on tulle), and polyester lining with a ribbon to tie the back
Step 2: Code the Photocell With Arduino + Test It Out
This is the code I used:
// Pins
int sensorPin = A0; int lightPin = 3;
// Variables int lightState = 0; int lowThreshold = 70; int highTreshold = 250;
void setup() { // Start Serial & set pin to output Serial.begin(9600); pinMode(lightPin,OUTPUT); }
void loop() {
// read the sensor: int sensorValue = analogRead(sensorPin);
// If light level is low is detected, switch light on if (sensorValue < lowThreshold){ digitalWrite(lightPin, HIGH); } // If light level goes up again, switch the lights off if (sensorValue > highTreshold){ digitalWrite(lightPin, LOW); }
// read the sensor: sensorValue = analogRead(sensorPin);
// apply the calibration to the sensor reading sensorValue = map(lightState, lowThreshold, highTreshold, 0, 255);
// in case the sensor value is outside the range seen during calibration sensorValue = constrain(sensorValue, 0, 255);
// fade the LED using the calibrated value: analogWrite(lightPin, sensorValue);
}
Step 3: Sew the LEDs on With the Circuit + the Photocell
Step 4: Light It Up!
Video:
https://vimeo.com/166504763