Announcement

REXYGEN forum has been moved. This one is closed.
Head over to the new REXYGEN Community Forum at https://forum.rexygen.com.

Looking forward to meeting you there!
 

#1 2015-11-10 13:14:28

contactform
Member
Registered: 2015-10-30
Posts: 45

Multiple Arduino boards?

Is it possible to connect more than 1 Arduino (trough USB) with de Rexcore/raspberry?

Offline

#2 2015-11-10 15:12:48

jaroslav_sobota
Administrator
Registered: 2015-10-27
Posts: 535

Re: Multiple Arduino boards?

Yes it is but some extra care is necessary. If you just plug the 2 Arduinos in and reboot, you never know which one of them is /dev/ttyACM0 and which one is /dev/ttyACM1 (or /dev/ttyUSB*, see the other topic on identifying your Arduino).

So let's get this sorted out. First plug in only one Arduino and type

ls /dev/ttyACM*

You should get /dev/ttyACM0. Use it in the following command.

Then run this command

udevadm info -a -n /dev/ttyACM0 | less | grep KERNELS

You will get something like:

    KERNELS=="1-1.2:1.0"
    KERNELS=="1-1.2"
    KERNELS=="1-1"
    KERNELS=="usb1"
    KERNELS=="20980000.usb"
    KERNELS=="soc"
    KERNELS=="platform"

Write down the identifier from the first line ("1-1.2:1.0"). This identifies the USB port in your system.

Repeat the above with the Arduino connected to another USB port(s) and find the USB port identifiers. I have "1-1.2:1.0" and "1-1.3:1.0".

Now create a file named /etc/udev/rules.d/99-arduino.rules, e.g.

sudo nano /etc/udev/rules.d/99-arduino.rules

Put the following in:

SUBSYSTEM=="tty", KERNEL=="ttyACM*", KERNELS=="1-1.2:1.0", SYMLINK+="arduino_one"
SUBSYSTEM=="tty", KERNEL=="ttyACM*", KERNELS=="1-1.3:1.0", SYMLINK+="arduino_two"

Add more lines if you plan to use more than two Arduinos. Save and exit.

This means that whenever a ttyACM* device is plugged into the USB port "1-1.2:1.0", a symbolic device /dev/arduino_one is created. And that whenever a ttyACM* device is plugged into the USB port "1-1.3:1.0", a symbolic device /dev/arduino_two is created.

Now disconnect your Arduino and run

sudo /etc/init.d/udev reload

Afterwards connect your Arduinos to the appropriate USB ports and you should be able to use /dev/arduino_one and /dev/arduino_two in the REXduino function blocks. Unless you mismatch the USB ports, you'll always know which Arduino you are referring to.

Offline

Board footer

Powered by FluxBB