The KY-018 Photoresistor Module by AZ-Delivery is an electronic component that functions as a light sensor. It contains a photoresistor, also known as a light-dependent resistor (LDR), which varies its resistance based on the intensity of light it is exposed to. This characteristic makes the KY-018 suitable for a wide range of applications, such as light level detection, automatic brightness control, and security systems.
Pin Number | Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5V) |
2 | GND | Ground |
3 | A0 | Analog output (voltage proportional to light intensity) |
// KY-018 Photoresistor Module example code for Arduino UNO
int sensorPin = A0; // Select the input pin for the photoresistor
int sensorValue = 0; // Variable to store the value coming from the sensor
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 bits per second
}
void loop() {
sensorValue = analogRead(sensorPin); // Read the value from the sensor
Serial.println(sensorValue); // Print out the value to the Serial Monitor
delay(200); // Wait for 200 milliseconds before reading the value again
}
Q: Can I connect the KY-018 to a digital input? A: Yes, but you will only get a HIGH or LOW signal depending on the light threshold set by the potentiometer.
Q: What is the range of light intensity the KY-018 can detect? A: The KY-018 can detect a wide range of light intensities, but the exact range depends on the resistance of the LDR and the calibration of the onboard potentiometer.
Q: How do I calibrate the sensitivity of the module? A: Turn the onboard potentiometer clockwise or counterclockwise while monitoring the analog output until you reach the desired sensitivity.
Q: Is the KY-018 waterproof? A: No, the KY-018 is not waterproof and should be protected from moisture to prevent damage.