Project tutorial
Light Sensing Backpack

Light Sensing Backpack

This backpack hopes to create higher visibility for users riding personal electric vehicles.

  • 854 views
  • 1 comment
  • 6 respects

Components and supplies

Apps and online services

About this project

With the rise of personal electric vehicles, safety while using them has become a major issue. This backpack hopes to create higher visibility of the user, allowing other vehicles and pedestrians to see them better. This is achieved by attaching a light sensor to the back of the backpack, and connecting that sensor to a series of LEDs.

Code

Light Sensing BackpackArduino
Light Sensor reads light levels and sends values to LEDs
// Create variables for the pins we'll use:

int sensorPin = A2;
int sensorValue = 0;
int redLED = 6;
int blueLED = A8;

void setup()
{
  // Initialize the sensor pin as an input, but without a pullup
  // (Pullups are only used for switch inputs)
  
  pinMode(sensorPin, INPUT);

  // Initialize the output pins:
  
  pinMode(redLED, OUTPUT);
  pinMode(blueLED, OUTPUT);
 
  // Initialize the serial monitor:

  Serial.begin(9600);
}

void loop()
{
  int sensorValue;

  // Read the sensor value (will be 0 to 1023):

  sensorValue = analogRead(sensorPin);
  sensorValue = map(sensorValue,0,1023,0,255);
  // Print out the sensor reading to the serial monitor:

  Serial.print("sensor value: ");
  Serial.println(sensorValue);

  // Since the sensor value is 0 to 1023,
  // and analogWrite needs a value from 0 to 255,
  // we'll divide the sensor value by four to scale it down:

  analogWrite(redLED,sensorValue -255 / 2);
  analogWrite(blueLED,sensorValue -255 / 2);
  delay(1000);
}

Schematics

Schematic
Screen shot 2019 10 22 at 12 37 47 pm j6hrsc6da3

Comments

Similar projects you might like

The Light Box

Project tutorial by Wpeeters

  • 4,984 views
  • 2 comments
  • 22 respects

Glow Pillow with Force Sensing Resistor

Project tutorial by Rachel Fagan

  • 647 views
  • 0 comments
  • 1 respect

Motion and Light Dependent LEDs

Project in progress by Joaquim Silveira

  • 2,303 views
  • 2 comments
  • 10 respects

The "Tennis Ball" Garage Stop Light

Project tutorial by Team Stuart Mace

  • 10,588 views
  • 2 comments
  • 37 respects

Motion Activated Night Light

Project tutorial by Haziq Afandi

  • 5,598 views
  • 0 comments
  • 6 respects

Controlling LED light intensity using smartphone light senso

Project tutorial by Nikola Travis

  • 2,838 views
  • 0 comments
  • 1 respect
Add projectSign up / Login