No description
Find a file
2021-12-17 18:26:09 +01:00
lib added abs. humidity to influx 2021-12-17 18:26:09 +01:00
.gitignore copy from private repo 2021-04-03 21:54:47 +02:00
config.ini.example copy from private repo 2021-04-03 21:54:47 +02:00
dht22sensor.py copy from private repo 2021-04-03 21:54:47 +02:00
DHT22Sensor.service copy from private repo 2021-04-03 21:54:47 +02:00
README.md copy from private repo 2021-04-03 21:54:47 +02:00
requirements.txt copy from private repo 2021-04-03 21:54:47 +02:00

DHT22, raspberry to InfluxDB system

This script reads a DHT22 temperature and humidity sensor on a raspberry pi (>=3) and sends it to a InfluxDB server.

Aditionally the dewpoint will be calculated (only accurate between -45°C <= Temperature <= 60°C).

The local weather can be gathered via openweathermap

If you include the WiFi Sensor, your current WiFi readings (SSID, RSSI etc.) will also be transmitted. To log all available wifis run the script as root.

Requirements

The pi should run a raspbian distribution and needs

  • enabled SPI with
    • sudo sudo raspi-config and enable SPI
  • enabled I2C with
    • sudo apt-get install -y python-smbus i2c-tools
    • sudo raspi-config and enable I2C
    • sudo reboot
  • python3 with pip and virtualenv
    • sudo apt-get install python3 python3-pip virtualenv
    • create virtual environment with
      • virtualenv -p python3 venv
      • source venv/bin/activate
      • pip install -r requirements.txt
      • sudo apt-get install libgpiod2
    • copy config file
      • cp config.ini.example config.ini and edit appropriately

Wifi reports only the local connected WiFi for a standard user. For all visible wifis use it as root.

Setup

Connect the Sensor with +3,3V, and GND to your pi, and add a dataline from the sensor to GPIO 4. To change the GPIO change the line:

self.sensor = adafruit_dht.DHT22(board.D4) in ./lib/dht22_sensor.py

to your desired GPIO.

Make sure to edit ./config.ini appropriately. Start the script with:

python3 ./dht22sensor.py.

systemd service

Copy ./DHT22Sensor.service to your systemd unitfile path and start/enable it. Presumably you might want to change the line

ExecStart=/opt/DHT22/venv/bin/python3 /opt/DHT22/dht22sensor.py

to the correct path.

Docs

Adafruit Documentation

License

Author Stefan Maier Licence GNU GPLv3

Contributing

Bug reports and pull requests are welcome on my website or mail to git@univ-exp.com