Welcome to the wonderful world of Arduino! This small but powerful processor board has become a staple with the robotic hobbyist community, and many have provided open source software to enhance its capabilities. Unfortunately, many, especially those new to embedded systems and programming, can end up so discouraged that the processor board can end up on the shelf gathering dust. The purpose of this first chapter is to help you decide which of the many different Arduinos is right for your application. Then, you'll walk through the steps to get your Arduino powered up and working so that you can begin working on all those amazing robotic projects you've always wanted to create.
First, let's understand a little history and a few definitions. Arduino began in 2005 with a few brave folks at a school in Italy deciding that providing a simple, inexpensive, easy-to-work-with hardware (HW) and software (SW) platform would be a wonderful endeavor so that their students could work on their own embedded systems projects. They started with the Atmel series of processors and then added four key elements.
First, they provided an easy-to-use hardware connection to the processor so that users didn't need to purchase expensive and difficult-to-use additional HW for this task. Initially, this connection was done via a serial port; now, it is almost universally done through USB.
Second, they provided a boot program (the program that runs when the processor powers on) that would configure the hardware and get the entire system to a known state so that users would have a standard set of hardware with which they can work. This also enables the contribution of the third key, which is the Arduino integrated development environment (IDE). It is a piece of SW that runs on a host computer and allows developers to develop their projects and then upload them easily to the target Arduino development board. The program can then be run, debugged, and modified through the IDE. Then, when the program is completed, you disconnect Arduino from the host system and it will run without any connection to the development system.
The last contribution is a set of Input/Output (I/O) pins in a standard configuration. This makes documentation easy, but more importantly, it has allowed for an entire set of additional capability to be provided by what are called shields. These shields fit on top of Arduino, plug directly into the pins, and are supported by a code library that allows the user to easily access the increased functionality.
Initially, there was only a single board, which made selection easy. However, as the community of Arduino users has grown, so have the many different needs for different sizes, capabilities, and form factors. There are now many different Arduino versions and even Arduino clones. There are also chips that allow you to create your very own Arduino-like systems. There are many well-known and popular versions of Arduino for you to consider for your project. However, they are too many to be listed and discussed here.
There are some that are very powerful but also have a much larger form factor and are more expensive. There are some that are extremely small and inexpensive, but they are somewhat limited in the size of programs and interfaces. Here are some of the most popular versions of Arduino.
This is a standard choice for many Arduino projects. It has 32 KB of space for programs, which is a relatively adequate amount for most small-to medium-size programs. It has an ATmega328 processor running at 16 MHz and the standard Arduino set of I/O pins, 14 digital I/O pins, six analog inputs, and one serial communication port. It takes a USB A Male to B Male cable, as shown in the following image:
The Arduino Mega is Arduino of choice for larger projects that require more programming space, a more powerful processor, more I/O, or all of these. It uses an ATmega2560 processor, which runs programs faster than the ATmega328 processor. The biggest difference, perhaps, is the larger program size. It has a total of 256 KB of memory, which can store much larger programs than the standard Arduino Uno. It also has more analog and digital I/O pins.
The add-on shields are boards that can fit on top of Arduino to add more functionalities. However, it is important to note that they are made to fit the Arduino Uno may not fit the Arduino Mega. For each shield you are considering, make sure it will work with your particular Arduino.
There is one more thing to note here. Where it says Mega, you'll notice that there is no Arduino trademark on the board. The Arduino team restricts the usage of its trademark for manufacturers that pay a license fee and work with the team to ensure quality. In this case, this board is almost assuredly not an official Arduino Mega. Go to http://arduino.cc/en/Products/Counterfeit#.UxkWsfldVHI to find out more about how to spot a counterfeit.
As the hardware for Arduino is also open source, some manufacturers take this design and provide new and different designs form factors. These are considered Arduino clones. You will need to rely on the quality of the manufacturers of these clones, so consider that before purchasing.
The Arduino Due is truly at the top of the line as far as processing power is concerned. This unit uses the AT91SAM3X8E7 processor, which is an ARM Cortex processor. It is the same type of processor that many cell phones use. It also offers 512 KB of memory and lots of analog and digital I/O pins. Shields that are made to fit the Arduino Mega or Uno often will fit the Arduino Due, but it is always good to check before purchase. For most starter projects, you'll not need the power of the Arduino Due.
If you need to go smaller, the Arduino line also offers opportunities with much smaller packages in a number of different form factors. One of the more popular units is the Arduino Micro. The Micro is a very small form factor; yet, it has a processor with the appropriate boot parameters so that you can run the Arduino IDE, the USB connector, and the exposed I/O pins, even though they are much fewer than those found in the Arduino Uno.
The following is an image of this unit:
This unit comes with an ATmega328 processor, the same processor that comes with the Arduino Uno, but runs at half the clock rate. It comes with the same 32 KB of memory as the Uno but with much fewer I/O pins. For this unit, and the others that I will present here, you'll need to use a mini-USB B cable, as shown in the following image:
As noted earlier, as Arduino designs and parts are openly available, some companies have taken the standard Arduino and given it a different look. If you are looking for a much different form factor, you can try the Adafruit FLORA, offered by Adafruit at www.adafruit.com. The following is an image of this unit:
The Adafruit FLORA is part of a wearable line of Arduino clone processors. It is 1.75 inches in diameter, but still has the USB connection, connectivity to the Arduino IDE, and exposed pins, but much fewer than any of the other Arduinos we have discussed. It uses the Atmega32u4 processor and also uses a mini-USB B cable.
Amazingly, the Adafruit Gemma still has the USB connector, uses the same Arduino IDE, and has some I/O pins still available. As it has an ATtiny85 processor running at 8 MHz, only 8 KB of memory, and far fewer I/O pins, it can only be used in limited applications. However, it is an interesting form factor.
There are also other possible Arduino configurations. As you can purchase a chip that has the Arduino processor and Boot ROM configuration, you can build a custom Arduino configuration. The http://www.instructables.com/id/Paperduino-20-with-Circuit-Scribe/ website even shows you how to print your own Arduino circuit on paper.
There is nothing as exciting as ordering and finally receiving a new piece of hardware; yet, things can go poorly even in the first few minutes. This chapter will hopefully help you avoid the pitfalls that normally accompany unpacking and configuring your Arduino. We'll step through the process, answer many of the different questions you might have, and help you understand what is going on. If you don't get through this chapter, you'll not be successful at any of the others, and your HW will go unused, which would be a real tragedy. So, let's get started.
One of the most challenging aspects of writing this guide is to decide to what level I should describe each step. Some of you are beginners, others may have some limited experience, and others will know significantly more in some of these areas. I'll try to be brief but still detail the steps to take in order to be successful.
A USB cable to go between your Arduino and the host computer
A host computer running a Windows, Mac, or Linux operating system
Before plugging anything in, inspect the board for any issues that might have occurred during shipping. This is normally not a problem, but it is always good to do a quick visual inspection. You should also acquaint yourself with the different connections on the board. In the following image, the connections on the board are labelled for your information:
The Arduino Mega is very similar; it just has more I/O pins. However, the FLORA is a bit different. The following image shows the connections:
Before you connect the board, download the appropriate SW for your computer (Windows, Mac, or Linux from http://arduino.cc/en/main/software#.UxoUA_ldUvs). Install the SW by following the instructions for your board and operating system. This will also install the drivers for the board. Then, connect the board to the computer. To do this, you'll need to go through the USB-client connection. This is achieved by performing the following steps:
Connect the USB connector end of the cable to the board.
Connect the other end of the USB connector to the USB port of the PC.
When you plug the board in, the PWR LED should constantly be green. The following image shows the location of the LED so that you're certain which one to look for:
If you are using the FLORA Arduino, you should get your Arduino IDE from http://learn.adafruit.com/getting-started-with-flora/download-software. Unzip the file and place it in a directory where you can get to it later. Then, use the USB cable to connect the device to the computer. When the device is connected, it should look like the following image when powered on:
Don't worry yet about the blinking red LED; I'll explain this in Chapter 2, Getting Started with the Arduino IDE.
Congratulations! You've completed the first stage of your journey. If you haven't purchased your Arduino yet, feel free to go out and start your Arduino experience. If you have, you should have your Arduino up and working. No gathering dust in the bin for this piece of hardware. It is now ready to start connecting to all sorts of interesting devices in all sorts of interesting ways.
Your system has lots of capabilities. Your next step will be learning how to bring up the Arduino IDE so that you can start doing all sorts of amazing things with your Arduino.