Ambient light sensor using a photoresistor and Arduino Uno

This project is about using a photoresistor along with an Arduino Uno board to determine the brightness of a room which is bright or average light or dark. A photoresistor which is also called an LDR (LIGHT DEPENDENT RESISTOR) and two LEDs and Breadboard and a 1 k ohm Resistor and 2 resistors for the LEDs which range from 100 ohms to 220 ohms are used. The jumper wires are used to connect Arduino digital pins to the breadboard. The output is displayed through the LEDs and Serial Monitor.

WIRING: The photoresistor is wired into analog pin 0 and a 5V on the right side of the breadboard. It runs through a grounded 1K ohm resistor. An LED on the opposite side of the breadboard into digital pin 13 and grounded a 220-ohm resistor slightly to the right of the first LED, a wired LED of a different color is employed, just with a different digital pin.

Photoresistor working principle:

A photocell or photoresistor is a sensor that changes its resistance when light shines on it. The resistance generated varies depending on the light striking the surface. High intensity of light incident on the surface will cause a lower resistance, whereas a lower intensity of light will cause higher resistance.

WORKING: If the photoresistor reads a value above 450 ohms, it prints “It is quite light!” on the serial monitor and turns all LEDs off. If it reads a value between 230 ohms and 450 ohms, it prints “It is average light!” on the serial monitor and turns on the left LED. This only leaves us with values below 230 ohms to account for. If a value is below 230 ohms, it prints “It is quite dark!” on the serial monitor and turns on both LEDs.

Components setup:


The ambient light sensor is used to control the backlight of LCD-based applications to control the display brightness of mobile for reducing battery life. The applications of this sensor range from consumer electronics to automotive. This is the main benefit of mobile applications.

These devices are used to replicate the sensitivity arc of the person’s eye, allowing mobile displays and the levels of its brightness to be attuned more accurately. These sensors are used in automotive applications like headlight control & cockpit dimming.

The main feature of this sensor is an automatic alteration to save power & to increase the LCD screen’s life in handy display devices. Additionally, these sensors control the backlighting based on the program set by the maker.

This sensor is also used in indoor as well as outdoor lighting for turning on/off which includes street lighting and electronic signals.

LDR photoresistor code