Stufin
Home Quick Cart Profile

LDR Sensor Module (Pack of 25)

Buy Now

Pin Configuration

  • LDR Sensor Module (Pack of 25) Documentation
  • Overview
  • The LDR Sensor Module is a photocell-based light-dependent resistor sensor that measures the intensity of ambient light. This module is commonly used in IoT applications, robotics, and automation projects that require light detection. The pack of 25 modules includes individual sensors with three pins each.
  • Pinout
  • Here's a detailed explanation of each pin on the LDR Sensor Module:
  • ### Pin 1: VCC (Power Supply)
  • Description: This pin provides power to the sensor module.
  • Voltage: Typically operates at a voltage range of 3.3V to 5V.
  • Connection: Connect to a power source (e.g., Arduino, Raspberry Pi, or any other microcontroller's power pin).
  • ### Pin 2: OUT (Output)
  • Description: This pin provides the analog output signal, which varies in response to changes in ambient light intensity.
  • Signal Type: Analog signal (voltage level varies between 0V and VCC).
  • Connection: Connect to an analog input pin on a microcontroller or an ADC (Analog-to-Digital Converter) module.
  • ### Pin 3: GND (Ground)
  • Description: This pin is the ground connection for the sensor module.
  • Connection: Connect to the ground pin on a microcontroller, breadboard, or any other common ground point.
  • Connecting the Pins
  • To use the LDR Sensor Module, follow these connection steps:
  • 1. Power Supply (VCC): Connect the VCC pin to a 3.3V or 5V power source (e.g., Arduino's 5V pin or Raspberry Pi's 3.3V pin).
  • 2. Output (OUT): Connect the OUT pin to an analog input pin on a microcontroller (e.g., Arduino's A0-A5 pins or Raspberry Pi's GPIO pins).
  • 3. Ground (GND): Connect the GND pin to a common ground point on the microcontroller, breadboard, or any other circuit.
  • Example Connection Diagram
  • Here's an example connection diagram for an Arduino Uno board:
  • | LDR Sensor Module Pin | Arduino Uno Pin |
  • | --- | --- |
  • | VCC | 5V |
  • | OUT | A0 |
  • | GND | GND |
  • Note: Make sure to use a 10k resistor in series with the OUT pin to limit the current and prevent damage to the microcontroller.
  • Remember to consult the datasheet and technical specifications of your microcontroller and other components to ensure proper connectivity and compatibility.

Code Examples

LDR Sensor Module Documentation
Overview
The LDR (Light Dependent Resistor) Sensor Module is a low-cost, easy-to-use module designed to detect changes in ambient light levels. This module consists of a light-dependent resistor (LDR) connected to a voltage regulator and an output pin. The output voltage of the module varies in response to changes in light intensity, making it an ideal component for applications such as lighting control, security systems, and robotics.
Technical Specifications
Operating Voltage: 3.3V to 5V
 Output Voltage: 0V to VCC
 Sensitivity: 1-100 lux
 Response Time: 10-50 ms
 Package: 25 pieces per pack
Pinouts
VCC: Power supply pin (3.3V to 5V)
 GND: Ground pin
 OUT: Output pin (analog signal)
Arduino Example: Automatic LED Lighting Control
In this example, we will use the LDR Sensor Module to control an LED light based on the ambient light level.
Hardware Requirements:
LDR Sensor Module
 Arduino Board (e.g., Arduino Uno)
 LED Light
 Breadboard and Jumper Wires
Code:
```c
const int ledPin = 13;  // LED connected to digital pin 13
const int ldrPin = A0;  // LDR sensor output connected to analog pin A0
void setup() {
  pinMode(ledPin, OUTPUT);
}
void loop() {
  int ldrValue = analogRead(ldrPin);
  int lightLevel = map(ldrValue, 0, 1023, 0, 100); // Convert analog value to light level (0-100)
  if (lightLevel < 50) { // If light level is low
    digitalWrite(ledPin, HIGH); // Turn on the LED
  } else {
    digitalWrite(ledPin, LOW); // Turn off the LED
  }
  delay(50);
}
```
Raspberry Pi Example: Day/Night Detection
In this example, we will use the LDR Sensor Module to detect the day/night cycle and print a message to the console accordingly.
Hardware Requirements:
LDR Sensor Module
 Raspberry Pi (e.g., Raspberry Pi 4)
 Breadboard and Jumper Wires
Code (Python):
```python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
ldr_pin = 17  # LDR sensor output connected to GPIO 17
GPIO.setup(ldr_pin, GPIO.IN)
while True:
    ldr_value = GPIO.input(ldr_pin)
    if ldr_value < 500:  # If light level is low
        print("Night time!")
    else:
        print("Day time!")
    time.sleep(1)
```
Note: In this example, we are using the RPi.GPIO library to read the analog value from the LDR sensor. You may need to adjust the threshold value (500) based on your specific setup.
Tips and Variations
To improve the accuracy of the readings, consider adding a capacitor (e.g., 10uF) between the OUT pin and GND to filter out noise.
 Use the LDR Sensor Module in conjunction with other sensors (e.g., temperature, humidity) to create a more comprehensive environmental monitoring system.
 Experiment with different threshold values and control scenarios to tailor the module's behavior to your specific application.