Getting Started with Light Sensor Module (SN-LIGHT-MOD)

Getting Started with Light Sensor Module (SN-LIGHT-MOD)

Last Updated on 6 July 2017
This article is written by internship student Tian Fu Loke


INTRODUCTION

SN-LIGHT-MOD is a photosensitive resistor module, suitable to detect environmental light intensity and ambient brightness. Its sensitivity can be tuned with an on board potentiometer, where turning it clockwise will increase the sensitivity and increase the detection range.

FEATURES of Light Sensor Module (SN-LIGHT-MOD)

  • Comes with a high-quality light dependent resistor (LDR).
  • Equipped with an on-board potentiometer to adjust light brightness threshold.
  •  Digital output
  • Fixed bolt hole for convenient installation
  • Uses LM393 wide range voltage comparator
  • LED indicator – ON when ambient light exceeds threshold
  • Operating Voltage is 3.3-5 V
  • Dimensions: 3.2cm x 1.4cm

OBJECTIVE

To introduce the basic steps on how to use SN-LIGHT-MOD with Arduino UNO to detect the light brightness in the environment and decide to switch OFF or ON light.

HARDWARE REQUIREMENT

SOFTWARE REQUIREMENT

Arduino IDE

HARDWARE SETUP

Set up your hardware based on the picture below (Analog and Digital pin assignment may vary according to your needs.)

SAMPLE CODE

int ldrPin = 7;
int ledPin= 12;
int val = 0;
void setup() {
  pinMode(ldrPin, INPUT);
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}
 
void loop() {
  int val = digitalRead(ldrPin);
  Serial.println(val);
 
  if(val == HIGH ){
    digitalWrite(ledPin, HIGH);
    Serial.println("LED ON");
  }
  else{
    digitalWrite(ledPin, LOW);
    Serial.println("LED OFF");
  }
}

VIDEO

Note: For further inquiry, please visit our technical forum as we seldom check the comment here. ?