MAVLinkAnywhere is a general-purpose project that enables MAVLink data streaming to both local endpoints and remote locations over the internet. This project provides simplified scripts to install and configure mavlink-router on companion computers (Raspberry Pi, Jetson, etc.). mavlink-router is a powerful application that routes MAVLink packets between various endpoints, including UART, UDP, and TCP, making it ideal for MAVLink based UAV (PX4, Ardupilot, etc.) and drone communication systems.
Watch our comprehensive setup guide that walks you through the entire process:
- 00:00 - Introduction
- 02:15 - Setting up the Raspberry Pi
- 04:30 - Local MAVLINK Streaming
- 08:30 - Smart WiFi manager setup
- 11:40 - Internet-based MAVLink Streaming
- 15:00 - Outro
- Raspberry Pi (any model)
- Pixhawk/ArduPilot/PX4 flight controller
- Basic UART connection cables
Before starting with MAVLinkAnywhere, ensure that:
- Your companion computer (Raspberry Pi, Jetson, etc.) is installed with Ubuntu or Raspbian OS
- You have properly wired your Pixhawk's TELEM ports to the companion computer's UART TTL pins
- MAVLink streaming is enabled on the TELEM port of your flight controller
- 5G/4G/LTE: Use USB Cellular dongles for mobile connectivity
- Ethernet: Direct connection to your network interface
- WiFi: For WiFi connectivity, we recommend using our Smart WiFi Manager project to ensure robust and reliable connections to your predefined networks
- Satellite Internet: Compatible with various satellite internet solutions
For internet-based telemetry, you have several VPN options:
- NetBird (Recommended, demonstrated in video tutorial)
- WireGuard
- Tailscale
- ZeroTier
- Legacy Setup Video from 2020 (Note: Our 2024 method shown above is much simpler)
Alternatively, you can configure port forwarding on your router.
Our installation script seamlessly installs mavlink-router on your companion computer, taking care of all necessary dependencies and configurations.
- Clone the repository:
git clone https://github.com/alireza787b/mavlink-anywhere.git cd mavlink-anywhere - Run the installation script:
chmod +x install_mavlink_router.sh sudo ./install_mavlink_router.sh
- Checks if
mavlink-routeris already installed - Removes any existing
mavlink-routerdirectory - Updates the system and installs required packages (
git,meson,ninja-build,pkg-config,gcc,g++,systemd,libsystemd-dev,python3-venv) - Intelligently manages swap space during compilation (supports both legacy
dphys-swapfileand modern swap methods) - Clones the
mavlink-routerrepository and initializes its submodules - Creates and activates a Python virtual environment
- Installs the Meson build system in the virtual environment
- Builds and installs
mavlink-routerusing Meson and Ninja - Resets the swap space to its original size after installation
Note: The installation script is compatible with all Debian/Raspbian versions, including the latest Bookworm and Trixie releases (2024+). It automatically:
- Detects your system's swap management method (dphys-swapfile or standard)
- Bypasses pkg-config issues by explicitly setting the systemd directory
- Works on Raspberry Pi 5 and all other Raspberry Pi models
If you encounter build issues:
-
"Dependency systemd not found" - The script automatically handles this by explicitly setting the systemd directory path, bypassing pkg-config lookup issues common on some Debian Trixie systems.
-
"dphys-swapfile: command not found" - This is normal on newer systems. The script automatically falls back to standard Linux swap management.
-
Build failures due to low memory - The script automatically increases swap space to 2GB during compilation and restores it afterward.
The configuration script generates and updates the mavlink-router configuration, sets up a systemd service, and enables routing with flexible endpoint settings.
- Run the configuration script:
chmod +x configure_mavlink_router.sh sudo ./configure_mavlink_router.sh
- Follow the prompts to set up UART device, baud rate, and UDP endpoints:
- If an existing configuration is found, the script will use these values as defaults and show them to you
- UART Device: Default is
/dev/ttyS0. This is the default serial port on the Raspberry Pi - Baud Rate: Default is
57600. This is the communication speed between the companion computer and connected devices - UDP Endpoints: Default is
0.0.0.0:14550. You can enter multiple endpoints separated by spaces (e.g.,100.110.200.3:14550 100.110.220.4:14550)
- Prompts the user to enable UART and disable the serial console using
raspi-config - Reads existing configuration values if available, and uses them as defaults
- Prompts for UART device, baud rate, and UDP endpoints
- Creates an environment file with the provided values
- Generates the
mavlink-routerconfiguration file - Creates an interactive script for future updates if needed
- Stops any existing
mavlink-routerservice - Creates a systemd service file to manage the
mavlink-routerservice - Reloads systemd, enables, and starts the
mavlink-routerservice
- Check the status of the service:
sudo systemctl status mavlink-router
- View detailed logs:
sudo journalctl -u mavlink-router -f
Use QGroundControl to connect to your companion computer's IP address on the configured UDP endpoints. For internet-based telemetry, make sure to follow the setup video to properly register your devices on your chosen VPN system or configure port forwarding on your router.
For more information, visit the GitHub Repo.
If you encounter any issues, please:
- Check the video tutorial timestamps for specific setup steps
- Review the relevant sections in this documentation
- Open an issue on GitHub with detailed information about your setup
- MAVLink
- Raspberry Pi
- Drone Communication
- UAV
- mavlink-router
- UART
- UDP
- TCP
- QGroundControl
- Drone Telemetry
- Remote Telemetry
- VPN
- NetBird
- WireGuard
- Smart WiFi
- 4G Telemetry