Jacket With Arduino Light Sensor




I love to run. However, I hate exercising in the heat so I only run at night. I have running shoes with reflectors but I have never felt they are all that noticeable at night especially for those distracted drivers. I wanted something more visually effective. I came up with the idea to create a jacket embedded with LED's that when a headlight from a car hits them, they will light up. I haven't made the actual jacket yet, but I have designed the arduino circuit that the LED's on my jacket will use.

Step 1: What You Will Need

* One Arduino with bread board (I used an ArduinoUNO)
* One 470 ohms resistor
* One 10k ohms resistor
* One LED light
* One photo resistor
* Five jumper cables

Step 2: Assembling the Circuit


Step 1: Place the LED on the bread board.
Step 2: Connect pin13 on the Arduino, to the row that the positive leg (anode) on the LED is in.
Step 3: Connect the 470 ohms resistor to negative ground and the row that the negative leg (cathode) on the LED is in.
Step 4: Place the photo resistor on the bread board away from you LED so you have room to connect other pieces.
Step 5: Connect positive ground on the bread board to one leg on the photo resistor.
Step 6: Connect negative ground on the bread board to the other leg on the photo resistor with your 10k ohms resistor.
Step 7: Connect A0 to the row that the 10k ohms resistor and one leg of the photo resistor is in.
Step 8: Connect 5V on the Arduino to positive ground on the bread board.
Step 9: Connect ground on the Arduino to negative ground on the bread board.

Step 3: The Code!

What i did was took a basic LED blink on blink off code and a basic photo resistor code and blended them together and added the ON_VALUE component.
Below is the blended semi-commented code:

int sensorPin = 0;
int ledPin = 13;
int sensorValue = 0;
int ON_VALUE = 820;
//originally 600 but change to accommodate light settings
//Setup runs once
void setup() {
Serial.begin (9600);
pinMode(ledPin, OUTPUT);
//Loop runs continuously
void loop() {
sensorValue = analogRead(sensorPin);
//Check if light source is hitting photoresistor
if (sensorValue > ON_VALUE) {
Serial.println("LED ON");
// Turn LED on
digitalWrite(ledPin, HIGH);
// If no light, then LED off
} else {
Serial.println("LED OFF");
digitalWrite(ledPin, LOW);

Step 4: Seeing It in Action!



    • Party Challenge

      Party Challenge
    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest
    • Gardening Contest

      Gardening Contest



    5 years ago on Introduction

    Wow, this is such a great article! I love it! Super duper helpful!