Is there a place for basic questions? Making DHT11 work, patching kernel, etc

Hi all. I have recently learned of the existence of these minirouters and - hourray! - got myself a GL-Inet 6416. Took only a month to arrive, so now I am trying to make it do tricks I need.

What I am basically looking for is a mini-smarthome setup. Or rather, a mini-smart chicken shed :slight_smile: So, the webcam image is more than welcome (Already got that one working from the box, impressive).

Next comes the hard part - checking temperature and humidity. For this, I am planning to use the omnipresent DHT11 (Or rather the AM2302), but that seems to be rare - at least I haven’t found any mentions yet. OK, I look around - the opkg package list does not bring anything that says “DHT11” but I find: GitHub - unwireddevices/gpio-dht-handler: DHT11/DHT22 protocol handler for AR9331 using udelay that seems to fit the bill.

So, first question - did anyone manage to work with this particular handler? Or maybe there is a better one I am missing?

And second question - it says a kernel patch is needed. Time for me to learn how. As far as I understood I have to work with a firmware image on my main computer and flash this image with the patched kernel into the memory of the 6146, right?

Next in my list are the light sensor and working with relays, but will come to that later.


Speaking of newbie questions: another big issue I have is that the firmware is a bit overloaded with features, making me somewhat worried about security of the whole thing. Is there a barebones version of firmware somewhere? Something Arch-like that you build upon, installing packages you need? For example, since I am not planning to use it as a real router - I have no need for a bridge to the wifi interface. Any recommendations on “hardening” the little server?

this patche “728-MIPS-ath79-add-gpio-irq.patch” is not in OpenWrt CC1505 and BB1407, but it is in the latest trunk, called 633-mips-ath79-add-gpio-irq-support.patch

So you can build an image based on OpenWrt DD trunk. Please find the basic instructions from openwrt.

You can also refer to this GitHub - domino-team/openwrt-cc: openwrt CC with Domino/GL patches, but this is CC1505, not trunk.

When you compile, you will find GL.inet6416 in “make menuconfig”.


For the handler, just clone the code from git hub:

git clone GitHub - unwireddevices/gpio-dht-handler: DHT11/DHT22 protocol handler for AR9331 using udelay

then copy the folder of “gpio-dht-handler” to your OpenWrt path/package/

You will find this package in your menuconfig


OK, some research later I return with some additional questions:

  1. do I really need to work with trunk? Can’t I just add the “728-MIPS-ath79-add-gpio-irq.patch” patch to the /patches/ folder, just as I added the gpio-dht-handler to /package/?

That was what I did last, and after flashing the firmware, it seems that the handler is alive. At least logread showed me the line highlighted in the screenshot attached.

  1. now how do I make it work, that’s the tricky question. I have connected the data wire from the sensor to the GPIO pin 20. At first I connected the power to +5 pin on the board, but after reading about the requirements to use +3.3 - switched to that voltage. Still, no luck. The command “echo 20 > /sys/kernel/debug/irq-dht” returns an “Error” message in the log. The DHT itself has been taken off another project where it worked just fine, so I am pretty sure it should be functioning. So I presume I am doing something wrong - but what is it?


Yes, you can just add the patch to target/linux/ar71xx/patches-3.18/platform so that it will apply. Not sure if there will be other problems, but if it applies, it should fine.

Be sure to do a make target/linux/{clean,compile} so that the kernel is rebuilt

Be sure to check the code in build_dir/target…/linux-generic/linux-3.18/… find the file to check if the patch is applied.

Then make sure the voltage is 3.3V, not 5V.

I am not sure if there is any other things, but have to try and try.