Raspberry Pi 5 - 21 Component IoT Interface Project
This project demonstrates how to interface a Raspberry Pi 5 with 21 different sensors and actuators. It combines local hardware control (Motors, LCD, Buzzer) with cloud-based monitoring using ThingsBoard via the MQTT protocol. Project Overview
The system manages a wide range of inputs including analog gas sensors, environmental sensors, and user-input modules. Data is collected and sent to demo.thingsboard.io for real-time visualization. Component & Sensor List (21 Total)
- Air & Gas Sensors (Analog via ADC)
These sensors require an external MCP3208 ADC via the SPI interface to provide concentration levels to the Raspberry Pi.
MQ-6: Used for LPG and Butane leak detection.
MQ-7: Used for Carbon Monoxide (CO) monitoring.
MQ-135: Used for Air Quality monitoring (CO2, Ammonia, Benzene).
LM35: High-precision analog temperature sensing.
-
Environmental & Light Sensors
DHT11: Digital Temperature and Humidity sensing via a single-wire interface.
LDR: Light Dependent Resistor for ambient light levels, read via SPI.
TEMT6000: Precision ambient light intensity sensing.
Rain Sensor: Detects water/rain presence on the sensing pad.
-
Motion, Safety & Security
IR Sensor: Infrared-based obstacle and proximity detection.
Hall Effect: Detects magnetic fields (e.g., for door/window safety).
Tilt Switch: Detects when the device is tilted or moved.
-
User Interface & Controls
Joystick: 5-way digital navigation providing UP, DOWN, MID, LEFT, and RIGHT inputs.
Resistive Touch: Detects pressure or touch input.
LED Switch: A combination of a push-button switch and an indicator LED.
-
Actuators & Outputs
DC Motor: Speed and direction control using an L298N driver and PWM.
Stepper Motor: Precise step-by-step rotation for positioning.
Relay: Switches high-power AC/DC loads.
Buzzer: Audible alerts and alarms.
RGB LED: Multi-color status lighting using PWM color mixing.
-
Displays
16x2 LCD: Character display used to show sensor readings locally in 4-bit mode.
Seven Segment: Numeric display for showing digits or basic status.
Hardware Configuration
SPI Interface: Utilized for the MCP3208 ADC to read all analog sensors.
PWM Channels: Utilized for DC Motor speed (IN1) and RGB LED color control.
MQTT Cloud: Telemetry is sent to ThingsBoard using unique device access tokens such as "IF3MHO5mZBj6N7b6RPbZ" or "bdThfGxgIYh7TmSuLrM8".
Required Libraries
To run these scripts, you must install the following dependencies:
sudo pip3 install RPi.GPIO paho-mqtt spidev Adafruit_DHT