Modify DHT11 Driver to Work with DHT22 - Incorrect Temperature Reading Issue

  • Hello, I checked the data sheets of DHT11 and DHT22, both of them have differences in drive level and data interpretation.
    If you don't plan to be compatible with DHT11, you can modify it directly<SDK>DHT11_START_TRANSMISSION_MIN and DHT11_START_TRANSMISSION_MAX in /sysdrv/source/kernel/drivers/iio/humidity/dht11.c are the required delay time for DHT22, and the raw data verification mode of DHT11 and DHT22 is the same [n] dht11_ decode [/n] function
  • Thank you for your reply.

    I am working with the DHT11 example code from Google Drive.

    Following the steps in the Luckfox DHT11 Wiki, I modified the timing of the DHT11 to make it compatible with the DHT22, but I am still getting incorrect data.

    My modified:

    Code: Select all

    static void DHT11_Rst(void)
    {
        DHT11_DQ_Low;
        delay_ms(1000);    // Pull low for at least 8ms - DHT22
        DHT11_DQ_High;   // DQ=1
        delay_us(30);    // Host pulls up for 20~40us
    }