Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mathcale/rpi-smart-thermometer

Smart thermometer that pushes readings from a DHT22 sensor plugged on an Raspberry Pi Zero via MQTT to a Nest.js server
https://github.com/mathcale/rpi-smart-thermometer

dht22 iot mqtt nestjs nodejs postgresql raspberry-pi smart-home

Last synced: about 5 hours ago
JSON representation

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

Awesome Lists containing this project

README

        



RPi Smart Thermometer



GH Actions badge

## Architecture

![Architecture diagram](docs/rpi-smart-thermometer-architecture.drawio.png)

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](docs/rpi-smart-thermometer-schematics.png)

## 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