Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use XY-MD01 SHT20: Examples, Pinouts, and Specs

Image of XY-MD01 SHT20
Cirkit Designer LogoDesign with XY-MD01 SHT20 in Cirkit Designer

Introduction

The XY-MD01 SHT20 is a digital temperature and humidity sensor module that integrates the SHT20 sensor from Sensirion. It is designed for precise environmental monitoring, offering high accuracy and stability in measuring temperature and relative humidity. The module communicates using the I2C protocol, making it easy to interface with microcontrollers and development boards like the Arduino UNO.

Explore Projects Built with XY-MD01 SHT20

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Battery-Powered Health Monitoring System with Nucleo WB55RG and OLED Display
Image of Pulsefex: A project utilizing XY-MD01 SHT20 in a practical application
This circuit is a multi-sensor data acquisition system that uses a Nucleo WB55RG microcontroller to interface with a digital temperature sensor (TMP102), a pulse oximeter and heart-rate sensor (MAX30102), and a 0.96" OLED display via I2C. Additionally, it includes a Sim800l module for GSM communication, powered by a 3.7V LiPo battery.
Cirkit Designer LogoOpen Project in Cirkit Designer
Wi-Fi Controlled Weather Station with Wemos D1 Mini and OLED Display
Image of izdelie_3: A project utilizing XY-MD01 SHT20 in a practical application
This circuit is a weather monitoring system that uses a Wemos D1 Mini microcontroller to read temperature and humidity data from four DHT22 sensors and display the information on an Adafruit OLED screen. The data is also transmitted via WiFi to an MQTT server for remote monitoring. The system is powered by a 2000mAh battery, which is managed by a TP4056 charging module and a Mtiny Power module.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino-Based Multi-Sensor Environmental Monitoring System
Image of Analog: A project utilizing XY-MD01 SHT20 in a practical application
This circuit is a multi-sensor data acquisition system using an Arduino UNO. It integrates a DHT22 temperature and humidity sensor, an SZH-HWS001 heart rate sensor, an MLX90614 infrared temperature sensor, and a Grove GSR sensor to collect various environmental and physiological data, which are then processed by the Arduino.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Nano-Based Multi-Zone Soil Moisture Monitor with OLED Display
Image of Soil Moisture Sensor Analog: A project utilizing XY-MD01 SHT20 in a practical application
This circuit is designed to collect environmental data using multiple YL-83 modules with YL-69 sondas for soil moisture, and a KY-015 DHT11 sensor for humidity and temperature, all interfaced with an Arduino Nano. Data from the sensors is processed by the Arduino and displayed on an OLED screen, with power supplied by an MB102 Breadboard Power Supply Module.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with XY-MD01 SHT20

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Pulsefex: A project utilizing XY-MD01 SHT20 in a practical application
Battery-Powered Health Monitoring System with Nucleo WB55RG and OLED Display
This circuit is a multi-sensor data acquisition system that uses a Nucleo WB55RG microcontroller to interface with a digital temperature sensor (TMP102), a pulse oximeter and heart-rate sensor (MAX30102), and a 0.96" OLED display via I2C. Additionally, it includes a Sim800l module for GSM communication, powered by a 3.7V LiPo battery.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of izdelie_3: A project utilizing XY-MD01 SHT20 in a practical application
Wi-Fi Controlled Weather Station with Wemos D1 Mini and OLED Display
This circuit is a weather monitoring system that uses a Wemos D1 Mini microcontroller to read temperature and humidity data from four DHT22 sensors and display the information on an Adafruit OLED screen. The data is also transmitted via WiFi to an MQTT server for remote monitoring. The system is powered by a 2000mAh battery, which is managed by a TP4056 charging module and a Mtiny Power module.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Analog: A project utilizing XY-MD01 SHT20 in a practical application
Arduino-Based Multi-Sensor Environmental Monitoring System
This circuit is a multi-sensor data acquisition system using an Arduino UNO. It integrates a DHT22 temperature and humidity sensor, an SZH-HWS001 heart rate sensor, an MLX90614 infrared temperature sensor, and a Grove GSR sensor to collect various environmental and physiological data, which are then processed by the Arduino.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Soil Moisture Sensor Analog: A project utilizing XY-MD01 SHT20 in a practical application
Arduino Nano-Based Multi-Zone Soil Moisture Monitor with OLED Display
This circuit is designed to collect environmental data using multiple YL-83 modules with YL-69 sondas for soil moisture, and a KY-015 DHT11 sensor for humidity and temperature, all interfaced with an Arduino Nano. Data from the sensors is processed by the Arduino and displayed on an OLED screen, with power supplied by an MB102 Breadboard Power Supply Module.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Environmental monitoring systems
  • Weather stations
  • HVAC (Heating, Ventilation, and Air Conditioning) systems
  • Industrial process control
  • IoT (Internet of Things) devices for smart homes

Technical Specifications

Key Technical Details

  • Sensor Type: SHT20 (Temperature and Humidity Sensor)
  • Communication Protocol: I2C
  • Operating Voltage: 3.3V to 5.5V
  • Temperature Measurement Range: -40°C to +125°C
  • Temperature Accuracy: ±0.3°C (typical)
  • Humidity Measurement Range: 0% to 100% RH
  • Humidity Accuracy: ±3% RH (typical)
  • I2C Address: 0x40 (default)
  • Dimensions: 28mm x 12mm x 8mm

Pin Configuration and Descriptions

Pin Name Pin Number Description
VCC 1 Power supply input (3.3V to 5.5V)
GND 2 Ground
SCL 3 I2C clock line
SDA 4 I2C data line

Usage Instructions

How to Use the XY-MD01 SHT20 in a Circuit

  1. Power the Module: Connect the VCC pin to a 3.3V or 5V power source and the GND pin to ground.
  2. I2C Connections: Connect the SCL pin to the I2C clock line of your microcontroller and the SDA pin to the I2C data line. Use pull-up resistors (typically 4.7kΩ) on the SCL and SDA lines if they are not already present in your circuit.
  3. Addressing: The module uses the default I2C address of 0x40. Ensure no other devices on the I2C bus share this address.

Important Considerations and Best Practices

  • Avoid exposing the sensor to extreme conditions (e.g., high humidity condensation or corrosive gases) to maintain accuracy and longevity.
  • Use decoupling capacitors (e.g., 0.1µF) near the VCC pin to stabilize the power supply.
  • Keep I2C lines as short as possible to reduce noise and ensure reliable communication.

Arduino UNO Example Code

Below is an example of how to interface the XY-MD01 SHT20 with an Arduino UNO using the Wire library:

#include <Wire.h>

// I2C address of the SHT20 sensor
#define SHT20_ADDRESS 0x40

// Commands for temperature and humidity measurement
#define TRIGGER_TEMP_MEASURE 0xF3
#define TRIGGER_HUMD_MEASURE 0xF5

void setup() {
  Serial.begin(9600); // Initialize serial communication
  Wire.begin();       // Initialize I2C communication
  Serial.println("XY-MD01 SHT20 Sensor Test");
}

void loop() {
  float temperature = readTemperature();
  float humidity = readHumidity();

  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" °C");

  Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.println(" %");

  delay(2000); // Wait 2 seconds before the next reading
}

float readTemperature() {
  Wire.beginTransmission(SHT20_ADDRESS);
  Wire.write(TRIGGER_TEMP_MEASURE); // Send temperature measurement command
  Wire.endTransmission();
  delay(85); // Wait for measurement to complete

  Wire.requestFrom(SHT20_ADDRESS, 2); // Request 2 bytes of data
  if (Wire.available() == 2) {
    uint16_t rawData = (Wire.read() << 8) | Wire.read();
    return -46.85 + 175.72 * (rawData / 65536.0); // Convert to temperature
  }
  return NAN; // Return NaN if data is unavailable
}

float readHumidity() {
  Wire.beginTransmission(SHT20_ADDRESS);
  Wire.write(TRIGGER_HUMD_MEASURE); // Send humidity measurement command
  Wire.endTransmission();
  delay(29); // Wait for measurement to complete

  Wire.requestFrom(SHT20_ADDRESS, 2); // Request 2 bytes of data
  if (Wire.available() == 2) {
    uint16_t rawData = (Wire.read() << 8) | Wire.read();
    return -6.0 + 125.0 * (rawData / 65536.0); // Convert to humidity
  }
  return NAN; // Return NaN if data is unavailable
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Data Received from the Sensor:

    • Ensure the I2C connections (SCL and SDA) are correct and secure.
    • Verify that the I2C address (0x40) matches the one used in your code.
    • Check for proper pull-up resistors on the I2C lines.
  2. Inaccurate Readings:

    • Ensure the sensor is not exposed to condensation or contaminants.
    • Verify that the power supply voltage is within the specified range (3.3V to 5.5V).
    • Allow the sensor to stabilize for a few seconds after powering it on.
  3. Arduino Freezes or Crashes:

    • Check for loose connections or short circuits.
    • Ensure the I2C bus is not overloaded with too many devices.

FAQs

Q: Can the XY-MD01 SHT20 operate at 5V?
A: Yes, the module supports an operating voltage range of 3.3V to 5.5V.

Q: Do I need external pull-up resistors for the I2C lines?
A: Some modules include built-in pull-up resistors, but if they are not present, you should add 4.7kΩ resistors to the SCL and SDA lines.

Q: How do I protect the sensor in harsh environments?
A: Use a protective enclosure or filter membrane to shield the sensor from dust, water, and corrosive gases.