Yún – How to add a serial port

by luca

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):

Related Posts


lapique Tuesday March 11th, 2014 - 06:33 PM

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 Saturday March 15th, 2014 - 10:25 AM

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

Piotr Thursday June 12th, 2014 - 11:53 AM

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 Monday June 16th, 2014 - 08:20 AM

Hi Piotr,

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

Mauro Thursday January 8th, 2015 - 04:52 PM

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 Friday January 9th, 2015 - 08:27 AM

Ciao Mauro

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


Leave a Comment

seventeen − 2 =