Modul 11 von 11 · 📖 5 min Lesezeit · ⏱ 30 min gesamt
FI-DV 12 Projekt — Sensor-zu-Dashboard (EN)
Inhaltsverzeichnis (6 Abschnitte)
FI-DV 12 Project — Sensor-to-Dashboard
In this module, you will implement a complete end-to-end data pipeline from a physical sensor to visualization in a dashboard. You will learn how sensor data can be captured, transported via MQTT, processed at the edge, and finally visualized in the cloud. This practical project combines IoT concepts with network technology and data visualization into a functional overall system.
Participants will gain a comprehensive understanding of the architecture of modern IoT solutions and will be able to transfer the learned concepts to similar scenarios. Upon completion of this module, you will be able to plan, implement, and operate your own sensor-to-dashboard systems.
Concepts and Background
- MQTT (Message Queuing Telemetry Transport)
- A lightweight Publish/Subscribe protocol for machine-to-machine communication, particularly used in limited bandwidth and unreliable networks. It uses a topic-based routing system where publishers send messages to topics and subscribers subscribe to specific topics.
- Edge Computing
- A decentralized approach to data processing where data is processed near its origin (at the "edge" of the network) rather than centrally in the cloud. This reduces latency, bandwidth requirements, and increases privacy compliance by filtering or aggregating sensitive data before transmission.
- Grafana
- An open-source platform for monitoring and visualization of metrics that fetches data from various sources (such as MQTT, InfluxDB, Prometheus) and displays it in interactive dashboards. Grafana enables the creation of custom charts, alerts, and dashboards for monitoring IoT systems.
- Sensor Integration
- The process of connecting physical sensors to digital systems, including hardware configuration, calibration of measurement values, and implementation of data transmission protocols. This often involves the use of microcontrollers such as ESP32 or Raspberry Pi for data acquisition and preprocessing.
Architecture Diagram
flowchart LR
A[Sensor] --> B[MQTT Broker]
B --> C[Edge Server]
C --> D[Cloud Database]
D --> E[Grafana Dashboard]
C --> F[Local Visualization]
Practical Steps
- Set up and test sensor hardware. Connect the sensor to an ESP32 microcontroller and upload the sample code to verify the sensor output.
- Install and configure an MQTT broker on a Raspberry Pi or Docker container. Start the broker with default settings and test the connection with an MQTT client.
- Publish sensor data via MQTT. Implement on the ESP32 a sketch that sends the sensor values in JSON format to an MQTT topic, e.g.
.sensors/temperature/data - Set up an edge server for data processing. Install Node.js on a dedicated server and write a script that receives MQTT messages, filters the data, and optionally writes to a local database.
- Set up a cloud database for long-term storage. Create an InfluxDB container in the cloud and configure the edge server to forward aggregated data to the cloud database.
- Deploy a Grafana instance in the cloud. Install Grafana on a cloud server or use a hosted solution and configure the data source as InfluxDB.
- Create a dashboard in Grafana. Create a new dashboard, add a graph, and configure it to display data from the InfluxDB data source.
- Set up automation of the data pipeline. Implement a cron job on the edge server that regularly sends data to the cloud database and cleans up the local database.
Common Pitfalls
Further Resources
- Eclipse Mosquitto MQTT Documentation
- InfluxDB Official Documentation
- Grafana Documentation
- Home Assistant MQTT Guide
- ESP32 MQTT Tutorial
Knowledge Check
Four questions for self-assessment. Click on each question to see the correct answer and explanation.
Which of the following protocols is particularly suitable for machine-to-machine communication with limited bandwidth?
- A) HTTP
- B) MQTT
- C) FTP
- D) SMTP
Correct Answer: B. MQTT is a lightweight Publish/Subscribe protocol specifically for M2M communication in resource-constrained environments. HTTP is more resource-intensive, FTP is for file transfer, and SMTP is for email sending.
Which advantage of Edge Computing is particularly highlighted in this module?
- A) Increased storage capacity
- B) Centralized management of all resources
- C) Reduced latency and bandwidth requirements
- D) Lower hardware costs
Correct Answer: C. Edge Computing reduces latency and bandwidth requirements by processing data near its origin. Centralized management increases latency, and hardware costs are often similar or higher.
What is the main function of Grafana in this project?
- A) Filter MQTT messages
- B) Capture sensor data
- C) Visualize data and create dashboards
- D) Configure edge server
Correct Answer: C. Grafana's main function is to visualize data and create dashboards. While it can connect to data sources that might filter MQTT messages, its primary role is visualization, not data capture or server configuration.