Skip to content

Smart thermometer that pushes readings from a DHT22 sensor plugged on an Raspberry Pi Zero via MQTT to a Nest.js server

Notifications You must be signed in to change notification settings

mathcale/rpi-smart-thermometer

Repository files navigation

RPi Smart Thermometer

GH Actions badge

Architecture

Architecture diagram

Every 30 minutes, a Node.js script reads the current temperature and humidity from the DHT22 sensor plugged to a Raspberry Pi Zero W via GPIO and then publishes this data via MQTT to the Mosquitto server.

On the server stack, a Nest.js microsservice listens to a specific topic on the Mosquitto server and, when there's a new message, it gets parsed, validated and stored on a PostgreSQL database. This stack is deployed with Docker Compose to my local Raspberry Pi 4 home server.

There's also a button that, when pressed, will fetch the latest reading from the Nest.js API and show it on the OLED display. After 20s, the display will turn off to avoid burn-in.

Schematics

Hardware schematics

Tech

Hardware

  • Raspberry Pi Zero W
  • DHT22 sensor
  • OLED display
  • Push button
  • 1K resistor

Software

  • Node.js 16
  • Typescript
  • Nest.js
  • Next.js
  • Docker
  • PostgreSQL
  • Mosquitto

About

Smart thermometer that pushes readings from a DHT22 sensor plugged on an Raspberry Pi Zero via MQTT to a Nest.js server

Topics

Resources

Stars

Watchers

Forks