Reading Serial Data from USB host

Hi, I’m new in Arduino Yun.

I’m trying to connect and Arduino YUN and a USB Serial device. It can be, as an example, an Arduino UNO. I connect my UNO to USB host from YUN.


How can I read from YUN data sent by UNO? Need a phyton script that “listen” the usb?


Yes you can do that with python. See

Great! I just need to figure out how to install all that . lol..

Regards, Seba.

I connect my yun to a Arduino mega You may be interested in this blog article : Best regards Jantje

I still can´t do this.

Steps: 1) I use sd to extend YUN space with: 2) I download pyserial-2.7.tar.gz from 3) Unzip folder with 7zip. 4) I install "Ssfhs Manager" to transfer files but it crashed every time.

How and where I copy that folder?


opkg update
opkg list |grep pyserial
opkg install pyserial

As sonnyyu said, pyserial is one of the available packages for the Yun. BTW there are more than 3000 of them, chances are what you need is ready to be installed. And if it's not, request it on github [1]


Plan B:

opkg update
opkg install python-openssl #adds ssl support to python
opkg install distribute #it contains the easy_install command line tool (this can take some time)
easy_install pip #installs pip  (this can take some time)
#opkg remove pyserial
pip install pyserial

Plan C:

#pip uninstall pyserial
easy_install pyserial

Plan D:

#easy_install -m  pyserial #remove it 
cd /mnt/sda1
tar zxf pyserial-2.7.tar.gz
cd pyserial-2.7
python install

This allow you install latest version of pyserial-2.7 or the version you like!

Backup plan:

There are 2 type python entensions, one is ctypes, one is c-api.

pyserial is ctypes, could be easily installed.

for c-api extension GCC is needed for compile c library.

Native GCC for Yun

lordk I hope you've been successful in running opkg install pyserial as it is the easiest way of the many described so far. Did you?

Yes, I use “Plan D”., but I change:

wget --no-check-certificate

For new linux user like me you need to install “wget” and “tar” with:

opkg update
opkg install wget
opkg install tar

Then I have trouble with /dev/ttyxxx till I realised that I need to install FTDI drivers.

Useful links:


Did the opkg version fail? By the commands you used it looks like you're using the old image. Please upgrade it ASAP following the link in my signature. A list of improvements in available in the sticky topic "Please upgrade your Yun"

Thanks Federico, I have updated my YUN now.

I´m lost in doing the reading. I read these post but cant make it work. -> use picocom -> a post u reply

Only a few times it works. I commented line of ttyATH0::askfirst:/bin/ash --login on /etc/inittab

YUN Code (YUNSerialTerminal mod)

long linuxBaud = 9600;

void setup() {
  Serial.begin(115200);      // open serial connection via USB-Serial
  Serial1.begin(linuxBaud); // open serial connection to Linux

void loop() {
 // copy from virtual serial line to uart and vice versa
  if (Serial.available()) {           // got anything from USB-Serial?
     char c = (char);     // read from USB-serial
      Serial.print("Char: ");  
      Serial1.print(c);             //    otherwise write char to Linux

Python Code

import serial
ser = serial.Serial ('/dev/ttyATH0',9600 )
while True:
         print ser.readline()

Is this the best way of doing this? Regards.

The problem is you are trying to use ttyATH0 which is in use by Yuns bridge implementation. Try using another port or modify inittab.

It depends on the device you're plugging to the you, but you'll need additional kernel modules for talking to another Arduino (say a UNO) plugged to the yun. Try

opkg update
opkg install kmod-usb-acm


the linino(UBS host) <-> FDTI is working. I can read in the python console the Strings coming up from the FTDI, what I cant make it work is the Arduino<-> linino communication.-

edit: Commenting the line in inittab seems to work. Can I change the serial1 port as MAMU suggested so I leave inittab as default??

lordk: edit: Commenting the line in inittab seems to work. Can I change the serial1 port as MAMU suggested so I leave inittab as default??

Sadly, no.

It has to be a easy way to send data from linino to ATmega without mixing data.