A Raspberry Pi with a DFRobot DHT22 sensor to measure temperature and humidity and export that data to a monitoring and graphing server.
- Measures Temperature in Celcius °C
- Measures Humidity in Relative Humidity %
- Exposes the climate sensor data on an http server on port
1006
e.g. http://<ip_address>:1006 - Compatible with Prometheus
There's a Prometheus client in read_sensors.py
that exports the climate data.
We use a Grafana dashboard to view the data.
This Climate Sensor is designed to run with the following hardware:
- Raspberry Pi Zero W
- DFRobot DHT22 v2 sensor
- JST PH 3-Pin to Female Socket Cable
- 3D-printed sensor case
Note: It will run on any model of Raspberry Pi, but for conservation of electricity and minimising heat production we recommend the Zero.
See the case README for more information about the 3D-printable sensor case.
With your Raspberry Pi pins on the right-hand side of the board, using the pin numbering system in the following diagram, attach the DHT22 cables to the Raspberry Pi pins in the table below:
Raspberry Pi pin | DFRobot DHT22 pin |
---|---|
1 - 3V3 Power | Red power cable |
7 - RPI04 | Green/White data cable |
9 - Ground | Black ground cable |
- Clone this repository.
cd development
cp dev.tmpl.env dev.env
- Edit the
dev.env
to change the frequency of sensor readings, the default is every 5 secondsTIME_BETWEEN_READINGS=5
- Set
DEBUG=true
to see errors on the console - Set
SENSOR_PIN=4
to change the Raspberry Pi pin you connect the sensor to. Default is 4 - Build and run the development container
docker-compose up --build
docker exec -it climate make linttest
Clone this repo and make any edits to read_sensors.py
that you need.
Add the Balena remote to:
git remote add balena <username>@git.balena-cloud.com:<username>/<balena-app-name>.git
And then push the changes to deploy via Balena:
$ git commit -S -am "My new feature"
$ git push
$ git push balena master
Watch the devices update on the Balena dashboard.
To add a Climate Sensor to a multi-container Balena app:
- Add this repository as a git submodule
git submodule add git@github.com:ACMILabs/climate-sensor.git climate
- Update your
docker-compose.yml
to include theclimate
app:
version: '2'
services:
climate:
build: ./climate
privileged: true
labels:
io.balena.features.supervisor-api: '1'
ports:
- "1006:1006"
If you'd like to update the climate
submodule: git submodule update --remote
This project was built by the ACMILabs team in 2019.