Arduino Tutorial – Chapter 1.2: Introduction to the Arduino

Introduction to the Arduino Board

The Arduino boards are essentially physical platforms to support the “brains” – the microcontroller. They make it easy for you to work with the microcontroller by providing ways for you to programme, power and connect things to the microcontroller, in addition to housing various support circuitry and electrical components needed to make the microcontroller work correctly.

The Arduino Board in more detail

The Microcontroller:

This is the brains of the board, and is the large microchip you see on most of the boards. This stores your programme logic, and controls the way the board behaves. On the Arduino UNO, this is an Atmel ATMega328P-PU controller.

USB Connector:

Most of the boards will come with a USB connector. This is the first connection that you’ll use, and allows you to connect the board to your PC in order to programme it. In Arduino-speak, the programmes that are uploaded onto the boards are called “sketches”. As USB ports carry power, this connector is one of two ways to power your board.

Input/Output Pins:

These are the two rows of connectors on either side of the board, and provide an easy way for you to connect inputs (sensors, buttons, etc.) and outputs (LED’s, buzzers, motors, etc.) to the board. They are laid out in a way that makes them easy to access, and also allows you to stack other specially designed boards (called shields) on top of the base Arduino – but more on that later.

Power Pins:

These provide power to your projects: 5V or 3.3V (positive) and Ground (negative).

Power Jack:

The centre-pin power connector allows you to power your board using a battery or a plug-in DC power source (often called a wall-wart). You will want to use these power sources once your project is stand-alone and doesn’t need to be connected to your PC (particularly useful if the project has wheels!).

On-board LED:

This is a useful LED built into the board that you can control from your sketches.

Support Electronics:

There are a host of other components – power and serial LEDs, ICSP programmer connectors, power-regulation and protection components, crystals, Serial-USB converters, etc. We’ll touch on some of these later in the tutorial when we build our own Arduino on a breadboard (yes, we’re going to build our own). For now, they aren’t really useful to you.

Input and Output Pins

Arduino Board - IO Pins
Arduino Board – Input and Output Pins

The input and output pins on the Arduino are the very crux of the platform. The Arduino wouldn’t be very useful if it ran clever sketches, but wasn’t able to do anything with the results. Similarly, the strength of the Arduino is that it can react to things happening around it – whether it’s a button that you press or a change in temperature. These pins are the connectors that enable the Arduino to interact with its environment.

How do the pins work

Firstly, they’re connectors – they connect external components to the main microcontroller on the board. So you’ll attach one end of a wire to a pin, the other end to a component of some sort. Then in the sketch tell the Arduino what you want to do with that pin – either read information from a sensor (input) or control the behaviour of the component (output).

Secondly, they work using 5 Volt DC signals. So the pin could be delivering a 5V current, be receiving up to a 5V current, or have no current flowing (0V). If you connect a power source that produces more than 5V, the chances are high that you’ll start smelling burning – the microcontroller cannot handle higher voltages. The UNO has built-in voltage regulators, so as long as you only use the UNO as a power source for the microcontroller you’ll be fine.

Digital Pins

Pins 0-13
These can be set to work as either Input or Output pins – you tell the UNO this in sketches that you write. When I say that they are digital, I mean that they can only have 2 states – they are on or off / high or low / zero or one. For our purposes, we refer to HIGH and LOW – HIGH means a 5V current is flowing through the pin; LOW means no current (i.e. 0V) is flowing through the pin. If the pin is set as an Input, then 5V would be flowing from the circuit into the pin. If the pin is set as an Output, then 5V would be flowing from the pin into the circuit. It’s pretty straightforward, but there’s nothing like an example to demonstrate this – you’ll build one very soon, when you turn to the next chapter.

Analog Pins

Pins A0-A5

These are Input pins only, and are able to detect varying voltages between 0V and 5V. Digital pins, remember, can only detect 5V and 0V; these analog pins can detect 5 milliVolt increments in voltage from 0V up to 5V. We’ll get into examples in a few chapters time, but a typical use of this would be to measure temperature. A simple temperature sensor will output a higher voltage when it’s warm and a lower voltage when it’s cold, in a predictable way – by measuring the voltage you can calculate the temperature.

Power and Ground Pins

3.3V and 5V

These pins output a constant, regulated 3.3V and 5V respectively. Typically you’d use these to power your projects. They aren’t designed to deliver a large current, so are generally only suitable for powering electrical components and not mechanical ones. If you think of a battery, this is the “+” side of the battery.

GND

These pins provide connections for Ground, or GND. You may not always use the 5V or 3.3V pins, but you will always use the GND pins to complete your circuits. You can choose to use any of the three GND pins, as they’re all connected together. If you think of a battery, this is the “-” side of the battery.

Other Pins and Connectors

For now we’re not going to look at the other pins on the board, as we won’t need them for this book. I’m referring specifically to the pins labelled AREF, IOREF, RESET and ICSP. If you’re super-interested in getting into the detail of these, then there’s plenty of detail available on the Arduino website and forums.

Chapter Summary

In this chapter we looked at what the Arduino is and why we chose to work with it. You would have installed the drivers and the Arduino IDE, and connected the Arduino to your PC. We then touched briefly on why we need the Arduino IDE, and looked at the physical Arduino UNO board and the types of Input and Output pins. Now that you’ve covered some of the background and have your beautiful Arduino UNO laid out in front of you, I’m sure that you’re struggling not to turn the page to get stuck into your first working example. Go ahead, turn the page…

Continue to Chapter 2: Our first project…