LDR Sensor Module Interface With Arduino

by mybotic in Circuits > Sensors

114553 Views, 32 Favorites, 0 Comments

LDR Sensor Module Interface With Arduino

LDR sensor module.jpg

This tutorial teaches the basics on using LDR Sensor Module.

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

Pin Definition

pin definition.PNG
function of pins.PNG

Sample Hardware Installation (Analog Output)

HARDWARE INSTALLATION.PNG

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.

Ways to Open "Serial Monitor"

serial monitor 1.png

First way to open "Serial Monitor".

Ways to Open "Serial Monitor"

serial monitor 2.png

Second way to open "Serial Monitor".

Result (1)

with light.PNG

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

Result (2)

without light.PNG

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