Skip to main content
MQTT telemetry enables real-time monitoring and logging of your Donkeycar’s performance metrics over the network. Stream sensor data, control outputs, and diagnostic logs to a remote dashboard or monitoring system.

Overview

MQTT telemetry provides:
  • Real-time monitoring - Stream metrics to remote dashboards
  • Remote logging - Capture Python logs over the network
  • Data streaming - Push sensor readings to IoT platforms
  • Performance analysis - Monitor throttle, steering, and velocity
  • Flexible topics - Publish to custom MQTT topics

Architecture

The telemetry system uses MQTT protocol to publish data:

Configuration

Enable MQTT telemetry in myconfig.py:
From donkeycar/templates/cfg_path_follow.py:481-494.

Environment Variables

Override settings with environment variables:

MqttTelemetry Part

Basic Usage

From donkeycar/templates/path_follow.py:102-103.

Implementation

The telemetry part from donkeycar/parts/telemetry.py:24-51:

Publishing Formats

Individual Topics (Default)

Each metric publishes to its own topic:
Topics:

JSON Format

Publish all metrics in a single JSON message:
Payload:
From donkeycar/parts/telemetry.py:109-111:

Custom Metrics

Add custom metrics to telemetry:
From donkeycar/parts/telemetry.py:53-61:

Logging Integration

Publish Python logs via MQTT:
Logs publish to:
From donkeycar/parts/telemetry.py:48-51:

Manual Reporting

Publish arbitrary metrics:
From donkeycar/parts/telemetry.py:73-85:

Threaded Operation

The telemetry part runs in a background thread:
From donkeycar/parts/telemetry.py:175-179.

MQTT Brokers

Public Brokers

Test with public MQTT brokers:

Local Broker

Install Mosquitto locally:

Cloud Platforms

Connect to IoT platforms:

Monitoring

Command Line

Subscribe to telemetry topics:

Python Subscriber

Web Dashboard

Use MQTT dashboards:
  • Node-RED - Visual flow-based dashboard
  • Grafana - Time-series visualization
  • Home Assistant - IoT dashboard
  • HiveMQ Web Client - Browser-based monitoring

Data Types

Supported telemetry types:
From donkeycar/parts/telemetry.py:64-71:
Complex types (arrays, images) are not supported.

Performance

Monitor telemetry queue:
From donkeycar/parts/telemetry.py:95-96:

Best Practices

  1. Use local broker - Reduce latency and network dependencies
  2. Limit publish rate - Balance resolution with bandwidth
  3. Monitor queue size - Detect slow network or broker issues
  4. Filter metrics - Only publish necessary data
  5. Use JSON for dashboards - Easier to parse in web UIs

Troubleshooting

Connection Failed

No Data Published

High Queue Size

  • Increase TELEMETRY_PUBLISH_PERIOD
  • Reduce number of metrics
  • Check network bandwidth
  • Use local MQTT broker

Next Steps