The MKE-S12 Rain Water Sensor is an electronic device designed to detect the presence of water, with a particular focus on rain detection. It is a valuable component for weather monitoring systems, automated irrigation systems, and any application where water detection is crucial. By sensing rain, the MKE-S12 can help in conserving water by automating watering processes, alerting users to potential flooding, or simply by providing data for weather analysis.
Pin Number | Name | Description |
---|---|---|
1 | VCC | Connect to 5V power supply |
2 | GND | Connect to ground |
3 | DO | Digital output; goes high when rain is detected |
4 | AO | Analog output; provides an analog signal based on the amount of water detected |
// Define the digital and analog pins
const int digitalPin = 2; // Digital output from the sensor
const int analogPin = A0; // Analog output from the sensor
void setup() {
pinMode(digitalPin, INPUT); // Set the digital pin as input
Serial.begin(9600); // Start serial communication at 9600 baud
}
void loop() {
int analogValue = analogRead(analogPin); // Read the analog value
bool isRaining = digitalRead(digitalPin); // Read the digital value
// Print the analog value to the serial monitor
Serial.print("Analog Value: ");
Serial.println(analogValue);
// Print the rain detection status to the serial monitor
Serial.print("Is it raining? ");
if (isRaining) {
Serial.println("Yes");
} else {
Serial.println("No");
}
// Wait for a second before the next reading
delay(1000);
}
Q: Can the MKE-S12 be used to measure the amount of rainfall? A: The MKE-S12 can detect the presence of rain but is not designed to measure the volume of rainfall.
Q: Is the sensor waterproof? A: The sensor is water-resistant but not fully waterproof. It should not be submerged or exposed to heavy rain without proper shielding.
Q: How do I adjust the sensitivity of the sensor? A: Turn the onboard potentiometer clockwise or counterclockwise to increase or decrease the sensitivity, respectively.
Q: Can the sensor operate at voltages other than 5V? A: The MKE-S12 is designed to operate at 5V. Operating it at a higher voltage may damage the sensor, while a lower voltage may result in inaccurate readings.