Skip to content
This repository was archived by the owner on Feb 10, 2020. It is now read-only.

Commit d55e147

Browse files
authored
Merge pull request #558 from kaine119/arduino-install-tutorial
Add Arduino IDE installation tutorial
2 parents 1846ae8 + b43d12f commit d55e147

File tree

5 files changed

+168
-0
lines changed

5 files changed

+168
-0
lines changed
25.3 KB
Loading
34.5 KB
Loading
47.2 KB
Loading
14.9 KB
Loading
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
---
2+
id: install-the-arduino-ide
3+
summary: Learn how to install the Arduino IDE in order to write code for Arduino boards.
4+
categories: iot
5+
tags: iot, arduino, install, setup
6+
difficulty: 2
7+
status: draft
8+
feedback_url: https://github.com/canonical-websites/tutorials.ubuntu.com/issues
9+
author: Canonical Web Team <webteam@canonical.com>
10+
published: 2017-12-14
11+
12+
13+
---
14+
15+
# Install the Arduino IDE
16+
17+
## Overview
18+
Duration:
19+
20+
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.
21+
22+
### What you'll learn
23+
- How to install the Arduino package from a tarball
24+
- How to add a user to a group (here, the `dialout` group)
25+
26+
### What you'll need
27+
- Ubuntu 16.04 (and above) Desktop
28+
- An Arduino board, and included mini-USB cable
29+
- Some basic command-line knowledge (including how to use `cd` to change directories)
30+
31+
## Installing via a tarball
32+
Duration: 3:00
33+
34+
We can download the latest version of the Arduino IDE from the Arduino website ([here](https://www.arduino.cc/en/Main/Software)) 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.xz` (or `.tar.gz`, if it uses _Z compression_. We'll get to this later).
35+
36+
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
37+
38+
```bash
39+
tar xvf FILENAME
40+
```
41+
42+
where `FILENAME` is the name of the download (typically arduino-(version number)-linux64.tar.xz).
43+
44+
The command can be read as
45+
* e**X**tract from an archive...
46+
* **V**erbosely (meaning it prints the name of every file it finds)...
47+
* from a **f**ile given by `FILENAME`.
48+
49+
When the command finishes, run `ls` again; `tar` should have created a new folder named arduino-(version number).
50+
51+
`cd` into the folder; there will be a file named `install.sh` in the folder. To install the IDE, execute `install.sh` with
52+
53+
```bash
54+
./install.sh
55+
```
56+
57+
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.
58+
59+
negative
60+
: **Installing via apt**
61+
While there *is* a package for the Arduino IDE on current APT repositories, it has not been updated for a while.
62+
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.
63+
64+
## First Launch
65+
Duration: 1:00
66+
67+
Before launching the IDE, connect your Arduino board to your computer with a USB cable.
68+
69+
Arduino should be available in the (Unity menu?); if not, it can be launched from the command line by running `arduino`.
70+
71+
### Permissions checker
72+
The first time we launch Arduino, a window will pop up asking to add us to the `dialout` group:
73+
74+
![Dialogue asking to add us to the dialout group][perm-checker.png]
75+
76+
We will get back to what this means later, but for now just click on `Add`.
77+
78+
### The editor
79+
After that, we should see the IDE's main editor window.
80+
81+
![Editor][first-launch-editor.png]
82+
83+
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.
84+
85+
Try running the code on your Arduino by clicking Upload (the right arrow along the top).
86+
87+
We should get an error:
88+
89+
```
90+
Binary sketch size: 1,054 bytes (of a 32,256 byte maximum)
91+
processing.app.SerialNotFoundException: Serial port 'COM1' not found. Did you select the right one from the Tools > Serial Port menu?
92+
(...)
93+
```
94+
95+
But if we try following the suggestion in the error above, the Serial Port menu is greyed out and can't be entered.
96+
97+
![Greyed out serial port menu][first-launch-serial-port-menu.png]
98+
99+
100+
What's going on?
101+
102+
## The dialout group
103+
104+
This is happening because the IDE *doesn't have sufficient permissions* to access the Arduino device.
105+
106+
### Permissions
107+
108+
We can look at the Arduino device by running
109+
110+
```bash
111+
ls -l /dev/ttyACM*
112+
```
113+
114+
in a terminal. The output looks mostly like this:
115+
116+
```bash
117+
crw-rw---- 1 root dialout 166, 0 Des 14 09:47 /dev/ttyACM0
118+
```
119+
120+
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 `root` and `dialout`.
121+
122+
The first name `root` is the owner of the device, and `dialout` is the owner group of the device.
123+
124+
The letters and dashes in front, starting after 'c', represent the permissions for the device by user:
125+
- The first triplet `rw-` mean that the owner (`root`) can read and write to this device
126+
- The second triplet `rw-` mean that members of the owner group (`dialout`) can read and write to this device
127+
- The third triplet `---` means that other users have no permissions at all (meaning that nobody else can read and write to the device)
128+
129+
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.
130+
131+
### Adding yourself to the `dialout` group
132+
133+
But wait! Earlier, when we were launching the IDE, we _did_ add ourselves to the `dialout` group!
134+
135+
![Dialogue prompting to add user to the dialout group][perm-checker.png]
136+
137+
So why does the IDE still not have permission to access the Arduino?
138+
139+
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.
140+
141+
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.
142+
143+
![Serial port option available][option-available.png]
144+
145+
## That's all folks!
146+
Duration: 1:00
147+
148+
Congratulations, you made it!
149+
150+
You've just installed the Arduino IDE on your computer; you've also learned how permissions and groups work in Linux!
151+
152+
### Next Steps
153+
154+
* Try your hand at making smart things with projects at the [Arduino Project Hub][arduino-project-hub]
155+
* Learn more about how the Arduino language works with Arduino's [tutorial][arduino-sketch-tutorial]
156+
157+
### Further readings
158+
159+
* More resources from Arduino at [their Getting Started page][arduino-getting-started]
160+
161+
[perm-checker.png]: ./images/perm-checker.png
162+
[first-launch-editor.png]: ./images/first-launch-editor.png
163+
[first-launch-serial-port-menu.png]: ./images/greyed-out-option.png
164+
[option-available.png]: ./images/option-available.png
165+
166+
[arduino-getting-started]: https://www.arduino.cc/en/Guide/HomePage
167+
[arduino-project-hub]: https://create.arduino.cc/projecthub
168+
[arduino-sketch-tutorial]: https://www.arduino.cc/en/Tutorial/Sketch

0 commit comments

Comments
 (0)