Arduino Yun & Arduino Leonardo communication via USB

Hi
The Leonardo has a keypad. The keys pressed have to be transfered to the Yun who has to process these keys.
I would like to connect an Yun and a Leonardo via USB.
How can I do that?

  1. Can I connect the Leonardo to the Yun like plug in a USB cable to the Host port of the Yun and then to the Leonardo?
  2. I connect both to a USB Hub. How?
  3. How can send serial Data from the Leonardo to the Yun.

Please give me a clue how to solve this task.

Best Regards and TIA

Josef

sys64738:

  1. Can I connect the Leonardo to the Yun like plug in a USB cable to the Host port of the Yun and then to the Leonardo?
  2. I connect both to a USB Hub. How?
  3. How can send serial Data from the Leonardo to the Yun.
  1. Yes.
  2. Yes, Yun supports powered USB Hub.
  3. It depends, are you connecting the leonardo as a HID device or as a Leonardo board.

I already found a part of a solution for my problem.
I connect the Leonardo with a Micro USB cable to the host port of the Yun.
Then I did something which I found here: http://blog.baeyens.it/#post11

I did:
opkg update
opkg install kmod-usb-acm
opkg install minicom

minicom -o ttyACM0
setup the serial port (baudrate & device /dev/ttyACM0)

Bingo I can see the output of the Leonardo (done with Serial.println)

Now I need a program just to read /dev/ttyACM0 and to setup the baudrate.

I will try to report more information tomorrow.

Thanks so far

Josef

Plan B:
The Arduino Yún is a microcontroller board based on the ATmega32u4 (Leonardo) and the Atheros AR9331.

Move keypad to ATmega32u4 of Yun.

sonnyyu:
Plan B:
The Arduino Yún is a microcontroller board based on the ATmega32u4 (Leonardo) and the Atheros AR9331.

Move keypad to ATmega32u4 of Yun.

Yep, that sounds like the choice, unless those pins are already used.

mart256:
Yep, that sounds like the choice, unless those pins are already used.

+1

Plan C:
Yun shield + Arduino Mega

It has 54 digital input/output pins (of which 14 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports). It will make life easy.

Thanks for Plan B to Plan C, but the Yun is already at its limit and the keypad uses many IOs, so I needed a second device the Leo. The hardware for this project is set.
The charming thing is I just need one USB Cable to the Leo.
First I was thinking of using the Leo as an USB keyboard. But it seems to be more complicated to implement HID USB on the Yun (at least it is not there out of the box).
So in this case my Plan B was USB serial. I think I will run some Python code to read ttyACM0 and process the input with that Python code.
The Yun shield (+Mega) is a nice Device maybe I will use that in another project. Thanks for your help guys.

Best Regards
Josef

sys64738:
...
The hardware for this project is set.
...

FYI

Plan D:

connect with AR9331 USB host port.