Hostingheaderbarlogoj
Join InMotion Hosting for $3.49/mo & get a year on Tuts+ FREE (worth $180). Start today.
Advertisement

Arduino: An Introduction

by
Gift

Want a free year on Tuts+ (worth $180)? Start an InMotion Hosting plan for $3.49/mo.

DIY electronics is a hot topic right now! With so many different technologies available, such as Wi-fi, touch screens, accelerometers and gyroscopes, it is easy to wonder what different ways they could be put together to make something fun.

I like to think of ways to improve objects around me and make them more interesting. Using electronics is one way of turning static objects into useful gadgets, and in this article I want tell you all about a tool that will help you do exactly that. Let’s meet Arduino!


Arduino

Official Arduino Leonardo Board

An official Arduino Leonardo board

My personal experience with Arduino began when I was building a hobby grade drone. As I tried to understand how they worked, I realized that many of these drones were controlled with nothing more than a few sensors and a microcontroller board such as Arduino. I researched further on Arduino and became impressed by what I learned.

Official Arduino with logo

Official Arduino boards sometimes have part of the Arduino logo painted on their back surfaces

Arduino is a fully Open Source and free platform for physical computing. It can be programmed to behave in a certain way, perform tasks, interact with sensors and lights, operate motors, interface with high voltage using relay switches and a whole lot more! Arduino has a standard way of exposing its connectors, thus allowing it to work with a variety of interchangeable modules, called Shields. More about shields later.

You can program an Arduino board using a computer with a USB port and the freely available Arduino IDE. Almost the entire stack of technologies used to make Arduino is also Open Source.

The Arduino project began some 7 years ago by Massimo Banzi and David Cuartielles during their time at the Interaction Design Institute in Ivrea, Italy. They needed something to help with teaching their design students ways of using electronics in their projects. This was basically a two-fold problem: they had to come up with a tool easy enough to be used without prior background in electronics and it had to be affordable enough for students.

Experimenting with different designs ultimately led to the development of the Arduino prototyping board, which is now available for about $25 dollars.


Micro Controller Boards

Different Arduino boards

From left: Uno R3, Leonardo, Due and Micro

Since the release of the first Arduino board there have been multiple revisions. The many improvements have made the original board more usable for different applications. Currently there are more than ten different official Arduino boards, four of which are shown in the picture above.

Arduino boards

From top: MultiWii Nano, EtherTen and Arduino Mega 2650

Aside from the official Arduino boards, there are numerous copies or compatible boards produced by different manufacturers. Some of these third party boards may sometimes be identical to an official Arduino board, but others may have additional features such as an onboard Ethernet port, Accelerometer or Gyroscope just like the ones in the above photo.


Code

Arduino programs can be written in C or C++. The most basic program can be expressed with just a few lines of code:

 void setup() {}
 void loop() {}

These two functions, setup() and loop(), are required in every Arduino program. Of course, it is possible to define your own functions. The Arduino website contains a number of articles which nicely describe the control structure of a valid Arduino program.

Code

Code

Much of the inspiration for Arduino and its development environment comes from Processing, which is a tool for creating images and interactive animations. Processing has an effective way of teaching non-programmers the skills of programming through immediate and visual feedback. The same principles are at the heart of the Arduino project itself, which closely follows the Processing environment.

In fact, Arduino has inherited its handy Development Environment from Processing, and for those reasons, many refer to Arduino as its hardware equivalent. Although the two are separate projects, it is useful to know they can be used together.


Shields

Arduino Shields stacked on top of one another

Arduino Shields stacked on top of one another

Arguably, the killer feature of Arduino is its interchangeable Shields. Shields are other boards that can be directly plugged on top of some of the Arduino boards and thus extend their base capabilities. This design is similar to the expansion slots in PCs, but unlike PCs, which can run out of slots, Arduino lets you connect as many Shields as you could arrange to work together.

The picture, above, shows various Arduino Shields stacked on top of one another. Different Shields may enable Arduino to connect to various other interfaces and/or could include a GPS, WIFI, Bluetooth or other useful modules.


I/O Interfaces

Arduino connects to different sensors through its I/O (Input/Output) interfaces. Sensors usually output their values via analog or digital signals. Different sensors present different interfacing options. For instance, some sensors need to be used with resistors, while others need lower or higher power to operate.

Freetronic EtherTen

Freetronic EtherTen has an onboard ethernet and Micro SD card reader

Depending on the specific board, Arduino may provide support for popular IO interfaces such as SPI, I2C, PWM or CAN. Other interfaces may be supported through using an appropriate Shield. More often, third party boards include extra onboard interfaces like the EtherTen board in the above photo, which includes an onboard Ethernet port and a Micro SD card reader.

It is the same as having an Arduino board, an Ethernet Shield and a Micro SD Card Reader Shield.


Closing Thoughts

There is still much more that can be said about the Arduino project. Not surprisingly, many schools are already using Arduino to help with the teaching of electronics and programming. We can expect the next wave of school kids to be as comfortable with programming as they are with Mathematics and English.

To sum up, here are my six simple reasons for why you too should consider learning Arduino:

  1. It is cheap.
  2. If you already know some programming, then Arduino development is only one step away.
  3. Arduino has a thriving community of users which is very helpful when you are starting out.
  4. There are plenty software libraries and even more selection of Shields readily available to integrate with your project.
  5. You can use the Arduino IDE on your platform of choice.
  6. It is Open Source and can be easily used in commercial projects.

I’ve barely touched the surface of what Arduino can do. Check back soon for more information and step-by-step tutorials for building your own awesome Arduino projects. We’ll also be diving into other related products like Raspberry Pi, so even if Arduino isn’t your thing, we’ve got you covered.

Advertisement