Arduino
FAQ
Break out of the cyber confines of your computer, and program the real world.
Q Ard-You-I-Know. What does that mean?
A It's pronounced Ard-wee-no, and it's an open source microcontroller board that's often used to control embedded systems and robotics (Figure 1).
Q Ah, so it's like a Raspberry Pi?
A Well, yes and no. There are certainly some similarities (it's a similar size, and both have programmable input and output pins that you can use to control external hardware), but there is one very big difference, and that's the processor at the heart of it.
The processor in a Raspberry Pi is a fully featured CPU capable of running a normal desktop operating system like Linux. It's not the most powerful CPU around, but it can do just about anything a more powerful chip can do, just a bit slower. The processor in the Arduino is much more limited. It doesn't have any graphics, or even a memory management unit (MMU), so it's not really capable of the sort of multithreading cleverness that's needed to run a modern operating system like Linux.
Q So if it can't run Linux, what does it run?
A In a sense, it doesn't run any operating system. It comes with a bootloader already programmed into the chip, and this just runs the code that's stored in the chip's internal memory. The clever bit is that you can upload more code to it via USB. In many ways, it functions more as a peripheral than a computer, but purists would argue that it fulfills all the requirements of a computer in itself. (I would argue that so do many peripherals, and it's common for hard drives, WiFi adaptors, and more to come with far more capable computers than the Arduino has, but that's an argument for another day.)
The important bit to remember is that it's a programmable thing to which you can upload code from a computer but that doesn't itself come with any more capabilities than to connect over USB and listen for more code.
Q If all I can do is connect it to my computer and run code on it, why should I bother? I can already run code; I don't need another place to run software.
A The great thing about the Arduino is that while you need it to be connected to the computer to upload code, you don't need to be connected to run it. The code is stored in flash memory that's on the Arduino, so once the code is uploaded, it will run whenever you provide power to it. Essentially, it's for creating embedded computing environments. This is particularly useful when you use the input and output pins to interact with the real world.
Q Input and output pins? What are they?
A They're connectors that you can turn on or off. They can connect to LEDs, buttons, motor drivers, or just about anything else to allow your programs to either understand or influence the world around it.
Q I know nothing about electronics, so how would I go about using these pins?
A Things called shields plug directly into the Arduino pins to provide some out-of-the-box functionality. Although, having said that, the sort of simple electronics needed to wire up things like LEDs or buttons is not complicated, and you could grasp it quite quickly with just a few pieces of inexpensive equipment.
Q This Arduino thing sounds a lot like a Raspberry Pi, just without the ability to run Linux. Why exactly should I learn a whole new platform?
A The Raspberry Pi and the Arduino do have a lot of features in common. If you're coming to the world of physical computing for the first time, you're probably going to end up using one of these two products. The main difference in our opinion is the operating system. The Raspberry Pi has a complete Linux system that gives you wonderful capabilities for doing everything from running powerful fully featured web and database servers to programming in a wide range of languages and editors. The downside is that this adds a lot of complexity to the system, with more to go wrong, and more to worry about. In an embedded situation, this can mean things like worrying about startup times and data robustness if users power off rather than shutting down. The Arduino, on the other hand, has much less to go wrong. All the code on it is code you've added, so it should start up instantly; the filesystem shouldn't be touched, so you shouldn't have problems with hard shutdowns; there should be far fewer security issues to worry about; and so on.
Both platforms have pros and cons, but my general advice is to stick to the Arduino unless you definitely need the extra power of the Raspberry Pi.
Q How do I program the Arduino?
A A special IDE contains a text editor, project manager, compiler, and uploader (Figure 2). As far as the Arduino is concerned, this does everything. It's open source, and you can get it from the Arduino website [1].
Once you've got that, you can browse examples and get to work. The code is written in a dialect of C++ similar to Processing. It's all fairly straightforward for anyone with any coding experience, and you'll find loads of examples, both included with the Arduino software and online.
Q So how did the Arduino come about?
A A very brief history is that it came out of the Interaction Design Institute Ivrea, a school in Italy. There, a group of supervisors and students created the boards to make it easier for students to work with interactive design. There's been a bit of turmoil since then, and the history of the various organizations looks like it might have been written for a soap opera, but the end result is that official Arduino hardware is now produced by Arduino LLC.
Q You say "official" Arduino hardware. Does that mean that there's unofficial stuff as well?
A Yep, and in a variety of forms. Since the hardware and software is all open source, other people have been able to build off the platform. This varies from direct clones (often of poor quality) that are for sale on various websites, to boards that have added functionality to the original boards while still remaining compatible with software (and sometimes hardware, too).
Q Are there different official versions of the Arduino board?
A Quite a few, yep. There are two big things to consider when picking a board: 5 volts or 3.3, and the layout of the pins. Both of these things affect what hardware you can attach. Generally speaking, 5 volts is older and 3.3 volts is newer, so unless you happen to have a stack of old 5V hardware, you're probably better off going for a 3.3V board now. The second thing is the physical layout of the pins: The Uno-style layout (which used to be the standard) shows up on the Arduino Uno and Zero; other styles on other models are better suited to breadboarding. For now, more shields are in the Uno style, but if you're looking to develop your own hardware, one of the other form factors might be more useful.
Fantastic. I'm off shopping for my first Arduino.
Infos
- Arduino: https://www.arduino.cc
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.