How to Use Serial Connect on a PX4 Flight Controller
Setting up a serial connection to a PX4 flight controller is one of the most fundamental skills in UAV development and autonomous drone configuration. Whether you're debugging firmware, configuring peripherals, or pushing mission parameters, understanding how serial communication works with PX4 opens up precise, low-level control that USB alone can't always deliver.
What Serial Connection Means in the PX4 Context
PX4 is an open-source autopilot software stack that runs on hardware like the Pixhawk series. Serial connection refers to communicating with the flight controller over a UART (Universal Asynchronous Receiver-Transmitter) interface — either through a physical serial port or via a USB-to-serial adapter.
PX4 hardware typically exposes multiple serial ports, labeled TELEM1, TELEM2, GPS, and DEBUG. Each maps to a specific UART on the microcontroller. When you "serial connect" to PX4, you're establishing a byte-level communication channel — used by MAVLink telemetry, GPS modules, companion computers, or direct shell access.
This is distinct from a simple USB cable connection (which also uses serial protocol under the hood but abstracts most of it away).
Tools You Need Before You Start
Before initiating a serial connection, gather the right tools:
- USB-to-UART adapter (FTDI, CP2102, or similar) — required if connecting a serial port directly to a PC
- Ground Control Station (GCS) software such as QGroundControl or Mission Planner
- MAVLink-capable terminal or a serial terminal like PuTTY, CoolTerm, or screen (Linux/macOS)
- Correct wiring — TX on one device connects to RX on the other, shared ground is mandatory
- PX4 parameter knowledge — specifically
SER_TELx_BAUDparameters for baud rate configuration
The baud rate must match on both ends of the connection. PX4 defaults to 57600 baud on TELEM ports for MAVLink, though this is configurable.
Step-by-Step: Establishing a Serial MAVLink Connection 🔌
1. Identify the Target Serial Port
In PX4, each physical UART is assigned a software port number. Check your specific hardware documentation (e.g., Pixhawk 4, Cube Orange, Holybro Kakute) to confirm which physical connector maps to which UART. TELEM1 is typically the primary telemetry port.
2. Configure PX4 Parameters
Using QGroundControl connected via USB first:
- Navigate to Vehicle Setup > Parameters
- Search for
SER_TEL1_BAUD— set this to match your adapter or companion computer - Search for
MAV_0_CONFIG— assign it to the correct serial port - Optionally set
MAV_0_MODEto control what MAVLink messages are streamed
After saving, reboot the flight controller to apply parameter changes.
3. Wire the Physical Connection
| PX4 Port Pin | Connect To |
|---|---|
| TX | RX on USB-UART adapter |
| RX | TX on USB-UART adapter |
| GND | GND on USB-UART adapter |
| 5V (optional) | Only if powering adapter from FC |
Never connect VCC blindly — check whether your adapter is 3.3V or 5V logic, and verify the PX4 hardware's voltage tolerance on that port.
4. Open the Connection in Your GCS or Terminal
In QGroundControl:
- Go to Application Settings > Comm Links
- Add a new link, select Serial, choose the correct COM port, set the matching baud rate
- Click Connect
In a serial terminal (e.g., PuTTY on Windows or screen /dev/ttyUSB0 57600 on Linux):
- Select the correct port, set baud to match PX4's configured rate
- You'll see raw MAVLink binary unless you're accessing the NuttX shell
5. Access the PX4 Shell (Optional Advanced Step)
The DEBUG UART or NSH console exposes PX4's NuttX shell — a command-line environment for direct system interaction. Connect at 57600 baud (hardware-dependent), press Enter, and you should get a nsh> prompt. From here you can run param show, listener sensor_accel, or other diagnostic commands. 🛠️
Variables That Determine Your Outcome
Several factors shape how smoothly this process goes:
- Flight controller hardware — pin layout, voltage levels, and available serial ports vary significantly between Pixhawk generations and third-party PX4-compatible boards
- Operating system — driver availability for USB-UART adapters differs between Windows, macOS, and Linux; FTDI chips are broadly supported, while some cheaper CH340-based adapters require manual driver installation
- Firmware version — PX4 parameter names and defaults have changed across major versions (1.12, 1.13, 1.14+); always cross-reference with the documentation matching your installed firmware
- Companion computer integration — connecting a Raspberry Pi or Jetson via serial requires additional configuration of MAVLink routing and may involve
mavlink-routerorMAVSDK - Purpose of the connection — telemetry streaming, GPS passthrough, RTCM injection, or shell access each require different parameter profiles
How Setup Differs Across Common Use Cases
Basic telemetry to a ground station is the simplest path: wire TELEM1 to a telemetry radio, match baud rates, and QGroundControl handles the rest automatically once it sees MAVLink heartbeats.
Companion computer integration is more involved — you're configuring MAVLink routing between serial and a network interface, often setting specific message rates to avoid saturating a low-speed UART.
Direct shell access requires knowing which port exposes the NuttX console on your specific hardware, and some boards lock this behind a solder bridge or jumper.
GPS or sensor wiring via serial uses a completely different parameter set (GPS_1_CONFIG, specific baud rates for u-blox protocols) and is not MAVLink-based at all. ⚙️
The steps above are consistent across most PX4-compatible hardware, but the specific port labels, parameter names, and voltage tolerances in your build are what ultimately determine whether the connection works cleanly the first time or requires iteration.