Raspberry Pi Sensors (DHT22 / AM2302)
4.6K
This application measures temperature and humidity with a DHT22/AM2302 sensor connected to the Raspberry Pi.
The sensor is read out with a Python script and the library Adafruit_CircuitPython_DHT. The measurement data is displayed in the console and can optionally be save to a database (MariaDB) and displayed on a web server.
It use physical PIN7 = GPIO4 (D4) by default. You can now* change the GPIO Pin over a env-Variable (see below).
The other two cable of AM2302 are connect to 3V (or 5V) and Ground.
# Clone Project
git clone https://github.com/Tob1as/rpi-sensors.git
# change in folder
cd rpi-sensors/
Use Docker (recommended) or manual installation.
Requirements:
PRIVILEGED_MODE_ENABLE=true in .env-File (see below).Steps:
cp example.env .env
.env-File, example Database Password or GPIO Pin. Then optional check config:
docker-compose config
docker-compose up -d
docker-compose up -d mariadb dht22 web
docker-compose logs -f
docker-compose down -v
sudo apt-get update &&
sudo apt-get install -y build-essential python3-dev libgpiod2 libmariadb-dev &&
sudo pip3 install adafruit-circuitpython-dht &&
sudo pip3 install mariadb
example.env-File or change default value in dht_sensor.py.python3 ./dht_sensor.py
If your container (example: web) fails to start with Images that based on Alpine 3.13 on ARM devices like Raspberry with Raspbian Buster (32 bit) then see here or here or here for a possible solution.
Content type
Image
Digest
sha256:108ebaba4…
Size
53.4 MB
Last updated
24 days ago
docker pull tobi312/rpi-sensors:python-debian