yu55 / multi-am2301

Linux kernel module that supports multiple AM2301 (DHT21) sensors simultaneously connected to Raspberry Pi.
https://github.com/yu55/multi-am2301
GNU General Public License v2.0
6 stars 3 forks source link

multi-am2301

This repository contains Linux kernel module reading temperature and relative humidity data from multiple AM2301/AM2023 (DHT11/DHT21/DHT22) sensors simultaneously connected to Raspberry Pi via GPIO pins.

This kernel module is an evolution of a module presented on Blackwire Embedded blog. Compilation issues against proc_fs were fixed and multiple sensors support added. It works stable with kernels: Linux rpi 5.15.32-v7l+ #1538 SMP Thu Mar 31 19:39:41 BST 2022 armv7l GNU/Linux. It should work with other kernel versions as well unless some major API changes were done in the kernel.

multi-am2301 outside_t

Latest measurement data from connected sensors is available under /proc/multi-am2301 and can be displayed anytime using e.g. following command: cat /proc/multi-am2301. For each connected sensor it contains parameters like:

Repository layout

Kernel module sits inside module directory. Example commandline script which logs temperature and humidity into sqlite database sits inside scripts directory. This script can be invoked by system cron e.g. every 3 minutes.

Installation

Additionally to load this kernel module on Raspberry Pi startup add multi-am2301 to /etc/modules configuration file.

Have fun :)