Stufin
Home Quick Cart Profile

5mm LDR (Light Dependent Resistor)

Buy Now

Component Name

5mm LDR (Light Dependent Resistor)

Overview

The 5mm LDR (Light Dependent Resistor) is a type of variable resistor that changes its resistance in response to changes in the intensity of incident light. This component is widely used in various applications, including robotics, automation, and IoT projects, where light sensing is required.

Functionality

The 5mm LDR works by converting light into an electrical signal. When light falls on the LDR, the resistance between its two terminals decreases, allowing more current to flow. Conversely, when the light intensity decreases, the resistance increases, reducing the current flow. This property makes the LDR an ideal component for detecting and measuring light levels in various applications.

Key Features

  • Light Sensitivity: The 5mm LDR is highly sensitive to light, allowing it to detect even slight changes in light intensity.
  • Variable Resistance: The resistance of the LDR changes in response to changes in light intensity, making it an ideal component for converting light into an electrical signal.
  • Small Form Factor: The 5mm LDR has a compact size, making it suitable for use in space-constrained applications.
  • Low Power Consumption: The LDR requires minimal power to operate, making it suitable for battery-powered or low-power applications.
  • Wide Operating Range: The 5mm LDR can operate over a wide range of temperatures (-20C to 70C) and humidity levels.
  • Fast Response Time: The LDR responds quickly to changes in light intensity, making it suitable for real-time applications.
  • Low Cost: The 5mm LDR is a cost-effective component, making it an attractive option for many applications.

Technical Specifications

Resistance Range

100 to 1M

Sensitivity

1-10 k/lux

Response Time

<5ms

Operating Temperature

-20C to 70C

Operating Humidity

20% to 80%

Power Consumption

<1mA

Dimensions

5mm x 2.5mm x 1.5mm (L x W x H)

Typical Applications

  • Light-Based Automation: The 5mm LDR is used in automation systems to detect and respond to changes in light levels, such as controlling lights, fans, or other appliances.
  • Robotics and Mechatronics: The LDR is used in robotics and mechatronics projects to detect and navigate through varying light conditions.
  • Environmental Monitoring: The 5mm LDR is used to monitor and track light levels in environmental monitoring applications, such as air quality monitoring or weather stations.
  • Security Systems: The LDR is used in security systems to detect intruders or changes in light levels, triggering alarms or other responses.

Pinout and Connections

The 5mm LDR has two terminalsone for the positive leg (Anode) and one for the negative leg (Cathode). The pinout is as follows:
Anode (Positive Leg)Connected to the power source (Vcc) or the positive terminal of a voltage source.
Cathode (Negative Leg)Connected to the ground (GND) or the negative terminal of a voltage source.

In summary, the 5mm LDR is a versatile component that offers a range of features and benefits, making it an essential component in various applications, including robotics, automation, and IoT projects.

Pin Configuration

  • 5mm LDR (Light Dependent Resistor) Component Documentation
  • Overview
  • The 5mm LDR (Light Dependent Resistor) is a type of variable resistor that changes its electrical resistance in response to changes in light intensity. It is commonly used in IoT projects for light sensing applications, such as automatic lighting control, UV detection, and optical switches.
  • Pin Description
  • The 5mm LDR typically has two leads (pins) that are used to connect it to a circuit. Here's a breakdown of each pin:
  • Pin 1:
  • Description: One end of the light-dependent resistor
  • Function: Connects to the positive leg of the power source or a voltage divider circuit
  • Typical Connection: Connect to VCC ( Positive Power Supply) or a pull-up resistor
  • Pin 2:
  • Description: The other end of the light-dependent resistor
  • Function: Connects to a microcontroller's analog input pin, a comparator, or a voltage divider circuit
  • Typical Connection: Connect to an analog input pin of a microcontroller (e.g., Arduino's A0-A5) or a comparator circuit
  • Connection Structure
  • Here's a step-by-step guide to connecting the 5mm LDR:
  • 1. Connect Pin 1 (Positive Leg) to:
  • VCC (Positive Power Supply) using a 1 k to 10 k resistor as a pull-up resistor (recommended)
  • A voltage divider circuit (e.g., 1 k and 2 k resistors) to create a reference voltage
  • 2. Connect Pin 2 (Negative Leg) to:
  • An analog input pin of a microcontroller (e.g., Arduino's A0-A5)
  • A comparator circuit (e.g., LM339 or LM324) to compare the LDR's resistance with a reference voltage
  • A digital input pin of a microcontroller, but only if the LDR is used as a simple on/off switch (not recommended for accurate light measurement)
  • Important Notes:
  • Ensure the power supply voltage and current ratings are within the LDR's specified limits.
  • Use a pull-up resistor or voltage divider circuit to prevent the LDR from drawing excessive current when connected directly to a power source.
  • The LDR's resistance changes with light intensity, so it's essential to use a suitable circuit configuration and programming to interpret the output correctly.
  • By following these guidelines, you can effectively integrate the 5mm LDR into your IoT project and utilize its light-sensing capabilities.

Code Examples

5mm LDR (Light Dependent Resistor) Component Documentation
Overview
The 5mm LDR (Light Dependent Resistor) is a photoresistor that changes its resistance in response to changes in light levels. It is a popular component in IoT projects, often used for ambient light sensing, automatic lighting control, and other applications where light detection is required.
Specifications
Diameter: 5mm
 Resistance range: 1k (bright light) to 10M (dark)
 Power rating: 1mA (max)
 Operating voltage: 5V (max)
 Response time: 10-20 ms
Pinout
The 5mm LDR has two pins:
Pin 1: One end of the resistor
 Pin 2: The other end of the resistor
Usage
The 5mm LDR can be used in various contexts, including:
### Example 1: Ambient Light Sensing with Arduino
In this example, we'll use the 5mm LDR to detect ambient light levels and adjust an LED's brightness accordingly.
Hardware
5mm LDR
 Arduino Board (e.g., Arduino Uno)
 LED
 220 resistor
 Breadboard and jumper wires
Code
```cpp
const int ldrPin = A0;  // Analog input pin for LDR
const int ledPin = 9;   // Digital output pin for LED
int ldrValue = 0;       // Variable to store LDR reading
void setup() {
  pinMode(ledPin, OUTPUT);
}
void loop() {
  ldrValue = analogRead(ldrPin); // Read LDR value (0-1023)
  int brightness = map(ldrValue, 0, 1023, 0, 255); // Map LDR value to LED brightness (0-255)
  analogWrite(ledPin, brightness); // Adjust LED brightness
  delay(50);
}
```
Explanation
In this example, we connect the 5mm LDR to analog input pin A0 on the Arduino board. We read the LDR value using `analogRead()` and map it to an LED brightness value using `map()`. Finally, we adjust the LED's brightness using `analogWrite()`.
### Example 2: Automatic Lighting Control with Raspberry Pi
In this example, we'll use the 5mm LDR to control a relay module, which will turn a lamp on or off based on ambient light levels.
Hardware
5mm LDR
 Raspberry Pi (e.g., Raspberry Pi 3)
 Relay module (e.g., SRD-05VDC-SL-C)
 Lamp
Code
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO pin for LDR
ldr_pin = 17
GPIO.setmode(GPIO.BCM)
GPIO.setup(ldr_pin, GPIO.IN)
# Set up GPIO pin for relay
relay_pin = 23
GPIO.setup(relay_pin, GPIO.OUT)
while True:
    ldr_value = GPIO.input(ldr_pin)  # Read LDR value (0 or 1)
    if ldr_value == 0:  # If dark
        GPIO.output(relay_pin, GPIO.HIGH)  # Turn lamp on
    else:
        GPIO.output(relay_pin, GPIO.LOW)  # Turn lamp off
    time.sleep(1)
```
Explanation
In this example, we connect the 5mm LDR to GPIO pin 17 on the Raspberry Pi. We read the LDR value using `GPIO.input()` and control the relay module using `GPIO.output()`. If the ambient light level is low (dark), we turn the lamp on; otherwise, we turn it off.
Remember to adjust the threshold value and relay pin according to your specific setup.