This project uses tweaked gapan's dht sensor protocol implementation to obtain data from sensor. To collect and visualize data project uses node.js, simple http server, apex charts and sqlite with sequelize ORM.
As a result you will get nice chart-visualized sensor data:
First of all you need to install wiringpi library, to do so, run following command:
sudo apt-get install wiringpi
Then you need to clone this repo somewhere:
git clone https://github.com/Hatry1337/pi-temp
Go to project directory and create .env
file
Put inside of file this template and edit if needed
PORT=8090
HOST="0.0.0.0"
DATABASE="/home/pi/pi-temp/data.sqlite"
DRIVER="/home/pi/dht11"
PORT
- port, where webserver will listen for requests
HOST
- interface ip address, where webserver will listen for requests (0.0.0.0 for all interfaces)
DATABASE
- path, where your sqlite database will be located
DRIVER
- path to sensor driver executable (You need to compile it or get binary from releases section)
⚠ Pre-Compiled binaries uses by default GPIO4 pin of raspberry pi. If you wanna use other pin, you will need to compile driver by yourself.
Then use npm to install typescript compiler and project dependencies:
sudo npm i -g typescript && npm i
When dependencies are installed you can build typescript:
tsc
Now you are ready to run the server:
node ./dist/main.js
Go to ./driver directory and edit driver source if needed
Then use gcc to compile source file:
gcc -o dht11 dht11.c -lwiringPi -lwiringPiDev
Take binary file dht11
somewhere and put it's path to the .env
file