edit

Grove - Temperature&Humidity Sensor(DHT20)

The new Grove - Temperature & Humidity Sensor is based on the DHT20 sensor. The DHT20 is an upgraded version of the DHT11, compared with the previous version, the temperature and humidity measurement accuracy are higher, and the measurement range is larger. It features I2C output which means it is easier to use.

Features

  • High Accuracy:
  • Temperature Accuracy:± 0.5 ℃
  • Humidity Accuracy:± 3 % RH ( 25 ℃ )
  • Wide measurement ranges:
  • Measuring Range (Humidity):0 ~ 100% RH
  • Measuring Range (Temperature):-40 ~ + 80 ℃
  • Better compatibility:
  • Digital output
  • I²C interface
  • Fully calibrated
  • Excellent long-term stability
  • Quick response and anti-interference capability
  • Wide voltage support 2.5-5.5V DC

Specification

Parameter Value
Input Voltage 2.0 V – 5.5 V
Measuring Humidity Range 0 ~ 100% RH
Measuring Temperature Range -40 ~ + 80 ℃
Humidity Accuracy ± 3 % RH ( 25 ℃ )
Temperature Accuracy ± 0.5 ℃
Output Signal I2C signal

Hardware Overview

Pin Map

Platforms Supported

Arduino Raspberry Pi

Caution

The platforms mentioned above as supported is/are an indication of the module's software or theoretical compatibility. We only provide software library or code examples for the Arduino platform in most cases. It is not possible to provide software library/demo code for all possible MCU platforms. Hence, users have to write their own software library.

Getting Started

Play With Arduino

Hardware

Materials required

Seeeduino V4.2 Base Shield Grove - Temperature & Humidity Sensor V2.0
enter image description here enter image description here enter image description here
Get One Now Get One Now Get One Now
  • Step 1. Connect the Grove Temperature & Humidity Sensor V2.0 to port I2C of Grove-Base Shield.

  • Step 2. Plug Grove - Base Shield into Seeeduino.

  • Step 3. Connect Seeeduino to PC through a USB cable.

Software

Note

If this is the first time you work with Arduino, we strongly recommend you to see Getting Started with Arduino before the start.

Compared with DHT11, the DHT20 Temperature and Humidity Sensor has clear changes in supply voltage, measurement range of temperature and humidity, precision and quality of output signal.

It has equipped with a fully calibrated digital I2C interface, so there are slightly different definitions of pins. You should download and install the library here to use DHT20.

Once it is all set up, we can upload the sample code to see if it works:

// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain
#include "Wire.h"
#include "DHT.h"
#define DHTTYPE DHT20   // DHT 20
/*Notice: The DHT10 and DHT20 is different from other DHT* sensor ,it uses i2c interface rather than one wire*/
/*So it doesn't require a pin.*/
DHT dht(DHTTYPE);         //   DHT10 DHT20 don't need to define Pin

#if defined(ARDUINO_ARCH_AVR)
    #define debug  Serial

#elif defined(ARDUINO_ARCH_SAMD) ||  defined(ARDUINO_ARCH_SAM)
    #define debug  SerialUSB
#else
    #define debug  Serial
#endif

void setup() {

    debug.begin(115200);
    debug.println("DHTxx test!");
    Wire.begin();

    /*if using WIO link,must pull up the power pin.*/
    // pinMode(PIN_GROVE_POWER, OUTPUT);
    // digitalWrite(PIN_GROVE_POWER, 1);

    dht.begin();
}

void loop() {
    float temp_hum_val[2] = {0};
    // Reading temperature or humidity takes about 250 milliseconds!
    // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)


    if (!dht.readTempAndHumidity(temp_hum_val)) {
        debug.print("Humidity: ");
        debug.print(temp_hum_val[0]);
        debug.print(" %\t");
        debug.print("Temperature: ");
        debug.print(temp_hum_val[1]);
        debug.println(" *C");
    } else {
        debug.println("Failed to get temprature and humidity value.");
    }

    delay(1500);
}

After done uploading, we can use Serial Monitor in Arduino to see the result.

And the output should be something like... :

The values are based on the current environment.

Play with MicroPython

Connect RaspberryPi Pico

Materials required

RaspberryPi Pico Grove Shield for Pi Pico v1.0 Grove - Temperature & Humidity Sensor V2.0
enter image description here enter image description here enter image description here
Get One Now Get ONE Now Get ONE Now

I2C Connection

  • Step 1. Plug RaspberryPi Pico into Grove Shield for Pi Pico.

  • Step 2. Plug Grove - CO2 & Temperature & Humidity Sensor - SCD41 to I2C1 port of Grove Shield for Pi Pico.

  • Step 3. Connect RaspberryPi Pico to a PC through a USB cable.

This is the basic hardware connecting.

Software

  • Step 1. We need to use third-party library to control Grove - Temperature & Humidity Sensor V2.0

  • Download dht20.py library and save it to the computer.

  • Use Thonny to open the files, click on the "file" option at the top left, and then select "save as".

  1. Select "Raspberry Pi Pico" and save it in Pico.

Note

Once we saving, Thonny will ask to name the file. Here we type "lcd1602.py" as its name, and we also need to type the extension of the file, or it can not be used.

  • Step 2. Upload the code.
from machine import I2C
from dht20 import DHT20
i2c = I2C(0)
dht20 = DHT20(i2c)
while True:
    temper = dht20.dht20_temperature()
    humidity = dht20.dht20_humidity()
    print("temper : " + str(temper))
    print("humidity : " + str(humidity))
  • Step 3. The result should look like:

Schematic Online Viewer

Resources

Tech Support

Please do not hesitate to submit the issue into our forum.