Have you ever wanted a light that turns ON automatically when it’s dark and OFF when it’s bright? In this beginner-friendly project, we’ll show you how to build a simple light-sensitive LED control system using an Arduino and an LDR (Light Dependent Resistor) module.
![]() |
Simple LED Auto ON/OFF |
๐ฆ What You’ll Need
To get started, you will need the following components:
![]() |
Components required for this tutorial |
✅ Arduino UNO × 1
✅ 3-pin LDR Module × 1
✅ Jumper Wires × 1
✅ USB cable for Arduino × 1
✅ Resistor 220ฮฉ × 1
✅ Breadboard × 1
๐ ️ Circuit Wiring
Here’s how to connect each component to the Arduino:
![]() |
3-pin LDR module wiring |
3-pin LDR Module
LED and Resistor
✅ LED Anode (long leg) → Digital pin 9 on Arduino
✅ LED Cathode (short leg) → 220ฮฉ resistor → GND on Arduino
![]() |
The connection between components and Arduino |
๐ป Uploading the Code
After wiring everything up, connect the Arduino to your computer using a USB cable. Then, upload the following code, or you can download the code HERE.
int ldrPin = A0; int ledPin = 9; int threshold = 500; void setup() { pinMode(ledPin, OUTPUT); Serial.begin(9600); } void loop() { int ldrValue = analogRead(ldrPin); Serial.println(ldrValue); if (ldrValue < threshold) { digitalWrite(ledPin, HIGH); // It's dark, turn on LED } else { digitalWrite(ledPin, LOW); // It's bright, turn off LED } delay(200); }
![]() |
Open Arduino IDE and copy-paste the code |
๐งช Test the System
๐ Conclusion
This project is a simple yet powerful introduction to sensor-based automation using Arduino. By combining a Light Dependent Resistor (LDR) with an LED, you’ve created a system that can react to ambient light—automatically turning the light ON in the dark and OFF in bright conditions.
๐ฆ Where to Buy
Shopee:
Lazada:
Aliexpress:
๐ฅ Watch the Full Video Tutorial
๐ If you found this guide helpful, share it with fellow makers! For more tutorials, subscribe to our YouTube channel and follow us on social media. ๐
#Arduino #DIYElectronics #LDREngineering #SmartLighting #BeginnerProject #IoT #Maker
No comments:
Post a Comment