dht11 example

  • Hello,

    In general, you would need to research this information on your own. You can write the device tree according to the format in our Wiki. Rockchip has its own device tree writing standards. There are clear syntax errors in your device tree. In the gpios property, the correct syntax should be:

    Code: Select all

    gpios = <&gpio1 RK_PC7 GPIO_ACTIVE_LOW>;
  • Thanks for Your answer.

    Of course device tree error with gpios is already fixed and still there is the same result after flashing board - there is no /dev/dht22 device.
    What I need is answer to questions:
    DHT11 run instruction on Your wiki is deprecated? [Yes/No]
    Aproach to run DHT11 that I described above is correct? [Yes/No]

    What You mean "Rockchip has its own device tree writing standards.", it was only about RK_PC7 gpios property, or all of my configuration is wrong? [...]

    Maybe I should told that I'm new in Linux drivers programming/modyfication.

    Best regards,
    Kamil
  • Dear Kamil,

    Thanks for your follow-up question. The answer is as follows:
    • Regarding the DHT11 run instructions on our wiki, the answer is no, it is not deprecated and is still valid.
    • Regarding the method of running DHT11 you described above, there seems to be some configuration missing from your setup.
    I noticed that you have managed to rectify an issue within the device tree. Nevertheless, to fully utilize the DHT11 sensor, kernel-level support is imperative. Our wiki illustrates how this support can be attained by dynamically importing a kernel module (.ko file). Additionally, you have the option to activate DHT11 support by properly configuring the kernel during its build process using the menuconfig tool at the following link: https://wiki.luckfox.com/Luckfox-Pico/L ... enuconfig/

    Temperature data can be obtained via the following path: /sys/bus/iio/devices/iio:device1/in_temp_input
    Humidity data can be read from the following path: /sys/bus/iio/devices/iio:device1/in_humidityrelative_input

    Once the kernel is properly configured and supports the DHT11 sensor, these IIO interfaces will provide real-time temperature and humidity measurements.
  • Thank You for Your detailed answer.

    Within my description I mentioned that I enabled dht11 driver using menuconfig :)

    I would like to ask about:
    Temperature data can be obtained via the following path: /sys/bus/iio/devices/iio:device1/in_temp_input
    Humidity data can be read from the following path: /sys/bus/iio/devices/iio:device1/in_humidityrelative_input
    It means that I shouldn't expect /dev/dht22 device to be present in devices list?

    Best regards,
    Kamil
  • Dear Kamil,

    I noticed that you've enabled the dht11 driver using menuconfig.Indeed, in this case, the /dev/dht22 device node is not created via a traditional character device interface; rather, it is accessed through the sysfs interface provided by the IIO (Industrial Input/Output) framework. Therefore, it's entirely normal not to find /dev/dht22 within the /dev directory path.