TLDR{
Add the ubuntu
user to the dialout
group when connecting to an Arduino
}TLDR
My kid was learning to blink leds using an Arduino at a summer camp that he attended recently. He was interested enough to ask if I could buy him an Arduino kit so he could try things at home as well.
We went window shopping at the local Micro Center (which opened fairly recently)
and found that they did carry a whole bunch of microcontroller kits (RPI
, of
course and a bunch of arduino
s and even the venerable microbit
s).
We got the Nano FT232 Starter kit (Kit #055251, manufacturer: Inland - KC3N) which was the cheapest Arduino kit we could find there - cost: $15.
It came with an Arduino Nano, a USB cable, a bunch of resistors, leds, wires, IR transmitter/receiver, push buttons and probably the worlds smallest breadboard.
Before buying it I did some research to verify that my laptop (running Ubuntu
)
would be able to connect and talk to the device via their IDE.
Once we got home, my kid was confident enough to attach it and browse the website listed in the instructions and follow through on all of the instructions to get to build the code. When it came time to upload it to the Arduino through, it failed with the IDE reporting a permission error. And being the "home/local sysadmin", that's when I get called in.
Looking at the error, it was clear that /dev/ttyUSB0
had write permissions
only for user:
"root" and group:
"dialout" and no permissions at all for the
other:
"ubuntu" user that we were using. I decided to add "ubuntu" to the group
"dialout" by editing /etc/group
. Once that was done and after a reboot - "just
to be safe", my kid ran into a new error: the original device that had been
available at /dev/ttyUSB0
was no longer showing up. So I was called in again.
Troubleshooting using lsusb
showed that the device was not visible at all.
Looking at what was different, I noticed that my kid had moved the device from one side of the laptop to the other side so as to use the mouse that was now connected in its old location. My spidey senses tingling, I decided to move the Arduino's USB connection back to the original USB port on the laptop and sure enough, everything started working again and my kid was finally able to upload the code via the IDE to the Arduino.
Debugging why moving the Arduino's USB connection between two USB ports (both of which are working) caused breakage (in the udev subsystem?) is left as an exercise for a later blog entry.