Yún – How to add a serial port

luca 02/12/2013 6

The ATmega32u4 microcontroller, used on the Arduino Yun, has a serial port (PIN 0 and 1) connected internally to the AR9331 chip that runs the Linux distribution Linino:

As the Arduino Leonardo, also Arduino Yun emulates a serial port through an USB connection (micro USB connector). Sometimes it’s needed to have a physical serial port, for example to connect to devices that can’t act as USB host and therefore accept an USB connection (consoles of network equipments…).

Yun has also an USB host port, which can accept USB peripherals like keyboards, webcams… and also USB->serial adapters:

Choose an adapter based on one of the FTDI ICs, for example the famous FT232R:

Connect to the Yun via SSH and install the appropriate kernel module:

opkg install kmod-usb-serial-ftdi

If you now connect the adapter and display the system messages (using the dmesg command) you can read that the adapter is correctly detected and a new serial port is added (named ttyUSB0 in the screenshot below):


  1. lapique 11/03/2014 at 18:33 - Reply

    opkg install kmod-usb-serial-ftdi
    Unknown package ‘kmod-usb-serial-ftdi’.
    Collected errors:
    * opkg_install_cmd: Cannot install package kmod-usb-serial-ftdi.

    • luca 15/03/2014 at 10:25 - Reply

      Hi Francis, is your Yun connected to Internet? Did you execute the “opkg update” command?

  2. Piotr 12/06/2014 at 11:53 - Reply

    According to the log of dmesg tt seems that my usb/serial adapter works. Can I use this serial port in Arduino part anyhow?

    • luca 16/06/2014 at 08:20 - Reply

      Hi Piotr,

      not directly but you may write a program running on the “Linux” side of the Yun:
      Sketch -> Linux -> Serial

  3. Mauro 08/01/2015 at 16:52 - Reply

    Ciao Luca.
    Fantastico Blog.
    Quindi se ho ben capito, volendo connettere alla Yun il modulino HC-06 Bluetooth non lo posso collegare ai pin 0-1 come ho sempre fatto con Arduino UNO Rev3 ma devo per forza collegare una seriale esterna ? :-(

    • luca 09/01/2015 at 08:27 - Reply

      Ciao Mauro

      esattamente: la seriale “fisica” dell’ATMega32 è connessa al SoC Linux, quella che è disponibile è “emulata” (CDC)

Leave A Response »

This website uses cookies to ensure you get the best experience on our website maggiori informazioni

Questo sito utilizza i cookie per fonire la migliore esperienza di navigazione possibile. Continuando a utilizzare questo sito senza modificare le impostazioni dei cookie o clicchi su "Accetta" permetti al loro utilizzo.