Monitor Remote IoT Sensors with MQTT and InfluxDB
detail.loadingPreview
This workflow enables real-time monitoring of remote IoT sensors. It listens for temperature and humidity data via MQTT from an ESP32 microcontroller, processes the incoming messages, and then efficiently stores this valuable sensor data in an InfluxDB database for analysis and visualization.
About This Workflow
This n8n workflow provides a robust solution for collecting and logging data from remote IoT sensors. It starts by subscribing to an MQTT topic to receive real-time temperature and humidity readings from an ESP32 microcontroller equipped with a DHT22 sensor. A custom JavaScript code node then intelligently parses and formats these raw MQTT messages into the InfluxDB Line Protocol. Finally, an HTTP Request node securely transmits this prepared sensor data to a specified InfluxDB bucket, allowing for continuous data logging, trend analysis, and building powerful dashboards to visualize your IoT environment. Ideal for smart home, environmental, or industrial monitoring applications.
Key Features
- Real-time Data Ingestion: Instantly capture temperature and humidity data from remote IoT sensors via MQTT.
- Intelligent Data Transformation: Automatically parse and format raw sensor data into InfluxDB Line Protocol using custom JavaScript.
- Seamless InfluxDB Integration: Directly post processed sensor data to your InfluxDB database for persistent storage and analysis.
- Flexible Sensor Compatibility: Designed to work with common sensors like DHT22 connected to microcontrollers such as ESP32.
- Local & Cloud Deployable: Easily adaptable for both local InfluxDB instances and cloud-based deployments.
How To Use
- Configure MQTT Trigger:
- Ensure you have an MQTT broker (e.g., Mosquitto) running and an ESP32 (or similar) microcontroller publishing sensor data (e.g., DHT22 temperature/humidity) to the
wokwi-weathertopic. - Update the "MQTT account" credential in the
Remote Sensor MQTT Triggernode to connect to your broker.
- Ensure you have an MQTT broker (e.g., Mosquitto) running and an ESP32 (or similar) microcontroller publishing sensor data (e.g., DHT22 temperature/humidity) to the
- Review Data Preparation:
- The
Payload data preparation nodeuses JavaScript to parse incoming MQTT messages and format them for InfluxDB Line Protocol. Review the code to understand howhumidityandtempare extracted and ensure it matches your sensor's payload structure. Adjust if your sensor sends different keys or a different message format.
- The
- Set Up InfluxDB Connection:
- Ensure you have an InfluxDB instance (version 2.x recommended) running, potentially locally at
http://localhost:8086. - In the
Data ingest to InfluxDB bucketnode, replace<Organization ID>,<InfluxDB bucket name>, and<API Token value generated in InfluxDB>with your actual InfluxDB credentials. The API token needs write access to the specified bucket.
- Ensure you have an InfluxDB instance (version 2.x recommended) running, potentially locally at
- Activate Workflow: Once all configurations are complete, activate the workflow to start collecting and logging your IoT sensor data automatically.
Apps Used
Workflow JSON
{
"id": "bd100f05-5a68-4d61-b6e4-941df5c71d7b",
"name": "Monitor Remote IoT Sensors with MQTT and InfluxDB",
"nodes": 20,
"category": "DevOps",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: bd100f05-5a68...
About the Author
DevOps_Master_X
Infrastructure Expert
Specializing in CI/CD pipelines, Docker, and Kubernetes automations.
Statistics
Related Workflows
Discover more workflows you might like
Effortless Bug Reporting: Slack Slash Command to Linear Issue
Streamline your bug reporting process by instantly creating Linear issues directly from Slack using a simple slash command. This workflow enhances team collaboration by providing immediate feedback and a structured approach to logging defects, saving valuable time for development and QA teams.
Automate Qualys Report Generation and Retrieval
Streamline your Qualys security reporting by automating the generation and retrieval of reports. This workflow ensures timely access to crucial security data without manual intervention.
Automated PR Merged QA Notifications
Streamline your QA process with this automated workflow that notifies your team upon successful Pull Request merges. Leverage AI and vector stores to enrich notifications and ensure seamless integration into your development pipeline.