Hi,
I’ve been working on modifying a DHT11 driver to support the DHT22 sensor. While the DHT11 driver works perfectly, after making some changes to adapt it for the DHT22, the temperature readings are significantly off. Specifically, I’m getting very low temperature values (around 1°C), which is far from the expected values I observe when testing the same sensor with Arduino.
Has anyone encountered a similar issue or successfully adapted a DHT11 driver for the DHT22? Any pointers or insights would be greatly appreciated.
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
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:
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
}