You are here:-, PX4-PX4 Research Log [3] – Connect to Pixhawk via Serial in Ubuntu

PX4 Research Log [3] – Connect to Pixhawk via Serial in Ubuntu

Being able to connect to PX4 via Serial is essential for development. It allows you to run individual apps in PX4 and it provides a straight forward interface for debugging. I have successfully connected to a HK Pilot 32 using a FTDI breakout adapter in Ubuntu, and here is how I did it.

A quick summary:

  1. Connect FTDI cable and USB cable
  2. Install putty, launch and configure
  3. Run some applications

1. Connect FTDI cable

PX4 serial connection works a bit different than Ardupilot. If you connect your Pixhawk to the computer via a micro USB cable, you will only see gibberish in the console. The correct way is to use the serial port on Pixhawk and connect to the computer via a FTDI cable. A FTDI cable is something like this:

FTDI cableftdicable
FTDI breakout adapter

The breakout adapter is the same as the cable, except you need to bring your own micro USB cable to connect it to the computer. The tricky part is to get the pin out match correctly.For the serial connection you only need three wires, the RX, TX and GND.


FTDI to Pixhawk serial pin matching table

The complete setup is shown below.


Pixhawk serial to FTDI adapater


Complete setup

The official guide can be found here: PX4 serial connection

So far I have only successfully connected a Pixhawk/HK Pilot 32 to Ubuntu. I haven’t found a way to connect a Pixfalcon to the console, as there is no serial port.

Update: it turns out you can connect to serial via micro USB cable if you remove the micro SD card.

2. Install putty, launch and configure

There are many serial console applications on Ubuntu (e.g. screen, minicom, piocom etc.). Putty is the preferred application in UAB lab. To install putty, open a terminal window, and type:
sudo apt-get install putty

If it is installed correctly, launch putty by using the command (use the sudo prefix to make sure you have access to all the ports):

sudo putty

Now you should see a window like this:

Putty Interface

Putty Interface

The key configurations here are connection type and serial line as circled in red. For connection type choose Serial. The serial line is usually /dev/ttyUSB0 or /dev/ttyACM0 on Linux. If you want to check which one is it you can type “ls /dev/tty*” in the terminal before and after you plug in the cable, and see which one has changed. You can save your session by clicking the save below so you don’t have to configure every time you launch putty.

Now click open at the bottom to start the session. You should see a new window with title “/dev/ttyXXXX – PuTTY”.

3. Run some applications

To check if your connection is established successfully, type “help” into the PuTTY console. If you see something like the screen shot below, congratulations! You can also play around some of the Builtin Apps from help, such as “tone_alarm” and “rgbled”.

What you should see if you type help in PuTTY

What you should see if you type help in PuTTY


By |2017-05-22T05:52:57+00:00July 29th, 2016|Categories: Flight Control, PX4|11 Comments

About the Author:


  1. Mao October 15, 2016 at 11:24 am - Reply

    hi,Zi hao
    If I dont have a FTDI adapater, can I connect the Pixhawk with its initial USB in the putty?

    • zihao October 17, 2016 at 4:57 am - Reply

      Hi Mao

      I assume you mean using the micro-usb cable and the micro-usb port on the Pixhawk to establish serial connection,

      The good news is yes you can, you just need to take the SD card out and connect to ttyACM0 (the port on Ubuntu).

      the bad news is I couldn’t get it to work normally, the console just prints gibberish for whatever the baud rate I have tired. But the strange thing is, if you take the SD card out and connect to ttyACM0 (that’s the Pixhawk usb port on Ubuntu) again, it will work. But obviously there will be other problems with the SD card not installed.

      I highly recommend you to get a FTDI cable adapter, they are really cheap and reliable.

  2. Ayesha January 6, 2017 at 10:23 am - Reply

    Hello Mao/ Zi hao,

    I didn’t have an FTDI cable so tried connecting to nsh over MAVLink. It works. Not sure if this helps you in any way but here is the link

    • zihao January 9, 2017 at 1:22 am - Reply

      Hi Ayesha

      Thanks for the info. I shall add this method to my blog once I have verified it is working on my system.

  3. Ayesha January 14, 2017 at 5:40 pm - Reply

    Hi zihao,

    Have you found a way to get the debug prints from the PX4 codebase without using the hardware serial port ?
    I am trying to get some prints using NSH over MAVLink. No luck so far.
    Might really help if you have an idea.

  4. Venkata Krishnan January 21, 2017 at 5:00 pm - Reply

    guys if i use the open source pcb design and print a Pixhawk Newly
    how do i upload the firmware ?
    My board is not getting detected via usb
    please help me out

    • flyingk January 28, 2017 at 12:44 am - Reply

      You probably have to install the bootloaders and the entire nuttx system for it to work. We have never tried that, though.

  5. Abel February 8, 2017 at 5:42 pm - Reply

    Thanks. I used Dronecode probe ( and both the procedures on and your procedure worked for me. The only problem I faced was that I had to find the correct serial port. I typed ls /dev/tty* before and after plugging the usb and saw the difference. The new change, ttyACM1 was my usb port.

  6. Tiago March 16, 2017 at 4:38 pm - Reply

    Hi Zihao! Your tutorials are very helpful!

    I’m having a problem with this step though. I only get the gibberish when connecting with the FTDI. With or without the SD card. Any idea what the problem is?

  7. BT March 31, 2017 at 5:28 pm - Reply

    thanks for what you share,it is realy helpful.
    and recentely
    i found that there is a way using the micro-usb cable and the micro-usb port on the Pixhawk to establish serial connection,but you do not have to take the sd card out.

    console command:

    cd /Firmware/Tools
    ./ /dev/ttyACM0
    push enter

    • zihao April 1, 2017 at 5:11 am - Reply

      That’s wonderful, thanks for sharing!

Leave A Comment