Ameya Angadi
Published © GPL3+

Smart Street Light

A smart street light system that automatically turns the led on when it gets dark.

BeginnerFull instructions provided8,195
Smart Street Light

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
LDR, 5 Mohm
LDR, 5 Mohm
×1
High Brightness LED, White
High Brightness LED, White
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

SMART STREET LIGHT

Code

AUTO_ON_STREET_LIGHT

Arduino
/*AUTO_ON_STREET_LIGHT
  CREATED BY AMEYA ANGADI
  LAST EDITED ON - 19/08/2021
  THIS CODE IS AN EXAMPLE OF AN AUTO ON-OFF STREET LIGHT WHICH AUTOMATICALLY SWITCHES ON WHEN IT GETS DARK AND REMAINS ON UNTILL IT DETECTS ENOUGH LIGHT.
*/

const int ledpin = 13; // ledpin and lightpin are not changed throughout the process
const int lightpin = A2;
const int LIGHT = 10; // sets LIGHT value for light sensor
void setup() {
  Serial.begin(9600);
  pinMode(ledpin, OUTPUT);
  pinMode(lightpin, INPUT);
}
void loop() {
  int lightsens = analogRead(lightpin); // reads analog data from light sensor
  if (lightsens < LIGHT) {
    digitalWrite(ledpin, HIGH); //turns led on
    delay(1500);
  }
  else {
    digitalWrite(ledpin, LOW);
  }
}

Credits

Ameya Angadi
6 projects • 4 followers
Contact

Comments

Please log in or sign up to comment.