AWS Builder Center

Architecting a Real-Time IoT Telemetry Visualization Pipeline with AWS IoT Core and Managed Grafana

Learn how to seamlessly ingest, process, and visualize real-time sensor data from autonomous embedded hardware using AWS IoT Core, Amazon Timestream, and Managed Grafana to achieve sub-50ms latency insights.

The true value of any autonomous embedded system—whether it’s a 180-degree radar object detection prototype or an EV charging station monitor—lies in the data it generates. However, bridging the gap between raw C++ firmware outputs at the edge and actionable cloud telemetry is a common hurdle for developers. In this walkthrough, we will architect a scalable, low-latency telemetry visualization pipeline that ingests sensor data via MQTT, routes it through purpose-built databases, and visualizes it in real-time. Architecture Overview To keep latency under 50ms while ensuring high availability, we will utilize a fully serverless AWS architecture: Edge Device: An embedded microcontroller (e.g., Arduino) running C++ firmware, reading sensor data (like HC-SR04 ultrasonic distance metrics) and communicating via serial at 9600 baud. Gateway/Bridge: A Python script (or AWS IoT Greengrass) formatting the serial data into JSON and publishing to AWS IoT Core over MQTT. AWS IoT Core: The managed cloud gateway that securely receives our telemetry. AWS IoT Rules Engine: Evaluates inbound messages and routes them. Amazon Timestream: A fast, scalable, purpose-built time-series database for storing the telemetry. Amazon Managed Grafana: Connects natively to Timestream for rich, real-time dashboarding. Step 1: Ingesting Data at the Edge First, ensure your hardware is outputting clean, consistent data. Here is a lightweight Python bridge snippet that reads serial data from your embedded hardware and publishes it to AWS IoT Core using the AWSIoTPythonSDK:
import serial import json import time from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient
# Configure Serial Connection ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)
# Configure AWS IoT MQTT Client mqtt_client = AWSIoTMQTTClient("HardwareNode01") mqtt_client.configureEndpoint("your-iot-endpoint.iot.region.amazonaws.com", 8883) mqtt_client.configureCredentials("root-CA.crt", "private.pem.key", "certificate.pem.crt") mqtt_client.connect()
while True: if ser.in_waiting > 0: line = ser.readline().decode('utf-8').rstrip() # Assuming the hardware sends data like: "Distance: 45, Angle: 90" try: parts = line.split(',') distance = int(parts[0].split(':')[1].strip()) angle = int(parts[1].split(':')[1].strip())
payload = json.dumps(\{
"device\_id": "sensor\_array\_1",
"timestamp": int(time.time() \* 1000),
"metrics": \{
"distance\_cm": distance,
"angle\_deg": angle
}
})
mqtt\_client.publish("telemetry/radar", payload, 1)
except Exception as e:
print(f"Data parsing error: \{e}")

Step 2: Routing via AWS IoT Rules Engine Once the JSON payload hits the telemetry/radar MQTT topic, we need to route it. Navigate to AWS IoT > Message Routing > Rules. Create a new rule with the following SQL statement:
SELECT * FROM 'telemetry/radar'
For the Rule Action, select Write a message into a Timestream table. Database Name: IoTTelemetryDB Table Name: RadarMetrics Dimensions: Configure device_id as a dimension so you can filter by specific hardware nodes later. Timestamp: Map this to the ${timestamp} variable in your payload to ensure precise chronological ordering. Step 3: Storing in Amazon Timestream Amazon Timestream is optimized for this exact workload. It automatically manages the lifecycle of time-series data—keeping recent data in memory for fast querying and moving older data to a magnetic store for cost-effective historical analysis. Because we bypassed AWS Lambda and used the IoT Rule Action directly to Timestream, we drastically reduce execution time, keeping our cloud-side latency extremely low. Step 4: Visualizing with Amazon Managed Grafana With data flowing into Timestream, it’s time to build the visual interface. Provision an Amazon Managed Grafana workspace. Under Data Sources, add Amazon Timestream. Grafana has a native plugin for this, making IAM role integration seamless. Create a new Dashboard and add a Time Series panel. Use the following sample query to visualize the object distance over time:
SELECT time, measure_value::bigint AS distance FROM "IoTTelemetryDB"."RadarMetrics" WHERE measure_name = 'distance_cm' AND time between $__timeFrom and $__timeTo ORDER BY time DESC
Conclusion By leveraging AWS IoT Core natively with Timestream and Grafana, you eliminate the need to manage databases, write complex routing lambdas, or build custom front-end applications from scratch. This architecture provides a robust, enterprise-grade cloud developer toolset that perfectly complements innovative embedded hardware projects. What visualization tools are you currently using for your hardware telemetry? Let's discuss in the comments!
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article