[go: up one dir, main page]

0% found this document useful (0 votes)
13 views3 pages

Practical #06

PRACTICAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

Practical #06

PRACTICAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

 APPLIED PHYSICS LAB

PRACTICAL.#6 .
 NAME:-
ROLL #
 CH.MUHAMMAD USMAN SHAKEEL.
(SSP20-PG03)
 TEACHER:-
( DR.MUJTABA IKRAM )

 ARDUINO LIGHT SENSOR USING


LDR.
 INTRODUCTION:-
 LDR is Light Dependent Resistor.
 LDRs are made from semiconductor materials to enable them to have their
light-sensitive properties.
 There are many types but one material is popular and it is cadmium sulfide
(CdS).
 These LDRs or PHOTO RESISTORS works on the principle of “Photo
Conductivity”.
 Now what this principle says is, whenever light falls on the surface of the
LDR (in this case) the conductance of the element increases or in other
words, the resistance of the LDR falls when the light falls on the surface of
the LDR.
 This property of the decrease in resistance for the LDR is achieved
because it is a property of semiconductor material used on the surface
 In order to detect the intensity of light or darkness, we use a sensor called
an LDR (light dependent resistor).
 The LDR is a special type of resistor that allows higher voltages to pass
through it (low resistance) whenever there is a high intensity of light, and
passes a low voltage (high resistance) whenever it is dark.
 We can take advantage of this LDR property and use it in our DIY Arduino
LDR sensor project.

 Hardware Required:-
 Arduino UNO
 LDR (Light Dependent Resistor)
 Resistor (100k-1;330ohm-1)
 LED - 1
 Relay module - 5v
 Bulb/CFL
 Connecting wires
 Breadboard

 CONNECTIONS:-
 Connect the 3.3v output of the Arduino to the positive rail of the
breadboard
 - Connect the ground to the negative rail of the breadboard
 - Place the LDR on the breadboard
 - Attach the 10K resistor to one of the legs of the LDR
 - Connect the A0 pin of the Arduino to the same column where the LDR and
resistor is connected (Since the LDR gives out an analog voltage, it is
connected to the analog input pin on the Arduino. The Arduino, with its
built-in ADC (Analog to Digital Converter), then converts the analog
voltage from 0-5V into a digital value in the range of 0-1023). - Now
connect the other end of the 10K resistor to the negative rail - And the the
second (free) leg of the LDR to the positive rail
 Pretty much this is what we need for the light sensing. Basic circuits like
this can be done without an Arduino aswell. However, if you want to log
the values and use it to create charts, run other logics etc. I will recomend
an Arduino or ESP8266 or may be a ESP32 for this.
 Now, as we want our circuit to do something in the real world other than
just displaying the values on the computer screen we will be attaching a
LED to the circuit. The LED will turn on when its dark and will go off when
its bright. To achieve this we will:
 - Place the LED on the breadboard
 - Connect the 220ohm resistor to the long leg (+ve) of the LED
 - Then we will connect the other leg of the resistor to pin number 13
(digital pin) of the Arduino
 - and the shorter leg of the LED to the negative rail of the breadboard

 Circuit Diagram:-

 WORKINGS:-
 This system works by sensing the intensity of light in its environment.
 The sensor that can be used to detect light is an LDR. It's inexpensive, and
you can buy it from any local electronics store or online.
 The LDR gives out an analog voltage when connected to VCC (5V), which
varies in magnitude in direct proportion to the input light intensity on it.
 That is, the greater the intensity of light, the greater the corresponding
voltage from the LDR will be. Since the LDR gives out an analog voltage, it
is connected to the analog input pin on the Arduino.
 The Arduino, with its built-in ADC (analog-to-digital converter), then
converts the analog voltage (from 0-5V) into a digital value in the range of
(0-1023).
 When there is sufficient light in its environment or on its surface, the
converted digital values read from the LDR through the Arduino will be in
the range of 800-1023.
 Furthermore, we then program the Arduino to turn on a relay.
Correspondingly, turn on an appliance (light bulb), when the light intensity
is low (this can be done by covering the surface of the LDR with any
object), that is, when the digital values read are in a higher range than
usual.

 CODINGS:-
const int ledPin = 13;
const int ldrPin = A0;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(ldrPin, INPUT);
}
void loop() {
int ldrStatus = analogRead(ldrPin);
if (ldrStatus <= 200) {
digitalWrite(ledPin, HIGH);
Serial.print("Its DARK, Turn on the LED : ");
Serial.println(ldrStatus);
} else {
digitalWrite(ledPin, LOW);
Serial.print("Its BRIGHT, Turn off the LED : ");
Serial.println(ldrStatus);
}

 APPLICATIONS:-
 Light dependent resistors have a low cost and simple structure.
 These resistors are frequently used as light sensors.
 These resistors are mainly used when there is a need to sense the absence and
presence of the light such as :-
 Burglar Alarm Circuits.
 Alarm Clock.
 Light Intensity Meters.
 Main Applications of LDR include Street lights.

You might also like