Aim:
To build a light that turns ON in the dark using an Arduino and LDR.
Requirements:
-
Arduino Uno
-
Breadboard
-
LDR (Light Dependent Resistor)
-
LED
-
220Ω resistor (for LED)
-
10kΩ resistor (for LDR voltage divider)
-
Jumper wires
-
Tinkercad Circuit (or real components)
Steps:
-
Open Tinkercad and create a new circuit.
-
Connect the LDR and 10kΩ resistor in series between 5V and GND. Connect their middle junction to analog pin A0.
-
Connect the LED’s anode to digital pin 9 with a 220Ω resistor, and cathode to GND.
-
In Code Blocks or Arduino IDE, write a program:
-
Read the analog value from the LDR.
-
If the value is below a threshold (i.e., it’s dark), turn LED ON.
-
Else, keep it OFF.
-
-
Test your setup: cover the LDR with your hand to simulate darkness. The LED should turn ON!