Arduino Uno Light Sensor Project (Automatic LED Control)
This project uses a Light Dependent Resistor (LDR) to detect light intensity and control an LED automatically. When the room is dark, the LED turns ON, and when it’s bright, the LED turns OFF. This is a basic example of how light sensors are used in real-life applications such as street lights and smart lamps.
Components Required
- Arduino Uno
- 1 × LDR (Light Dependent Resistor)
- 1 × 10kΩ resistor
- 1 × LED
- 1 × 220Ω resistor (for LED)
- Breadboard and jumper wires
Circuit Connections
- LDR one leg → 5V
- LDR other leg → Analog Pin A0 and 10kΩ resistor → GND
- LED Anode (+) → Pin 13 (with 220Ω resistor)
- LED Cathode (–) → GND
Arduino Code
// Arduino Light Sensor Project
int ldrPin = A0; // LDR connected to analog pin A0
int ledPin = 13; // LED on pin 13
int ldrValue = 0;
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
ldrValue = analogRead(ldrPin);
Serial.print("Light Value: ");
Serial.println(ldrValue);
if (ldrValue < 500) { // Adjust threshold as needed
digitalWrite(ledPin, HIGH); // LED ON when dark
} else {
digitalWrite(ledPin, LOW); // LED OFF when bright
}
delay(500);
}
How It Works
The LDR changes its resistance based on light. Arduino reads this value from the analog pin. If the light level is low, the LED turns ON automatically. This project teaches how to use analog sensors in real-world applications.
Top Affordable Arduino Alternatives: Discover ELEGOO Boards & Kits
Getting started in electronics often leads you to Arduino, but the official boards can be pricey. That’s where ELEGOO shines. Known for their budget-friendly yet high-quality components, ELEGOO provides fully Arduino IDE-compatible boards and kits that are perfect for beginners and advanced users alike. Here's an in-depth look at four standout ELEGOO options, their benefits, downsides, and how they compare to official Arduino products.
1. ELEGOO MEGA R3 Board (ATmega2560)

Price: $22.99
Rating: 4.7 ★ (3,157 reviews)
2. ELEGOO UNO R3 Controller (ATmega328P)

Price: $13.99
Rating: 4.7 ★ (56 reviews)
3. ELEGOO Basic UNO Starter Kit

Discount Price: $19.54 (was $22.99)
Rating: 4.6 ★ (1,973 reviews)
4. ELEGOO Most Complete Starter Kit V2.0

Price: $65.99
Rating: 4.6 ★ (156 reviews)
Conclusion
The Arduino Light Sensor Project is a great beginner exercise to understand how sensors interact with microcontrollers. It can be extended to build automatic street lights, night lamps, or solar trackers. For budget-friendly learning, ELEGOO kits are an excellent choice to explore Arduino projects with plenty of components included.
Keep learning, keep building, and automate your world step by step.
0 Comments