![](https://electroboat.in/uploads/media/2024/51bsvQZCQQL__AC_UF1000,1000_QL80_.jpg)
![](https://electroboat.in/media/image?path=uploads/media/2024/61pBEnf2nML.jpg&width=620&quality=80)
![](https://electroboat.in/media/image?path=uploads/media/2024/51bsvQZCQQL__AC_UF1000,1000_QL80_.jpg&width=175&quality=80)
![](https://electroboat.in/media/image?path=uploads/media/2024/61pBEnf2nML.jpg&width=172&quality=80)
![](https://electroboat.in/media/image?path=uploads/media/2024/51bsvQZCQQL__AC_UF1000,1000_QL80_.jpg&width=300&quality=80)
![](https://electroboat.in/media/image?path=uploads/media/2024/61pBEnf2nML.jpg&width=300&quality=80)
LDR Sensor Module
LDR is an acronym for Light Dependent Resistor. LDRs are tiny light-sensing devices also known as photoresistors. An LDR is a resistor whose resistance changes as the amount of light falling on it changes. The resistance of the LDR decreases with an increase in light intensity, and vice-versa
₹ 38 ₹89
89
Add FAQ
An LDR (Light Dependent Resistor) module is a simple electronic component used to measure light intensity. It's commonly used in various applications, including light sensors, light level detection, and automatic lighting systems. Here's a detailed description of the LDR module:
1. Basic Components:
-
LDR (Light Dependent Resistor):
- The core component of the module is the LDR itself. It’s a resistor whose resistance varies inversely with the amount of light falling on it. The more light it receives, the lower its resistance.
-
Resistor:
- A fixed resistor is often included in the module to create a voltage divider circuit with the LDR. This helps convert the varying resistance of the LDR into a measurable voltage.
-
Output Pin:
- The module typically has an output pin where the voltage corresponding to the light intensity can be read by a microcontroller or other electronic devices.
2. Working Principle:
-
Voltage Divider Circuit:
- The LDR is usually connected in series with a fixed resistor. The combination forms a voltage divider circuit. When light intensity changes, the resistance of the LDR changes, which in turn changes the output voltage of the divider circuit.
-
Output Voltage:
- The output voltage is fed to the microcontroller or analog-to-digital converter (ADC) of a device, which can then interpret the light intensity. Typically, the output voltage increases with decreasing light levels and decreases with increasing light levels, due to the nature of the LDR’s resistance characteristics.
3. Types of LDR Modules:
-
Analog LDR Modules:
- These modules provide a continuous voltage output that varies with light intensity. The voltage can be read directly by an analog input pin on a microcontroller.
-
Digital LDR Modules:
- Some LDR modules include a comparator circuit to provide a digital output (high or low) depending on whether the light intensity crosses a certain threshold. This type of module is useful for applications where only a simple on/off signal is needed.
4. Applications:
-
Light Level Measurement:
- Used in various devices to measure ambient light levels, which can then be used for adjusting screen brightness, powering saving features, or providing feedback to users.
-
Automatic Lighting:
- Commonly used in automatic lighting systems to turn on or off lights based on the ambient light level, such as in street lighting or garden lighting systems.
-
Sunlight Detection:
- Can be used in solar tracking systems to detect the direction of sunlight and adjust the position of solar panels accordingly.
-
Simple Light-Activated Alarms:
- Used in light-activated alarms where a change in light intensity triggers an alarm or notification.
5. Example Use Case:
Automatic Night Light:
- Imagine you want to create a night light that turns on automatically when it gets dark. An LDR module can be used to detect the ambient light level. When the light level drops below a certain threshold (indicating it’s dark), the LDR module sends a signal to a microcontroller, which then activates the light.
6. Circuit Connections:
-
Power Supply:
- The module is usually powered by a DC voltage, often in the range of 3.3V to 5V, depending on the design.
-
Signal Output:
- The output from the module can be connected to an analog input pin on a microcontroller if it’s an analog module. For digital modules, the output connects to a digital input pin.
7. Advantages:
-
Simple and Cost-Effective:
- LDR modules are straightforward to use and inexpensive, making them ideal for many basic light-sensing applications.
-
Versatile:
- Can be used in a wide range of applications due to their ability to detect varying levels of light.
8. Limitations:
-
Response Time:
- LDRs can have slower response times compared to other light sensors like photodiodes or phototransistors.
-
Non-linear Response:
- The resistance change with light intensity is not linear, which might require calibration or correction in some applications.
Overall, the LDR module is a versatile and easy-to-use component for detecting and measuring light intensity, suitable for both hobbyist and professional applications.
![](https://adiy.in/wp-content/uploads/2022/04/A87493_LDR-Module_Pin-diagram-scaled.jpg)
import spidev
import time
# Initialize SPI communication
spi = spidev.SpiDev()
spi.open(0, 0) # open SPI bus 0, chip select 0
spi.max_speed_hz = 1350000 # Set SPI clock speed
# Function to read data from MCP3008
def read_adc(channel):
if channel < 0 or channel > 7:
return -1 # Invalid channel
adc = spi.xfer2([1, (8 + channel) << 4, 0]) # Send request to MCP3008
result = ((adc[1] & 3) << 8) + adc[2]
return result
# Function to calculate light intensity from ADC value
def calculate_light_intensity(adc_value):
# Since the MCP3008 returns a 10-bit value (0-1023), we can scale it.
# You can map this range to some value representing light intensity.
# Higher ADC values correspond to lower light levels (brighter environments).
intensity = (adc_value / 1023.0) * 100 # Convert to percentage (0-100%)
return intensity
# Main program loop
try:
while True:
# Read the value from channel 0 (where the LDR is connected)
adc_value = read_adc(0)
print(f"Raw ADC Value: {adc_value}")
# Calculate the light intensity (in percentage)
light_intensity = calculate_light_intensity(adc_value)
print(f"Light Intensity: {light_intensity:.2f}%")
# Wait a bit before the next reading
time.sleep(1)
except KeyboardInterrupt:
print("Program interrupted.")
finally:
spi.close() # Close SPI communication
0 Reviews For this Product
![](https://electroboat.in/uploads/seller/electroboat_logo3.jpeg)