https://github.com/phien-ntace/smart_node_cpp
Use Raspberry Pi 5 to read values from the DHT11 and BH1750 sensors, display the data on an ILI9341 LCD, and publish the sensor values to an MQTT server
https://github.com/phien-ntace/smart_node_cpp
bh1750 dht11 ili9341 mqtt pwm raspberry-pi
Last synced: about 2 months ago
JSON representation
Use Raspberry Pi 5 to read values from the DHT11 and BH1750 sensors, display the data on an ILI9341 LCD, and publish the sensor values to an MQTT server
- Host: GitHub
- URL: https://github.com/phien-ntace/smart_node_cpp
- Owner: phien-ntace
- Created: 2025-07-13T15:00:30.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-08-03T08:21:51.000Z (11 months ago)
- Last Synced: 2025-08-03T10:12:38.309Z (11 months ago)
- Topics: bh1750, dht11, ili9341, mqtt, pwm, raspberry-pi
- Language: C++
- Homepage:
- Size: 101 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Smart Node
This project uses a **Raspberry Pi 5** to:
- Read sensor data from **DHT11** (temperature & humidity) and **BH1750** (light intensity).
- Display the sensor values on an **ILI9341** LCD screen.
- Publish the sensor data to an **MQTT server**.
- Control an **LED** using **PWM**.
---
## Wiring Details
### 🔹 BH1750 Light Sensor
| BH1750 Pin | Raspberry Pi 5 Pin |
|------------|------------------------------|
| VCC | Pin 1 (3.3V) |
| SCL | Pin 5 (GPIO 3 / SCL1) |
| SDA | Pin 3 (GPIO 2 / SDA1) |
### 🔹 DHT11 Temperature & Humidity Sensor
| DHT11 Pin | Raspberry Pi 5 Pin |
|-----------|------------------------------|
| Data | Pin 7 (GPIO 4) |
### 🔹 LED (PWM Controlled)
| LED Pin | Raspberry Pi 5 Pin |
|---------|-------------------------------|
| Anode | Pin 32 (GPIO 12 / PWM0) |
### 🔹 ILI9341 LCD (SPI Interface)
| LCD Pin | Raspberry Pi 5 Pin |
|-----------|-------------------------------------|
| LED | 3.3V |
| SCK | Pin 23 (GPIO 11) |
| SDI/MOSI | Pin 19 (GPIO 10) |
| D/C | Pin 12 (GPIO 18) |
| RESET | Pin 16 (GPIO 23) |
| CS | Pin 24 (GPIO 8 / SPI0_CE0) |
| GND | GND |
| VCC | 5V |
### 🔹 Paho MQTT
- sudo apt update
- sudo apt install git cmake build-essential libssl-dev
#### Paho MQTT C
##### Clone Paho MQTT C
- git clone https://github.com/eclipse/paho.mqtt.c.git
- cd paho.mqtt.c
##### Build
- cmake -Bbuild -H. -DPAHO_WITH_SSL=TRUE
- sudo cmake --build build/ --target install
- sudo ldconfig
#### Paho MQTT C++
##### Clone Paho MQTT C++
- cd ..
- git clone https://github.com/eclipse/paho.mqtt.cpp.git
- cd paho.mqtt.cpp
##### Build
- cmake -Bbuild -H. -DPAHO_WITH_SSL=TRUE -DPAHO_BUILD_STATIC=FALSE
- sudo cmake --build build/ --target install
- sudo ldconfig
---
## Features
- Real-time sensor readings displayed on LCD.
- MQTT communication for remote monitoring.
- PWM control for LED brightness based on ambient light.