Arduino is a small microcontroller board with a USB plug to connect to your computer and a number of connection sockets that can be wired up to external electronics, such as motors, relays, light sensors, laser diodes, loudspeakers, microphones, etc. They can either be powered through the USB connection from the computer or from a 9V battery. They can be controlled from the computer or programmed by the computer and then disconnected and allowed to work independently.
Arduino is an open-source design for a microcontroller interface board, it is actually rather more than that, as it encompasses the software development tools that you need to program an Arduino board, as well as the board itself. There is a large community of construction, programming, electronics, and even art enthusiasts willing to share their expertise and experience on the Internet. To begin using Arduino, first go to the Arduino site (www.arduino.cc) and download the software for Mac, PC, or LINUX. You can then either buy an official Arduino by clicking the Buy an Arduino button or spend some time with your favorite search engine or an online auction site to find lower-cost alternatives.
There are, in fact, several different designs of Arduino board. These are intended for different types of applications. They can all be programmed from the same Arduino development software, and in general, programs that work on one board will work on all. In this book we mostly use the Arduino Duemilanove, sometimes called Arduino 2009, which is an update of the popular board, the Diecimila. Duemilanove is Italian for 2009, the year of its release. The older Diecimila name means 10,000 in Italian, and was named that after 10,000 boards had been manufactured. Most compatible boards such as the Freeduino are based on the Diecimila and Duemilanove designs.
Many microcontroller boards use separate programming hardware to get programs into the microcontroller. With Arduino, it’s all contained on the board itself. This also has the advantage that you can use the USB connection to pass data back and forth between an Arduino board and your computer. For instance, you could connect a temperature sensor to the Arduino and have it repeatedly tell your computer the temperature. On the older Diecimila boards, you will find a jumper switch immediately below the USB socket. With the jumper fitted over the top two pins, the board will receive its power from the USB connection. When over the middle and bottom pins, the board will be powered from an external power supply plugged into the socket below. On the newer Duemilanove boards, there is no such jumper and the supply switches automatically from USB to the 9V socket. The power supply can be any voltage between 7 and 12 volts. So a small 9V battery will work just fine for portable applications.
Typically, while you are making your project, you will probably power it from USB for convenience. When you are ready to cut the umbilical cord (disconnect the USB lead), you will want to power the board independently. This may be with an external power adaptor or simply with a 9V battery connected to a plug to fit the power socket. There are two rows of connectors on the edges of the board. The row at the top of the diagram is mostly digital (on/off) pins, although any marked with “PWM” can be used as analog outputs. The bottom row of connectors has useful power connections on the left and analog inputs on the right. These connectors are arranged like this so that so-called “shield” boards can be plugged on to the main board in a piggyback fashion. It is possible to buy ready-made shields for many different purposes, including:
■ Connection to Ethernet networks
■ LCD displays and touch screens
■ ZigBee (wireless data communications)
■ Motor control
■ GPS tracking
■ And many more
You can also use prototyping shields to create your own shield designs. We will use these Protoshields in some of our projects. Shields usually have through connectors on their pins, which mean that you can stack them on top of each other. So a design might have three layers: an Arduino board on the bottom, a GPS shield on it, and then an LCD display shield on top of that.