Skip to content

A Raspberry Pi based climate sensor, reading temperature and humidity from a DFRobot DHT22 sensor.

License

Notifications You must be signed in to change notification settings

ACMILabs/climate-sensor

Repository files navigation

Climate Sensor

A Raspberry Pi with a DFRobot DHT22 sensor to measure temperature and humidity and export that data to a monitoring and graphing server.

Climate Sensor CI

Features

  • 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

Climate Sensor

Monitoring & Graphing

There's a Prometheus client in read_sensors.py that exports the climate data.

We use a Grafana dashboard to view the data.

Climate Sensor data in Grafana

Hardware

This Climate Sensor is designed to run with the following hardware:

Note: It will run on any model of Raspberry Pi, but for conservation of electricity and minimising heat production we recommend the Zero.

3D-printed case

See the case README for more information about the 3D-printable sensor case.

Climate Sensor case

Wiring diagram

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

Raspberry Pi Zero pinout

Installation on developer machine

  • 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 seconds TIME_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

Testing and linting

docker exec -it climate make linttest

Deploying via Balena Cloud

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.

Deploying via Balena Cloud as a multi-container app

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 the climate 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

Credits

This project was built by the ACMILabs team in 2019.

MPL License

About

A Raspberry Pi based climate sensor, reading temperature and humidity from a DFRobot DHT22 sensor.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •