Quantcast

How To Get Started with Arduino

By Alex Castle

Arduino has done a ton to bring electronics tinkering into the mainstream in the last few years, but it’s still far from a household name. If you’re not familiar with Arduino, or you’ve heard of it but don’t quite understand what it is and how it works, we'll show you everything you need to know to get started building your own electronic projects, right now.

Getting started making things isn't difficult, but the sheer amount of tools and materials for you to work with can be daunting. In this series of posts, I will focus on individual, awesome components, and show how you can get started using them in your own DIY projects. LED strip lighting last time was a nice warm up, but when it comes to awesome components, I truly cannot think of one that beats Arduino.

Arduino has done a ton to bring electronics tinkering into the mainstream in the last few years, but it’s still far from a household name. If you’re not familiar with Arduino, or you’ve heard of it but don’t quite understand what it is and how it works, read on—this article will tell you everything you need to know to get started building your own electronic projects, right now.

Photo credit: Flickr user beraldoleal via Creative Commons

Let's start with the basics.

What is Arduino?

In a nutshell, Arduino is a cheap, open-source single-board microprocessor. Of course, if you’re just getting started with electronics, that still might be Greek to you. Don’t worry, though—I’m going to work my way through that sentence, backwards.

First, Arduino is a microcontroller. A microcontroller is the computer that allows your project to “think,” or at least to process inputs and outputs. Inputs are things like sensors (light sensors, thermometers, gyros, etc.), and human-interface elements (buttons, switches, knobs). Outputs are any electrical elements that you want to be able to control, such as lights, displays, motors and servos. A microprocessor has all the basic parts of a computer (processor, memory, input/output pins) on a single chip, and runs software that you load onto it from your computer, allowing it to manipulate the outputs based on data it receives from the inputs.

Next, Arduino is a single board. This means that everything you need for basic Arduino usage comes soldered to one little circuit board. The board houses the microcontroller, and provides convenient access to the microcontroller’s input and output pins. A single-board microcontroller is different than a single-board computer, like the Raspberry Pi, in that it doesn’t have the flexible, general purpose interfaces that allow a human to interact with it, such as video output, and the microcontroller’s hardware isn’t powerful enough to run a full-blown operating system.

Moving on, Arduino is open source. As open source hardware, the schematics for Arduino are available to anyone for free, so if you wanted you could buy the electronic components and a circuit board, and build your own Arduino. Many people build and sell third-party Arduino hardware.

Finally, Arduino is cheap. You can get the standard Arduino Uno board for just about $30. That ain’t half bad.

But what, exactly do you use an Arduino for? That’s a tough question to answer—only because there’s such a huge array of projects that need a microcontroller. A simple project could be something like the LED strip light I made in my last article. A basic circuit could turn on the LED lights, but in order to get them to change colors and execute patterns you need a microcontroller. On the more complex side? The sky’s the limit. You could build a robotic drawing arm, a holographic LED display, or just the ultimate cat litter box.

Not to oversell it, but virtually any electronics project beyond a low complexity threshold will require a microcontroller. Arduino is certainly not the only option for adding a microcontroller to your build, but it’s currently the cheapest and easiest way to do so.

Getting Started with Arduino

The supplies you need to make a something with Arduino are, of course, dependent on the nature of your project. Still, there are a few things you’ll need for sure. First, you need an Arduino board (unless you want to make one yourself from components—but as I previously said, that’s probably best left to the more experienced). The real question is: which one?

The most common Arduino board is the Uno, which features an ATmega328 microcontroller, mounted on a board with 14 digital I/O pins and 6 analogue input pins, along with a power connector and a USB port that allows you to program it with your PC. It’s a strong choice because it’s cheap ($30), straightforward, and (as the most “standard” Arduino board), more shields and other Arduino add-ons are designed to work with it. Additionally, the ATmega328 microcontroller is removable, so if you do happen to brick it somehow, you can get the board back up and running by buying a $6 replacement chip.

The downside of the Uno is that the ATmega328 is pretty puny. It’s an 8-bit processor, with only 32K of flash memory and 2K of system memory. That limits both what it can do at any given time (even very low-resolution images or lengthy text strings will quickly use up the 2kb of SRAM), as well as the size of program that can be loaded onto it. Additionally, for some very complicated projects, those 20 I/O pins might not be enough. If your project is complex enough that these downsides will affect you, your best choice is the Arduino Due.

The Due is a new Arduino board built around the SAM3X8E ARM Cortex-M3 microprocessor. That’s kind of a mouthful, but what you really need to know is that it’s a 32-bit ARM processor with 50k of SRAM and 256k of flash memory. The board’s got about three times as many I/O pins as the Uno, so you should be well covered, no matter how many servos, sensors and LEDs you want to attach.

The Uno and the Due are widely-available standard Arduino boards that should serve as a good base for the vast majority of projects you might want to undertake, but they’re far from the only boards available. There are dozens of Arduino-based boards currently for sale, including the tiny Arduino Micro, and the Lilypad, which is designed to be sewn into clothing.

But for those just getting started with Arduino, I highly recommend the Uno or the Due. In fact, unless you’ve already got a well-stocked electronics cabinet, you should consider one of the starter kits for Adafruit, Sparkfun or Maker Shed. These kits all include wires, a tiny breadboard, and a handful of LEDs, switches, sensors and other components you’ll need to get started tinkering.

If you don’t get a starter kit, you’ll need some additional hardware to make it actually do anything. You need a USB cable to program it, and if you want to be able to run your project when it’s not near the computer, you’ll need an AC-to-DC power adapter or battery pack and cable. Any site that sells Arduino boards will also be able to sell you these as well.

What About Shields?

If you’re browsing sites that sell Arduino boards, you’ll find a great deal of shields for sale. Though you probably won’t need one for your first project, it’ll be useful to understand what a shield is.

A shield is a companion circuit board for your Arduino. Generally, a shield sits on top of the base Arduino board, and connects to its I/O pins, allowing you to specialize your Arduino—either adding additional capabilities to it, or providing a more convenient interface for your project. For example, a shield might allow you to integrate a GPS chip, or a SD card in your project. Some shields can be stacked on top of each other, if you really need a lot of extra functionality.

Programming Arduino

Of course, all the fancy Arduino hardware in the world is just going to sit there on your desk if you don’t tell it what to do. Here’s how programming your Arduino works:

First, you download the Arduino development environment and install it on your PC. The environment is available for Windows, Mac and Linux computers, and includes everything you need to start writing programs.

Next, you connect the Arduino to your computer, and (if you’re using a Windows machine) install the driver. It’s in the development environment package you just downloaded.

When you first get started with the Arduino editor, there are two settings you need to configure—both in the Tools menu at the top of the editor. The first is the Board option, and you simply select the model of Arduino that you purchased. The second is the Serial Port option, where you choose the port that the Arduino is plugged into. There may only be a single option, in which case that’s the one to choose. If there’s more than one option, simply disconnect your Arduino and see which option disappears—that’s your port.

Finally, you’re ready to write programs (which the Arduino editor refers to as “sketches”) for your project. You’ll need a passing familiarity with C++, but Arduino sketches tend to be on the simpler side, as far as programming goes. You can get as complicated as you want, but as long as you understand variables, functions, if statements and loops, you’re equipped to handle a lot of projects.

The best way to learn Arduino programming is through the extensive example sketches included in the Arduino IDE. These are located in the File -> Examples menu, and there’s an incredibly helpful tutorial on the Arduino website that walks through each example in detail.

Once you’ve written a sketch, you simply click on the Upload button, and it will be sent to your Arduino board. The microcontroller will restart, and will execute your sketch until you upload a different one.

So Get Started!

This article has barely scratched the surface of the Arduino world—it’s a huge subject, and I’ve only got so many words before your eyes start to roll back in your heads. In a future post I’ll go through a simple Arduino build, step-by step. Until then, I strongly suggest that anyone with an interest in electronics or tinkering buy an Arduino starter set and wade right in. If you already have an Arduino board, tell me what you’ve made with it in the comments.