The Sensor LDR LM393 is a light sensing module that combines a Light Dependent Resistor (LDR) with an LM393 comparator to provide a digital output signal indicating light intensity. This sensor is widely used in applications such as automatic lighting control, security systems, and environmental monitoring.
Pin Number | Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5V) |
2 | GND | Ground connection |
3 | DO | Digital output signal |
4 | AO | Analog output (not used with LM393) |
// Define the LDR sensor digital output pin
const int LDRPin = 2;
void setup() {
pinMode(LDRPin, INPUT); // Set the LDR sensor pin as input
Serial.begin(9600); // Start serial communication at 9600 baud rate
}
void loop() {
int sensorValue = digitalRead(LDRPin); // Read the sensor value
// Print the sensor value to the Serial Monitor
Serial.println(sensorValue);
delay(500); // Wait for 500 milliseconds
}
Q: Can I use the analog output (AO) with the LM393? A: No, the AO pin is not functional when using the LM393 comparator. The digital output (DO) should be used.
Q: How do I adjust the sensitivity of the sensor? A: Turn the onboard potentiometer clockwise to increase sensitivity (lower light threshold) or counterclockwise to decrease sensitivity (higher light threshold).
Q: What is the purpose of the LM393 in this sensor module? A: The LM393 comparator is used to compare the voltage level from the LDR with a reference voltage set by the potentiometer, providing a digital output when the light level crosses the threshold.