Skip to content

mcopjan/raspberry-temperature-humidity-monitoring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Temperature & Humidity Monitoring on Raspbian using DHT Sensors

Overview

This solution comprises four main components:

  • The following three components are running in Docker containers:

    • Agent: A Python script that scrapes data from temperature and humidity sensors.
    • API: A .NET Core API.
    • MongoDB: The database.
  • Desktop Client: A WPF application presenting temperature and humidity data. Requires .NET Core 6.0 runtime.

  • Mobile Client: A MAUI app, still in development.

Component's Diagram

Supported Sensors

This solution is compatible with the following sensors:

  • DHT11: Tested but not recommended due to imprecise humidity readings (off by 20-25%).
  • DHT22

Requirements

To implement this solution, you will need:

  • Raspberry Pi: (Tested on Pi3 & Zero; one hosts API, Agent, and DB, and the other hosts only Agent).
  • DHT 22 Sensors: Available for purchase on eBay for approximately £3 each.

Setup

The easiest way to set up this solution is as follows:

  1. Connect DHT Sensor to Raspberry Pi GPIO:

    • Power pins 2 & 6 and signal pin into pin 11 (GPIO17, configurable when running the Agent's Docker container). GPIO GPIO2
  2. Install Docker.

  3. Run Docker Compose:

    • Execute 'docker-compose -f docker-compose.yml up'. This will spin up the API, Agent, and DB.
  4. Monitoring Multiple Rooms:

    • If monitoring multiple rooms (using additional Raspberry Pi's with DHT sensors), run another Agent and connect it to send data to the API. For example:
    docker run --privileged -e API_URL={API_IP}:80 -e ROOM_NAME=demo_room -e SENSOR_MODEL=22 -e GPIO_PIN=17 -e INTERVAL_SEC=60 mcopjan/raspberry-hum-temp-agent:latest
    

Demo

Video Demo