Home ARDUINO How to Build a Project Using LDR sensors and Arduino UNO

How to Build a Project Using LDR sensors and Arduino UNO


If we can eliminate darkness, isn’t it cool? In this Arduino project, I released a very simple project that focuses on eliminating darkness. The lamp automatically turns on whenever the room becomes dark due to an electric bulb or other factors. You can even use it as an emergency lighting system. When there is not enough light in the room, use it to turn on the lights automatically.

How to Build a Project Using LDR sensors and Arduino UNO

To detect the intensity of light or darkness, we use a sensor called LDR (Photo Resistor). The LDR is a special type of resistor that allows higher voltages to pass (low resistance) whenever there is high-intensity light and low voltage (high resistance) in the dark. We can use this LDR attribute and use it for our DIY Arduino LDR sensor project.


The system works by sensing the light intensity in its environment. The sensor that can be used to detect light is LDR. It is inexpensive and you can buy it from any local electronics store or online.


How to Build a Project Using LDR sensors and Arduino UNO

When connected to VCC (5V), LDR emits an analog voltage, and the size of VCC is proportional to the input light intensity. That is, the greater the intensity of the light, the greater the corresponding voltage from the LDR. Since LDR issues an analog voltage, it is connected to the analog input pin on the Arduino. The Arduino has an ADC (Analog to Digital Converter) built-in, and then converts the analog voltage (from 0-5V) to a digital value in the range (0-1023). When there is sufficient light in its environment or on its surface, the converted digital value read from the LDR by the Arduino will be in the range of 800-1023.

Collect Hardware


Note:- I have written a post for people looking for the best multimeter for electronics to buy?, do read it If you are interested.

Make the wiring

First connect the LED in series with a 330 Ω resistor to pin 11. “Series” means that the charge particles must flow through the LED and resistor. Then add a 10kΩ resistor in series with the LDR (Light Dependent Resistor) and connect the pin between the LDR and the 10kΩ resistor to the analog input pin A0. The LDR is used as a light sensor; its resistance depends on how much light is shining, and we use this physical property to determine when it is “dark” outside. Your circuit looks like this:

Upload source  

int ledPin = 11;

int sensorInput = A0;


void setup() {

pinMode(ledPin, OUTPUT);



void loop() {

int lightLevel = analogRead(A0);


digitalWrite(ledPin, HIGH);


You may also like to read these awesome articles

How to Build Race Game with Arduino and Nokia LCD module

How to Build Multi-Meter with Arduino UNO and B25 Voltage sensor