Arduino

FAQ

Article from Issue 204/2017
Author(s):

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).

Figure 1: The 101 board is a great introduction to the world of physical computing.

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].

Figure 2: There's a web-based version of the Arduino IDE, so you don't even need to install software to get started.

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

  1. Arduino: https://www.arduino.cc

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Arduino programming for open hardware projects

    Whether you are building your own device or customizing one, Arduino technology often functions as the foundation for your open hardware project. Here's how to get started with Arduino products.

  • Arduino's cofounder describes the quest for simplicity

    Arduino's cofounder describes the quest for simplicity.

  • Decisions, Decisions

    When it comes to open hardware projects, the choice of an Arduino or a Raspberry Pi board can determine success or failure. Read on for guidance in selecting the best board for your specific needs.

  • Perl: Arduino Project

    With a few lines of self-written firmware and a simple Perl script, Perlmeister Mike Schilli trains one of his Linux computers with a plugged in Arduino board to switch electrical equipment on and off using a relay. Enchanting.

  • New Tech Retrofit

    An electronic project at a local science center was showing its age, calling for a refresh: in this case, rebuilding it almost from scratch with an Arduino instead of relays.

comments powered by Disqus
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.

Learn More

News