Smart Street Light System Using Arduino Uno R4 WiFi

In this project, learners explore how smart systems save energy and improve community safety using Arduino and sensors. They program street lights to turn ON at night and OFF during the day, just like real lights in towns and cities. We have included extra challenges that encourage learners to experiment with sensor sensitivity and timing, making learning fun and hands-on. Through this experience, learners build problem-solving skills, creativity, and environmental responsibility while discovering how automation and smart technology reduce energy waste and support sustainable, smart communities.

ItemPurpose
Arduino Uno R4 WiFiThe main controller that reads the LDR module and controls the street light
BreadboardUsed to connect components easily without soldering
LEDRepresents the street light in the project
LDR ModuleDetects light and darkness to determine day and night
220Ω ResistorProtects the LED from excess current
Jumper WiresConnect all components together
USB CablePowers the Arduino and uploads the program

Here is how each components connect:

LDR Module

  • VCC → connects to the 5V on the Arduino
  • GND → connects to the GND on the Arduino

  • AO (Analog Output) → connects to the analog pin A0 on Arduino

The 3 LEDs

When it gets dark, all 3 LEDs will turn ON together from pin 13.

For each of the 3 LEDs:

  • Identify the long leg (+) and short leg (–) of LEDs.

  • Connect the long leg (+) to one end of a 220Ω resistor.

  • Connect the other end of the resistor to Pin 13 on the Arduino.

  • Connect the short leg (–) directly to GND on the Arduino

Note: During the daytime, bright sunlight shines on the light sensor, and the Arduino can tell that it is bright outside. Because it knows there is enough light, it keeps the street lights turned OFF, saving energy just like real street lights do. When nighttime, arrives and it becomes dark, the sensor notices the change right away. The Arduino then understands that it’s time to help, and the street lights turn ON, lighting up the area to keep everyone safe.

Open the Arduino IDE on your computer and type this code:
// Pin definitions
const int ldrPin = A0; // LDR module analog output
const int ledPin = 13; // All street light LEDs connected here

// Light threshold (adjust if needed)
int threshold = 500;

void setup() {
pinMode(ledPin, OUTPUT); // Set LED pin as output
Serial.begin(9600); // For monitoring light values
}

void loop() {
int lightValue = analogRead(ldrPin); // Read light level

Serial.print("Light Value: ");
Serial.println(lightValue);

// If it is dark, turn ON the street lights
if (lightValue < threshold) {
digitalWrite(ledPin, HIGH);
}
// If it is bright, turn OFF the street lights
else {
digitalWrite(ledPin, LOW);
}

delay(500); // Small delay for stability
}

  1. Connect your Arduino Uno to your computer using the USB cable
  2. In the Arduino IDE, go to:
  • Tools → Board → Arduino Uno
  • Tools → Port → (Select your Arduino port)
  1. Click the Upload button (the right arrow icon).
  2. Watch your project come to life!

CodeWhat It Does
ldrPin = A0Tells Arduino where the LDR is connected
ledPin = 13Sets pin 13 as the street light
thresholdDecides when it is dark or bright
setup()Runs once and prepares the system
analogRead()Reads light level from the LDR
if (lightValue < threshold)Checks if it is dark
digitalWrite(HIGH)Turns ON the street light
digitalWrite(LOW)Turns OFF the street light

  • LED does not turn ON

    • Check LED direction (long leg must be positive)

    • Confirm resistor is connected correctly

  • LED always ON

    • Adjust the threshold value

    • Check LDR wiring

  • No values in Serial Monitor

    • Make sure baud rate is set to 9600

    • Confirm A0 connection

  • How smart street lights work in real cities

  • How sensors collect data from the environment

  • How Arduino makes decisions using if statements

  • How technology saves electricity and protects the environment

  • Basic electronics, coding, and problem-solving skills

  • Add more LEDs to represent multiple street lights

  • Make lights fade ON slowly using PWM

  • Add a button for manual override

  • Use WiFi to turn the street light ON/OFF from a phone

  • Build a mini road model using cardboard