Arduino sensors are the latest trend in the IoT (Internet of Things) world.

They are small, low-cost devices that can be used to measure and control a variety of physical conditions.They can be used for an expansive range of applications, such as:

  •  Monitoring air quality
  • Monitoring soil moisture
  • Monitoring water levels in wells
  • Detecting intruders/burglars
  • Monitoring light levels in the room

This article will focus on photoresistors sensors: What are photoresistors, and how do they work? Let’s get started.

What are sensors?

Sensors are electronic devices that are used to measure different physical phenomena and convert them into electrical signals.

They usually have input connections, output connections, and process circuitry. Sensors can be classified into different types depending on their measurements, such as motion, temperature, gas, light intensity, and ultraviolet light.

We can use a color sensor to shoot lego bricks. Also, we can use the ultraviolet sensor to Keep out of the sun.

What is a photoresistor?

What Are PhotoresistorsA photoresistor is a resistor that changes its electrical resistance in response to light. The photoresistor is a light-controlled variable resistor.

The word “photoresistor” is often used interchangeably with the words “light-dependent resistor” or “LDR”. Photoresistors are used in analog circuits as voltage dividers and can also be used in the automatic exposure control of cameras.

Photoresistors are the most straightforward sensors the Arduino Uno project maker can use. Photoresistors are precise analog devices.

Difference between potentiometers and photoresistors

Difference between potentiometer and photoresistorPotentiometers and photoresistors are two different types of sensors. A potentiometer is a variable resistor with a sliding contact that allows continuous electrical resistance.

A photoresistor is an electrical resistor whose resistance changes when it absorbs light.A potentiometer is used to measure or control the intensity of an electric current, such as in a volume knob on an audio device.

Photoresistors are usually used to measure light levels, often found in photocells and light meters.

We can control the voltage intensity with a knob when using a potentiometer. However, We hold the power of the voltage with light when using a photoresistor.

Photoresistors and Arduino application

The Arduino Uno has a built-in analog input, which can be used to read the voltage from the photoresistor. The Arduino Uno is programmed to take two readings, one with the photoresistor exposed to bright light and one with it in darkness.

The voltage from the analog input is converted into a number between 0 and 1023 by the ADC (analog-to-digital converter) on the Arduino board. This number corresponds to how bright or dark it is where you are measuring.

The photoresistor is a two-legged resistive sensor and is non-polarized. The user can connect the two photoresistor’s legs in either direction in the circuits. In other words, a photoresistor device doesn’t have a plus and a minus.

The concept of a voltage divider

The voltage divider is also known as the potential divider. A voltage divider is an electronic circuit that takes in a higher voltage and outputs a lower one called (Vout) which is a fraction of its input voltage (Vin).

The voltage division is the result of distributing the input among the components of the divider, including resistors.

The voltage divider is also known as the potential divider. This circuit has two inputs and two outputs, one output being the difference between the input voltages, while the other is proportional to the input voltages.

The ratio of these two outputs depends on how many resistors are used in the circuit. Changing the value and number of resistors built into the electrical circuit affects the value of the voltage divider.

The formula adopted for calculating the output value is:Vout = (R1/R1+R2)*Vin

take note

The addition of R1 and R2 is the resistor applied across the series.

Arduino Uno project using a photoresistor

The code of the program

photoresistor sensor code

void setup() {// Preparation serial communication at 9600 bits per second:Serial.begin(9600);}/* An infinite loop gives us the value of the light intensity on the Serial monitor */void loop() {// read the input on analog pin A3:int sensorValue = analogRead(A3);/* Print the values consecutively on the screen to read.Note the change of values. */Serial.println(sensorValue);delay(150);}

The output of the program

With glowing lighting

photoresistor with glowing lighting

With medium lighting

photoresistor with medium lighting

With the dark

photoresistor with the dark


conclusion of the articleSensors are not only used to measure the environment but also to control objects, such as a photoresistor.The use of sensors in different industries is very diverse. They can be used for everything from measuring water quality in a river, detecting intruders in a warehouse, and monitoring the oil pipeline’s condition.

Pin It on Pinterest

Share This