[go: up one dir, main page]

0% found this document useful (0 votes)
76 views4 pages

Ece38 LDR

This document describes using an Arduino with a light dependent resistor (LDR) to sense light levels. It explains that an LDR's resistance decreases when light falls on it, allowing it to act as a light sensor. The document provides circuit diagrams for connecting an LDR to an Arduino analog input pin to read LDR voltage levels, and for using the readings to control LEDs. It includes procedures to test the LDR sensor, determine thresholds to control the LEDs, and design an illumination indicator with a 7-segment LED display.

Uploaded by

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

Ece38 LDR

This document describes using an Arduino with a light dependent resistor (LDR) to sense light levels. It explains that an LDR's resistance decreases when light falls on it, allowing it to act as a light sensor. The document provides circuit diagrams for connecting an LDR to an Arduino analog input pin to read LDR voltage levels, and for using the readings to control LEDs. It includes procedures to test the LDR sensor, determine thresholds to control the LEDs, and design an illumination indicator with a 7-segment LED display.

Uploaded by

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

ECE-38: Microcontrollers-Lab

Task #2
Using Arduino with Light Dependent Resistor
(w/ LED Output)

Introduction
LDR is short for 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”. When light falls on the surface of the LDR 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.

Figure 1 Figure 2 Figure 3

Looking at the graphs in Figure 1, there is a decrease in resistance when the light falls on the surface of the LDR. The Figure 2 at the
right, is the schematic symbol for an LDR. Figure 3 shows different sizes of commercially available LDRs.

LDR used as a sensor

To be able to utilize an LDR as a light sensor, we need to configure it so that it can be able to produce a range
of voltages across it. The voltage will then be proportional to its internal resistance, thus it will be also proportional to
the amount of illumination it receives. One common configuration used is a voltage divider, as shown below.

If we use the value of Vo in this voltage divider configuration with our LDR, we can make it as the sensor voltage signal going into
the Arduino Analog inputs.
Procedure #1 HOW TO USE ARDUINO ANALOG INPUT PINS
The Arduino UNO has 6 analog inputs labeled A0 to A5. Which functions similarly to each other. To familiarize with the use of this
inputs, you need to connect the circuit given below: We will only use A0, although you can use any these inputs as long as you
configure their pin assignments in your code. Connect the circuit shown below using your Arduino and LDR.

Circuit #1
As can be seen from the circuit, the LDR is connected in series with a 20kΩ resistor, and connected between the +5V supply
and the ground. This configuration creates a voltage divider, where the middle terminal is where we will connect the A0 input of our
Arduino board. This configuration is shown in Circuit #1.
The next step is that we will test the LDR if it is working or not. For this, we will display the LDR output reading on the Serial
Monitor of the Arduino Program. Connect the circuit given above and upload the code below in your Arduino, afterwards, open the
Serial Monitor to see the output readings. The Serial Monitor icon can be seen in the upper right corner of the Arduino program.

int sensorPin = A0;

void setup()
{
Serial.begin(9600);
}
void loop()
{
int sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
delay(100);
}

A window will pop-up showing the Serial Monitor displaying a series of random values. These values are the analog values
that are currently being sent to the A0 pin from your LDR. So, if you place your hand on top of the LDR, (block the light) you will
notice the displayed values will decrease. And if you aim a flash light at your LDR, the values will increase. The minimum possible
value for these values is 0, which can be obtained if you completely block 100% of the light going to your LDR. While the maximum
possible value is 1024, which will occur if there is a very high intensity light pointed at your LDR.

1) Completely cover the LDR with a light-proof (dark) cover. What is the lowest value you can get in the serial monitor?
_________________
2) Put a very high intensity light source on top of the LDR. What is the highest value you can get in the serial monitor?
_________________

Ask your instructor to check and verify your work. (30 pts)
Procedure #2 USING ANALOG INPUT TO CONTROL OUTPUT

NOTE: Use a RED LED for LED 1 and GREEN LED for LED 2.
1.) Upload and Run the code, observe the status of the two LEDs. Are both LEDs turned off? ___________(yes/no)
2.) Completely cover the LDR to block it, which LED is turned ON?
________ (LED1/LED2)
3.) Aim a flash light (using your mobile phone) at the LDR, which LED is turned ON?
________ (LED1/LED2)
4.) You can change the value of the 20kΩ resistor in the LDR voltage divider so that you
can adjust the sensitivity of your sensor.

Now, open the serial monitor, and adjust the illumination to the LDR by partially covering it. Using the values displayed in the
serial monitor
a.) Determine the threshold analog value at which the LED 1 starts to turn ON. ______________
b.) Determine the analog value at which the LED 2 starts to turn ON. ______________
c.) What range of analog values does both LEDs turn off? ________________

Ask your instructor to check and verify your work. (30 pts)
Procedure #3 ILLUMINATION INDICATOR
1.) Use an LDR and a 7-segment LED in your circuit.

2.) The 7-segment LED must show the level of illumination that the LDR is receiving.

3.) Output conditions.

a.) When the LDR senses the highest illumination, the 7-segment LED must display .
b.) When the LDR is at ambient/normal illumination, the 7-segment LED must display .
c.) When the LDR senses the lowest illumination, the 7-segment LED must display .

Ask your instructor to check and verify your work. (40 pts)

You might also like