Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

NanoPi NEO / DHT11 overlay

Featured Replies

I'm trying to use the kernel-driver (1) for a DHT11 (or DHT22) humidity sensor with my NanoPi NEO.

 

I'm already got this sensors working with some little C example-programs in userspace.

 

I figured out that I need to apply a Device Tree overlay because the driver (dht11.c) needs to know the gpio-pin where the sensor is connected to.

 

So - I don't know how to write such a file from scratch - I customised a existing overlay file - "sun8i-h3-pps-gpio.dts" (2) - only the lines "pins" (PG6) & "compatible with" (dht11) & "gpios" (&pio 6 6 1)

 

/dts-v1/;
/plugin/;

/ {
    compatible = "allwinner,sun8i-h3";

    fragment@0 {
        target = <&pio>;
        __overlay__ {
            pps_pins: pps_pins {
                pins = "PG6";
                function = "gpio_in";
            };
        };
    };

    fragment@1 {
        target-path = "/";
        __overlay__ {
            pps@0 {
                compatible = "dht11";
                pinctrl-names = "default";
                pinctrl-0 = <&pps_pins>;
                gpios = <&pio 6 6 1>; /* PG6 */
                status = "okay";
            };
        };
    };
};

 

With this overlay file applied ("armbian-add-overlay ...") the driver module is loading on boot and the directories and files in the iio-subsystem are created (eg. /sys/bus/iio/devices/iio\:device0/in_humidityrelative_input)

 

When I try to read from the sensor I got the following error in my terminal

cat: '/sys/bus/iio/devices/iio:device0/in_humidityrelative_input': Connection timed out

and this on the serial console

dht11 pps@0: Only 25 signal edges detected

 

According to the source of the driver there should be 84 edges to detect - something seems to be to slow ...

 

When it is possible to read from the sensor with userspace programs so it should be also possible to do the same thing with a kernel driver - right?

 

So I'm thinking, that the error should be in my overlay file ... but I am at my wit's end.

 

Maybe somebody can help me?

 

(1) https://github.com/torvalds/linux/blob/master/drivers/iio/humidity/dht11.c

(2) https://github.com/armbian/sunxi-DT-overlays/blob/master/sun8i-h3/sun8i-h3-pps-gpio.dts

 

(my English lessons in school are 15 years ago, so please excuse)

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.