Grove DHT20 not working when following wiki

Hi there,

I have the Grove DHT20, I’m following the tutorial on connecting it to the seeeduino v4.2 ( I’ve followed it exactly, but when I use the serial monitor I see something like this


where it keeps printing out garbage. Sometimes it will print out normally, but will quickly go back to just printing out garbage. Here is the code I’m using

// 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
    #define debug  Serial
void setup() {
    debug.println("DHTxx test!");
    /*if using WIO link,must pull up the power pin.*/
    // pinMode(PIN_GROVE_POWER, OUTPUT);
    // digitalWrite(PIN_GROVE_POWER, 1);
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(" %\t");
        debug.print("Temperature: ");
        debug.println(" *C");
    } else {
        debug.println("Failed to get temprature and humidity value.");

thank you!

update: it seems to start printing out random characters after I first view the serial monitor. I let it run for a bit before viewing it and this was the output


This may be a small bug in the serial port transmission. Generally, this situation may be that the transmission speed of the serial port needs to be adjusted. You can try to change 115200 to 9600. Don’t forget to modify the serial monitor too.