When you launch the Arduino IDE, it polls all the USB
devices and builds a list that is shown in the Tools→
Serial Port menu. Click Tools→Serial Port and select
the serial port (most likely
/dev/ttyACM0
), then click
Tools→Board, and select the type of Arduino Board
you have (e.g.,
Uno
). Click File→Examples→01. Ba-
sics→Blink to load a basic example sketch. Click the
Upload button in the toolbar or choose File→Upload to
upload the sketch, and after the sketch loads, the Ardu-
ino’s onboard LED will start blinking.
To access the serial port on versions of the Raspberry
Pi OS older than Jessie, you’ll need to make sure that
the
pi
user has permission to do so. You don’t have to do
this step on Raspbian Jessie. You can do that by adding
the
pi
user to the
tty
and
dialout
groups. You’ll need to
do this before running the Arduino IDE:
sudo usermod
-a -G tty pi
sudo usermod -a -G dialout pi
usermod is a Linux program to manage users.
-a -G puts the user (pi) in the specified group
(tty, then dialout).
Finding the Serial Port
If for some reason,
/dev/ttyACM0
doesn’t work, you’ll need to do
a little detective work. To find the USB serial port that the Arduino
is plugged into without looking at the menu, try the following from
the command line. Without the Arduino connected, type:
ls /dev/tty*
Plug in the Arduino, then try the same command again and see what
changed. When I plugged in the Arduino, /dev/ttyACM0 popped up
in the listing.
Arduino and the Pi 81
GSW_RASPI_4ED_FIN.indd 81GSW_RASPI_4ED_FIN.indd 81 10/28/21 10:54 AM10/28/21 10:54 AM