Are you new to Arduino and looking for an easy project to get started? This simple light sensor project is perfect to help you learn how sensors work. You'll build a small system that automatically turns on a light when it’s dark — using only a few components and an Arduino board.
You can also simulate the whole project online using Tinkercad, so you don’t even need real hardware to start!
Easy Project |
🔧 What You Need
- Arduino Uno or Nano
- LDR (light-dependent resistor)
- 10k ohm resistor
- LED
- 220 ohm resistor
- Breadboard
- Jumper wires
💡 How It Works
An LDR is a special resistor that changes its resistance depending on how much light hits it.
- When it’s bright → low resistance → high voltage
- When it’s dark → high resistance → low voltage
By using a simple voltage divider (LDR + resistor), the Arduino can measure the light level and decide when to turn the LED on or off.
🔌 Wiring the Circuit
Connect the components like this:
You can simulate this setup using Tinkercad Circuits with no hardware required.
💻 The Arduino Code
int ldrPin = A0;
int ledPin = 9;
int threshold = 500;
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int lightLevel = analogRead(ldrPin);
Serial.println(lightLevel);
if (lightLevel < threshold) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
delay(200);
}
📋 Notes
- Adjust the
threshold
value based on your room lighting. - Open the Serial Monitor (9600 baud) to read the light values.
- If your LED doesn’t turn on, try covering the LDR completely.
🧪 Simulate on Tinkercad
No Arduino? No problem! You can test everything in Tinkercad:
- Create a free account on tinkercad.com
- Start a new "Circuit" project
- Add Arduino Uno, LDR, LED, resistors, and wires
- Paste the code and run the simulation
Tinkercad even has a slider to simulate changing light levels!
👉 Open this project directly on Tinkercad and try it yourself.
🚀 Ideas to Go Further
- Add a buzzer that makes sound when it's dark
- Use an OLED screen to display live light levels
- Send data to your phone using an ESP32
- Control a real lamp using a relay module
✅ Conclusion
This is one of the easiest Arduino projects to start with sensors and automation. Whether you're a student, hobbyist, or future engineer, this light sensor project is a great way to learn how to read environmental data and respond to it using code.
You can build it with real components or simulate it entirely online. Either way, it's fun and educational!
0 Comments