LDR Sensor Module Interface With Arduino

77,622

29

8

Introduction: LDR Sensor Module Interface With Arduino

This tutorial teaches the basics on using LDR Sensor Module.

Step 1: Introduction

LDR sensor module is used to detect the intensity of light. It is associated with both analog output pin and digital output pin labelled as AO and DO respectively on the board. When there is light, the resistance of LDR will become low according to the intensity of light. The greater the intensity of light, the lower the resistance of LDR. The sensor has a potentiometer knob that can be adjusted to change the sensitivity of LDR towards light.

Specification:

  • Input Voltage: DC 3.3V to 5V
  • Output: Analog and Digital
  • Sensitivity adjustable

Step 2: Pin Definition

Step 3: Sample Hardware Installation (Analog Output)

Step 4: Sample Source Code

void setup()

{

Serial.begin(9600);

}

void loop()

{

unsigned int AnalogValue;

AnalogValue = analogRead(A0);

Serial.println(AnalogValue);

}

You can also download the sample source code attached below and upload it into Arduino. After that open "Serial Monitor" to see the result.

Step 5: Ways to Open "Serial Monitor"

First way to open "Serial Monitor".

Step 6: Ways to Open "Serial Monitor"

Second way to open "Serial Monitor".

Step 7: Result (1)

The reading shown on Serial Monitor when LDR sensor board is being exposed to sunlight.

Step 8: Result (2)

The reading shown on Serial Monitor when LDR sensor module is kept in a room with very little light /no light.

2 People Made This Project!

Recommendations

  • 3D Printed Student Design Challenge

    3D Printed Student Design Challenge
  • Unusual Uses Contest

    Unusual Uses Contest
  • Laser Challenge

    Laser Challenge

8 Comments

0
Mannan74
Mannan74

Question 3 months ago on Introduction

Hi, can connect the DO directly to on 5mm Led?

0
Renzian
Renzian

Question 2 years ago

I want to use multiple LEDs.What do i need to adjust?

0
omkar2309
omkar2309

Answer 1 year ago

multiple LED as in to display different intensity levels? then simply add if condition for each of these values, set up digital or analog pins as output for LEDs, then turn these LEDs on or off depending on the intensity values.

0
bunglesmate
bunglesmate

2 years ago

Could you include an example for the digital pin? The module I have doesn't have an analogue pin.

0
omkar2309
omkar2309

Reply 1 year ago

it would be just like setting a digital io as input, then read using digitalread(pin), and adjust the threshold using the onboard adjustment pot.

0
ΝεόφυτοςΘ
ΝεόφυτοςΘ

Tip 2 years ago

Ιs this sensor the same as yours?
best regards

LM393 Light Sensor.jpg
0
benjamin.lenestour
benjamin.lenestour

Reply 2 years ago

I think this sensor is a flame sensor, not the good one.