Add support for DHT11 temperature/humidity sensor for RPi

Would it be possible to include the kernel support for the DHT11 temperature/humidity sensor ? So I can add this sensor to my OSMC setup without having to build my own kernel. Currently most other interfaces i2c, i2s are already available.

See also device-tree for DHT11 Temperature/Humidity sensor - Raspberry Pi Forums

It would be a matter of setting kernel config parameters CONFIG_IIO & CONFIG_DHT11 as well as including the devicetree overlay dht11-overlay.dtb.

Thanks.

2 Likes

Can you create a pull request for your proposed kernel config changes on github?

Or the dht22… i use that one… but it seems from the link that the failure rate is high… i use the python driver… it works yes… but i would rather like it as a kernel driver true ;-).

I have been running my dht22 for almost 9 month now, i think i have a few failures day, and im reading it every min(into an sqliteDB) thats 1440 times a day so not a high rate of failures there.

the python driver is soo slow :wink:

-H

[ Note that the dht kernel drivers supports both dht11 & dht22 and yes using proper kernel driver should be much better then the python driver ]

Looking at github, to be honest no clue where to start, the patches under
osmc/package/kernel-osmc/patches rbp1/2-000-add-kernel-config.patch have a header stating they are auto-generated, otherwise I guess it would be adding
CONFIG_IIO=m
CONFIG_DHT11=m
the required symbol ‘CONFIG_GPIOLIB’ is already set.

I have added support for your sensor:

It will be included in the next update

Sam

1 Like

Thanks Sam, Great!

Great!

Thanks for enabling support for DHT11! I just tried to turn it on in the config file but realized that the overlay file is missing from /boot/. I upgraded OSMC from the previous version. Where do I get it the overlay file?

I did not realise an overlay was needed. I will add it to the kernel packages shortly.

Thanks, Sam!

Dont see the overlay in januari/februari updates running on kernel 4.4.0.
This is the ‘recipe’ I use to create the dht11 overlay.

==
debian dtc (device-tree-compiler) doesn’t support overlays,so do this:

git clone git://git.kernel.org/pub/scm/utils/dtc/dtc.git
apt-get install flex bison

http://www.embedded-things.com/bbb/patching-the-device-tree-compiler-for-ubuntu/
cd dtc
git reset --hard f8cb5dd94903a5cfa1609695328b8f1d5557367f
wget https://patchwork.kernel.org/patch/1934471/raw/ -O dynamic-symbols.patch
git apply dynamic-symbols.patch
make
cd …

Copy source for dht11.dts here.
https://www.raspberrypi.org/forums/viewtopic.php?p=683931
(add bcm2709 to list of compatible’s)

dtc/dtc -I dts -O dtb -o dht11-overlay.dtb -b 0 -@ dht11-overlay.dts

cp dht11-overlay.dtb /boot/overlays/.

add to config.txt
dtoverlay=dht11,gpiopin=4 (or 18 in my case, wherever you have it connected)

1 Like