
The Automatic Street Light Using LDR project introduces one of the most widely used applications of sensors in embedded systems: Automatic Light Detection.
In this project, an LDR (Light Dependent Resistor) continuously measures the surrounding light intensity. The Arduino reads the sensor value through an analog input and automatically controls an LED based on the ambient light level.
When the environment becomes dark, the Arduino turns the LED ON to simulate a street light. As soon as sufficient light is detected, the LED automatically turns OFF, conserving energy.
This project introduces:
if-else)By completing this project, you'll understand how sensors interact with microcontrollers to automate real-world systems such as street lights, garden lights, and smart home lighting.
Arduino Uno × 1
Breadboard × 1
LDR (Light Dependent Resistor) × 1
LED × 1
10kΩ Resistor × 1
220Ω Resistor × 1
Jumper Wires × 6
USB Cable × 1
Connect the Arduino GND pin to the negative rail of the breadboard.
This creates a common ground connection for the entire circuit.
Insert the LED into the breadboard.
Connect:
Pin 7 through a 220Ω resistorInsert the LDR into the breadboard.
Connect:
5VA0Create a voltage divider by connecting:
10kΩ resistor → Arduino A0Double-check all wiring before powering the circuit.
Ensure the LED polarity is correct and verify that the LDR and resistor form a proper voltage divider.
Important: The LDR and 10kΩ resistor work together as a voltage divider. This allows Arduino to measure changing light levels through the analog input pin.
Arduino continuously reads the voltage from the LDR using the analogRead() function on A0.
The measured value ranges from 0 to 1023, depending on the surrounding light intensity.
The measured value is compared with a predefined threshold.
If the light level falls below the threshold, Arduino recognizes that the environment is dark.
When darkness is detected, Arduino turns the LED ON.
When sufficient light is available, Arduino turns the LED OFF.
The entire process repeats continuously inside the loop() function, allowing the system to respond instantly to changes in ambient light.
After uploading the code:
LED Does Not Turn ON: Check the LED polarity, resistor connections, and verify that the threshold value matches your lighting conditions.
LED Always Stays ON or OFF: Adjust the threshold value in the code after observing the readings in the Serial Monitor.
LDR Values Do Not Change: Verify that the LDR and 10kΩ resistor are connected correctly as a voltage divider.
Upload Errors: Ensure the correct Arduino board and COM port are selected in the Arduino IDE.
By completing this project, you have learned:
analogRead()In Day 8, you'll learn how to use a Buzzer with Arduino to generate different sounds and simple melodies using digital outputs.