

The XH-M203 is a temperature and humidity sensor module designed for accurate environmental monitoring. It is commonly used in applications such as weather stations, HVAC (Heating, Ventilation, and Air Conditioning) systems, and other projects requiring precise temperature and humidity data. The module is easy to interface with microcontrollers, making it a popular choice for both hobbyists and professionals.








The XH-M203 module is designed to provide reliable and accurate readings for temperature and humidity. Below are its key technical details:
| Parameter | Specification |
|---|---|
| Operating Voltage | 5V DC |
| Operating Current | ≤ 20mA |
| Temperature Range | -40°C to 80°C |
| Humidity Range | 0% to 100% RH |
| Temperature Accuracy | ±0.5°C |
| Humidity Accuracy | ±2% RH |
| Communication Protocol | Digital (1-Wire or I2C, depending on configuration) |
| Dimensions | 42mm x 24mm x 12mm |
The XH-M203 module typically has a 4-pin interface. Below is the pinout description:
| Pin Number | Pin Name | Description |
|---|---|---|
| 1 | VCC | Power supply input (5V DC) |
| 2 | GND | Ground connection |
| 3 | DATA | Digital data output for temperature and humidity |
| 4 | NC | Not connected (reserved for future use) |
The XH-M203 module is straightforward to use and can be easily integrated into a circuit. Below are the steps and best practices for using the module:
VCC pin to a 5V power supply and the GND pin to the ground of your circuit.DATA pin to a digital input pin on your microcontroller. If using an Arduino, you can use any GPIO pin.DATA pin and VCC to ensure reliable communication.Below is an example of how to use the XH-M203 module with an Arduino UNO:
#include <DHT.h>
// Define the pin where the DATA pin of the XH-M203 is connected
#define DATA_PIN 2
// Define the sensor type (DHT11 or DHT22, depending on your module)
#define SENSOR_TYPE DHT22
// Initialize the DHT sensor
DHT dht(DATA_PIN, SENSOR_TYPE);
void setup() {
Serial.begin(9600); // Start serial communication at 9600 baud
dht.begin(); // Initialize the DHT sensor
Serial.println("XH-M203 Temperature and Humidity Sensor Initialized");
}
void loop() {
// Read temperature and humidity values
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
// Check if the readings are valid
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from XH-M203 sensor!");
return;
}
// Print the readings to the Serial Monitor
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print("%, Temperature: ");
Serial.print(temperature);
Serial.println("°C");
delay(2000); // Wait 2 seconds before the next reading
}
| Issue | Possible Cause | Solution |
|---|---|---|
| No data output | Incorrect wiring or loose connections | Verify all connections and wiring. |
| Inaccurate readings | Environmental interference | Place the module in a stable environment. |
| Failed to initialize the sensor | Incorrect library or sensor type | Ensure the correct library and sensor type are used. |
Data output is always NaN |
Faulty sensor or incorrect pull-up | Check the pull-up resistor and replace the sensor if needed. |
Can the XH-M203 be powered with 3.3V?
No, the module requires a 5V power supply for proper operation.
What is the maximum cable length for the DATA pin?
The maximum cable length depends on the pull-up resistor value and environmental noise. For most cases, keep the cable length under 20 meters.
Can the XH-M203 measure dew point?
The module itself does not calculate dew point, but you can calculate it using the temperature and humidity readings with appropriate formulas.
Is the XH-M203 waterproof?
No, the module is not waterproof. Avoid exposing it to water or high humidity levels beyond its rated range.
By following this documentation, you can effectively integrate and use the XH-M203 module in your projects.