|Summary||Learn how to install the Arduino IDE in order to write code for Arduino boards.|
|Author||Canonical Web Team firstname.lastname@example.org|
To get us up and running with Arduino, we are going to install the Arduino IDE, a program that will help us write code for the Arduino, and run our code on the board.
What you’ll learn
- How to install the Arduino package from a tarball
- How to add a user to a group (here, the
What you’ll need
- Ubuntu 16.04 (and above) Desktop
- An Arduino board, and included mini-USB cable
- Some basic command-line knowledge (including how to use
cdto change directories)
Installing via a tarball
We can download the latest version of the Arduino IDE from the Arduino website (here) as a tarball. A tarball is a type of compressed folder, like a
.zip file, commonly used to distrubute software in Linux; its file extension is usually
.tar.gz, if it uses Z compression. We’ll get to this later).
In order to extract the files we need from the tarball, we can open a terminal,
cd to where the downloaded tarball is, then run
tar xvf FILENAME
FILENAME is the name of the download (typically arduino-(version number)-linux64.tar.xz).
The command can be read as * eXtract from an archive… * Verbosely (meaning it prints the name of every file it finds)… * from a file given by
When the command finishes, run
tar should have created a new folder named arduino-(version number).
cd into the folder; there will be a file named
install.sh in the folder. To install the IDE, execute
If the script executes correctly and outputs
done! at the end of its output, the IDE was installed correctly! Let’s try to launch it in the next step.
ⓘ Installing via apt
While there is a package for the Arduino IDE on current APT repositories, it has not been updated for a while. As such, while it is still possible to install the IDE by running
sudo apt install arduino, it is not recommended to do so, as asking for support when using outdated software is more difficult.
Before launching the IDE, connect your Arduino board to your computer with a USB cable.
Arduino should be available in the (Unity menu?); if not, it can be launched from the command line by running
The first time we launch Arduino, a window will pop up asking to add us to the
We will get back to what this means later, but for now just click on
After that, we should see the IDE’s main editor window.
The IDE comes with example files that we can use to test if everything works. Let’s try open one such file: Under File > Examples > 01.Basics, choose Blink.
Try running the code on your Arduino by clicking Upload (the right arrow along the top).
We should get an error:
Binary sketch size: 1,054 bytes (of a 32,256 byte maximum) processing.app.SerialNotFoundException: Serial port 'COM1' not found. Did you select the right one from the Tools > Serial Port menu? (...)
But if we try following the suggestion in the error above, the Serial Port menu is greyed out and can’t be entered.
What’s going on?
The dialout group
This is happening because the IDE doesn’t have sufficient permissions to access the Arduino device.
We can look at the Arduino device by running
ls -l /dev/ttyACM*
in a terminal. The output looks mostly like this:
crw-rw---- 1 root dialout 166, 0 Des 14 09:47 /dev/ttyACM0
The ‘0’ at the end of ‘ACM’ might be different, and multiple entries might be listed, but the parts we need to focus on are the string of letters and dashes in front, and the two names
The first name
root is the owner of the device, and
dialout is the owner group of the device.
The letters and dashes in front, starting after ‘c’, represent the permissions for the device by user: - The first triplet
rw- mean that the owner (
root) can read and write to this device - The second triplet
rw- mean that members of the owner group (
dialout) can read and write to this device - The third triplet
--- means that other users have no permissions at all (meaning that nobody else can read and write to the device)
In short, nobody except
root and members of
dialout can do anything with the Arduino; since we aren’t running the IDE as
root or as a member of
dialout, the IDE can’t access the Arduino due to insufficient permissions.
Adding yourself to the
But wait! Earlier, when we were launching the IDE, we did add ourselves to the
So why does the IDE still not have permission to access the Arduino?
The changes that the prompt makes don’t apply until we log out and log back in again, so we have to save our work, log out, and log back in again.
After you log back in and launch the Arduino IDE, the Serial Port option should be available; change that, and we should be able to upload code to the Arduino.
That’s all folks!
Congratulations, you made it!
You’ve just installed the Arduino IDE on your computer; you’ve also learned how permissions and groups work in Linux!
- Try your hand at making smart things with projects at the Arduino Project Hub
- Learn more about how the Arduino language works with Arduino’s tutorial
- More resources from Arduino at their Getting Started page