Quantcast
Channel: Raspberry Pi – Into Robotics
Viewing all articles
Browse latest Browse all 146

How To setup Raspberry Pi to identify two Arduino devices

$
0
0

The applications that run on Raspberry Pi can’t always identify the serial port that belongs to each Arduino board. If we don’t use an identifier for each board, the serial port may change every time we disconnect or connect the Arduino board to Raspberry Pi.

In this tutorial, I’ll show you how to configure Raspberry Pi to automatically identify two Arduino boards. The procedure can be extended to multiple boards, but in this tutorial, I’ve used two identical Arduino boards.

How To setup Raspberry Pi to identify two Arduino devices

How To setup Raspberry Pi to identify two Arduino devices

Below are the steps to identify each board separately, regardless of which USB port of the Pi is used.

Step 1: navigate to /etc/udev/rules.d/99-arduino.rules
Step 2: this command returns the two serial ports connected to the Arduino boards

ls /dev/ttyACM*
ls /dev/ttyACM* for two Arduino boards

ls /dev/ttyACM* for two Arduino boards

Step 3: after finding the KERNEL of the two Arduino boards, run for each board the command:

udevadm info -a -n /dev/ttyACM00 | less

Instead of ttyACM00, use the serial port of the Arduino board
Step 4: for each Arduino’s KERNEL, add a line to the file 99-arduino.rules

Setup Raspberry Pi

Step 5: refresh udev

sudo /etc/init.d/udev reload

Viewing all articles
Browse latest Browse all 146

Trending Articles