LIGHT DETECTING SENSOR
A Project Report Submitted in partial fulfilment of the
Requirements for the award of the Degree of
BACHELOR OF SCIENCE
(INFORMATION TECHNOLOGY)
By Aniket Bhivaji Lad Roll Number – 443
AND
Yash Prakash Parab Roll Number - 458
DEPARTMENT OF INFORMATION TECHNOLOGY
GURU NANAK KHALSA COLLEGE OF ARTS,
SCIENCE & COMMERCE (Autonomous) MATUNGA,
MUMBAI – 400 019
LDR Light Detecting Sensor
Introduction:
A Light Dependent Resistor (LDR) or a Light Detecting Sensor is a type of sensor
that detects the intensity of light. It is a passive component that changes its
electrical resistance in response to changes in the light intensity falling on it. Light
Dependent Resistor, aptly describes its function as a sensor that changes
resistance based on light intensity. The LDR sensor working in the automated
lighting system efficiently adjusts the brightness based on the ambient light
conditions. The resistance of a photoresistor decreases with increasing incident
light intensity, in other words, it exhibits photoconductivity. A photoresistor can
be applied in light-sensitive detector circuits, and light- and dark-activated
switching circuits.
Components used:
1. LDR (Light Dependent Resistor) Sensor: This is the main component that
detects light. It's like a special kind of resistor that changes its resistance
when light falls on it.
2. LED (Light Emitting Diode): This is an optional component that can be
used to indicate the output of the LDR sensor. It's like a small light bulb
that turns on or off depending on the light detected by the LDR.
3. Jumper Wires: These are small wires used to connect the components
together. They're like bridges that help the components talk to each other.
4. Resistor (R1): This is a small component that helps to control the flow
of electricity in the circuit. It's like a traffic cop that makes sure the
electricity doesn't get too strong or too weak.
5. Arduino Board: This is a small computer that reads the output of the LDR
sensor and does something with it. It's like a brain that makes decisions
based on the light detected by the LDR.
How it works:
1. The LDR sensor detects light and changes its resistance accordingly.
2. The resistor (R1) helps to control the flow of electricity to the Arduino
board.
3. The Arduino board reads the output of the LDR sensor and decides what
to do with it.
4. If an LED is connected, it will turn on or off depending on the output of
the LDR sensor.
Simple Example:
Imagine you want to turn on a light when it gets dark. You can use an LDR sensor
to detect the light, and an Arduino board to turn on the light when it gets dark.
Here's how it would work:
● The LDR sensor detects the light and sends a signal to the Arduino board.
● The Arduino board reads the signal and decides if it's dark or not.
● If it's dark, the Arduino board sends a signal to the LED to turn it on.
● The LED turns on, and you have light!
Pinout:
The LDR typically has two pins:
• VCC (Positive Supply Voltage)
• GND (Ground)
VCC stands for Positive Supply Voltage, which means it's the pin that connects
to the positive side of the power source in your circuit. This pin is necessary for
the LDR to function properly.
GND stands for Ground, which is the reference point in a circuit against which
all other voltages are measured. It's the pin that connects to the negative side of
the power source in your circuit. The GND pin helps to safely dissipate excess
current and provides a common reference point for voltage levels in the circuit.
In simple terms, the VCC pin gives the LDR the power it needs to work, and the
GND pin helps to keep the circuit safe and stable.
Understanding VCC and GND
● VCC is the positive power supply voltage.
● GND is the ground or reference point in a circuit.
● VCC and GND are necessary for the proper functioning of the LDR.
Importance of GND
● Provides a common reference point for voltage levels.
● Safely dissipates excess current.
● Helps to prevent damage to the circuit.
In Summary
● The LDR has two main pins: VCC and GND.
● VCC provides the positive power supply voltage.
● GND provides a common reference point and safely dissipates excess
current.
Working Principle:
The LDR works on the principle of photoconductivity, where the resistance of
the sensor decreases when exposed to light and increases when in darkness. The
sensor is made up of a semiconductor material that has a high resistance in the
absence of light. When light falls on the sensor, it excites the electrons, increasing
the conductivity and reducing the resistance.
Characteristics :
● Sensitivity: The LDR is sensitive to a wide range of light frequencies,
including visible, ultraviolet, and infrared light.
● Response Time: The response time of the LDR is typically around 10-20
milliseconds.
● Dark Resistance: The resistance of the LDR in complete darkness is
typically in the range of 1-10 MΩ.
● Light Resistance: The resistance of the LDR in bright light is typically in
the range of 1-10 kΩ
Applications :
● Light Intensity Measurement: The LDR can be used to measure the
intensity of light in a given area.
● Automatic Lighting Control: The LDR can be used to control lighting
systems, such as streetlights, based on ambient light levels.
● Security Systems: The LDR can be used as a sensor in security systems to
detect intruders or changes in lighting conditions.
circuit :
Source code:
const int ldrPin = A0; // LDR pin connected to analog input A0
const int ledPin = 13; // LED pin connected to digital output 13
void setup() {
pinMode(ledPin, OUTPUT); // Set the LED pin as an OUTPUT
}
void loop() {
int ldrValue = analogRead(ldrPin); // Read the value from the LDR
int lightIntensity = map(ldrValue, 0, 1023, 0, 255); // Map the LDR value to a
0-255 range
// Turn the LED on if light intensity is below the threshold (dark)
if (lightIntensity < 128) {
digitalWrite(ledPin, HIGH); // Turn on the LED
} else {
digitalWrite(ledPin, LOW); // Turn off the LED
delay(100); // Delay for 100 milliseconds