- In this project we have sensed temperature and humidity data using DHT22 and stored the sensed data into InfluxDB and then visualized in Grafana.
- We built this project by implementing CoAP protocol with txThings framework using Python 2.
- Adafruit DHT22 sensor (+ ribbon cables)
- Raspberry Pi 3 (+ power adapter)
- Monitor
- Python 2
- InfluxDB (time series database)
- Grafana (visualization tool)
- Browser
DHT22 sensor read data through the BCM pin 23. Configurations are available at docker_compose.yml and src/config.py files.
# clone the project
git clone https://github.com/ziaul55/dht22_logger.git
# install docker and docker-compose
sudo su
chmod +x shell-scripts/install_docker_compose.sh
sh shell-scripts/install_docker_compose.sh
exit
[reboot the Raspberry Pi]
# build the project
cd dht22_logger
docker-compose build
# run the project
# stop influxdb and grafana-server if these are already running
# into the Raspberry Pi with 'sudo service influxdb stop' and
# 'sudo grafana-server stop'
docker-compose up
- We built this project with a single Raspberry Pi 3 having IP address 192.168.1.125. Visualization is done with Grafana which is running on port 3000. So, complete URL for Grafana will be 192.168.1.125:3000.
- Now browse 192.168.1.125:3000 URL and provide the username and password as admin admin. Reset password or skip.
- Press on Gear icon to add the Data Source. In this project, we configured our influxdb credentials on docker-compose.yml file. So, add an InfluxDB Data Source with following configuration
* HTTP URL: 192.168.1.125:8086
* InfluxDB Details
- Database: strawberry_factory
- User: influxDBuser
- Password: influxDBpass
* Press on 'Save & Test'
- Press on + icon to add a new panel. Add temperature and humidity with two separate queries and save the panel.