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

Commit b1539bc

Browse files
committed
Add Arduino IDE installation tutorial
1 parent 8a601a4 commit b1539bc

File tree

5 files changed

+149
-0
lines changed

5 files changed

+149
-0
lines changed
25.3 KB
Loading
34.5 KB
Loading
47.2 KB
Loading
14.9 KB
Loading
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
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 with `apt-get`
24+
-
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
30+
31+
## Installing via apt
32+
Duration: 1:00
33+
34+
Installing the Arduino IDE and all its dependencies using `apt` is easy; just run
35+
36+
```bash
37+
sudo apt isntall arduino
38+
```
39+
40+
in a terminal.
41+
42+
43+
When apt finishes up, the Arduino IDE should be installed correctly! Let's try to launch it in the next step.
44+
45+
## First Launch
46+
Duration: 1:00
47+
48+
Before launching the IDE, connect your Arduino board to your computer with a USB cable.
49+
50+
Arduino should be available in the (Unity menu?); if not, it can be launched from the command line by running `arduino`.
51+
52+
### Permissions checker
53+
The first time we launch Arduino, a window will pop up asking to add us to the `dialout` group:
54+
55+
![Dialogue asking to add us to the dialout group][perm-checker.png]
56+
57+
We will get back to what this means later, but for now just click on `Add`.
58+
59+
### The editor
60+
After that, we should see the IDE's main editor window.
61+
62+
![Editor][first-launch-editor.png]
63+
64+
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.
65+
66+
Try running the code on your Arduino by clicking Upload (the right arrow along the top).
67+
68+
We should get an error:
69+
70+
```
71+
Binary sketch size: 1,054 bytes (of a 32,256 byte maximum)
72+
processing.app.SerialNotFoundException: Serial port 'COM1' not found. Did you select the right one from the Tools > Serial Port menu?
73+
(...)
74+
```
75+
76+
But if we try following the suggestion in the error above, the Serial Port menu is greyed out and can't be entered.
77+
78+
![Greyed out serial port menu][first-launch-serial-port-menu.png]
79+
80+
81+
What's going on?
82+
83+
## The dialout group
84+
85+
This is happening because the IDE *doesn't have sufficient permissions* to access the Arduino device.
86+
87+
### Permissions
88+
89+
We can look at the Arduino device by running
90+
91+
```bash
92+
ls -l /dev/ttyACM*
93+
```
94+
95+
in a terminal. The output looks mostly like this:
96+
97+
```bash
98+
crw-rw---- 1 root dialout 166, 0 Des 14 09:47 /dev/ttyACM0
99+
```
100+
101+
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`.
102+
103+
The first name `root` is the owner of the device, and `dialout` is the owner group of the device.
104+
105+
The letters and dashes in front, starting after 'c', represent the permissions for the device by user:
106+
- The first triplet `rw-` mean that the owner (`root`) can read and write to this device
107+
- The second triplet `rw-` mean that members of the owner group (`dialout`) can read and write to this device
108+
- The third triplet `---` means that other users have no permissions at all (meaning that nobody else can read and write to the device)
109+
110+
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.
111+
112+
### Adding yourself to the `dialout` group
113+
114+
But wait! Earlier, when we were launching the IDE, we _did_ add ourselves to the `dialout` group!
115+
116+
![Dialogue prompting to add user to the dialout group][perm-checker.png]
117+
118+
So why does the IDE still not have permission to access the Arduino?
119+
120+
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.
121+
122+
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.
123+
124+
![Serial port option available][option-available.png]
125+
126+
## That's all folks!
127+
Duration: 1:00
128+
129+
Congratulations, you made it!
130+
131+
You've just installed the Arduino IDE on your computer; you've also learned how permissions and groups work in Linux!
132+
133+
### Next Steps
134+
135+
* Try your hand at making smart things with projects at the [Arduino Project Hub][arduino-project-hub]
136+
* Learn more about how the Arduino language works with Arduino's [tutorial][arduino-sketch-tutorial]
137+
138+
### Further readings
139+
140+
* More resources from Arduino at [their Getting Started page][arduino-getting-started]
141+
142+
[perm-checker.png]: ./images/perm-checker.png
143+
[first-launch-editor.png]: ./images/first-launch-editor.png
144+
[first-launch-serial-port-menu.png]: ./images/greyed-out-option.png
145+
[option-available.png]: ./images/option-available.png
146+
147+
[arduino-getting-started]: https://www.arduino.cc/en/Guide/HomePage
148+
[arduino-project-hub]: https://create.arduino.cc/projecthub
149+
[arduino-sketch-tutorial]: https://www.arduino.cc/en/Tutorial/Sketch

0 commit comments

Comments
 (0)