

The Keyes Humidity Sensor is a versatile electronic component designed to measure the moisture level in the air. It provides both analog and digital outputs, making it suitable for a wide range of applications. This sensor is commonly used in environmental monitoring, weather stations, agricultural systems, and smart home devices. Its compact design and ease of integration with microcontrollers, such as the Arduino UNO, make it a popular choice for hobbyists and professionals alike.








The Keyes Humidity Sensor has a 3-pin interface. Below is the pinout description:
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power supply pin. Connect to 3.3V or 5V DC. |
| 2 | GND | Ground pin. Connect to the ground of the circuit. |
| 3 | OUT | Output pin. Provides an analog voltage proportional to humidity or a digital signal. |
Below is an example of how to connect the Keyes Humidity Sensor to an Arduino UNO:
The following code demonstrates how to read the analog output of the Keyes Humidity Sensor and display the humidity level in the Serial Monitor:
// Define the analog pin connected to the sensor's OUT pin
const int sensorPin = A0;
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
pinMode(sensorPin, INPUT); // Set the sensor pin as input
}
void loop() {
int sensorValue = analogRead(sensorPin); // Read the analog value from the sensor
float humidity = map(sensorValue, 0, 1023, 20, 90);
// Map the sensor value to the humidity range (20% to 90% RH)
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println("%");
delay(1000); // Wait for 1 second before taking the next reading
}
No Output or Incorrect Readings:
Fluctuating Readings:
Digital Output Not Triggering:
Sensor Not Responding:
Q1: Can this sensor measure humidity below 20% or above 90%?
A1: No, the sensor is designed to operate within the range of 20% to 90% RH. Readings outside this range may not be accurate.
Q2: Can I use this sensor with a 3.3V microcontroller?
A2: Yes, the sensor is compatible with both 3.3V and 5V systems.
Q3: How do I know if the digital output is triggered?
A3: The digital output pin will go HIGH or LOW depending on the humidity level and the threshold set by the potentiometer.
Q4: Is this sensor waterproof?
A4: No, the sensor is not waterproof. Avoid direct exposure to water or high humidity for extended periods.
By following this documentation, you can effectively integrate the Keyes Humidity Sensor into your projects for reliable humidity monitoring.