orgAnizAtion of this book I recommend you try out some of the earlier projects first as you’ll find information there that’s useful for the more complicated builds but if you see a project you like and feel confident enough to take it on you can skip to it The parts of the book are organized as follows Primer Getting Started Learn all about the Arduino Uno and how to use a breadboard and then test your board with a simple program and get a crash course in soldering Part i leds Here you’ll start out by learning how to control simple light-emitting diodes LEDs with variable resistors and then combine components to build a light-activated LED a scrolling text display a flashing multicolored compass and more Part ii Sound In this part you’ll use a piezo a device that emits sound to make tunes with a musical keyboard and create a simple audio visualizer that makes LEDs dance to your music Part iii motors These projects use various types of motors to bring your creations to life You’ll build an analog dial that gauges light levels learn how a stepper motor works and build a temperature controlled fan to keep you cool Part iV lcds The LCD screen is useful in lots of projects for display ing messages and results In these projects you’ll learn how to set up a serial LCD screen and then build a defusable bomb game an ultrasonic range finder a mobile Pong game and even an alcohol breathalyzer Part V Security Protect your space with a motion sensor that trig gers an ultrasonic soaker water pistol and a security system that uses a fingerprint scanner to keep unauthorized persons out In this final part you’ll combine the Arduino Part Vi Smart machines with motors and sensors to create an intelligent robot control lights using Bluetooth technology and even build a GPS speedometer to track your movements At the end of the book I provide some helpful reference informa tion including a review of some of the more common program errors and how to fix them information on the components used in this book and where to buy them and a reference table for the pins on the Arduino Uno xii introduction
Primer GETTiNG STARTED be fore you StArt building witH tHe Arduino tHere Are A few tHingS you need to know And do firSt let’S tAke A look At tHe HArdwAre And SoftwAre you’ll need for tHiS book tHen you’ll teSt out tHe Arduino witH A SimPle led Project And get StArted witH A few tecHniqueS tHAt will come in HAndy like Soldering And downloAding uSeful code librArieS
FigurE 0-1 The Arduino Uno board hArdwAre First let’s look at the Arduino Uno board and a few pieces of hard ware that you’ll use in almost every project the Arduino uno There are numerous types of Arduino boards available but this book uses only the most popular one the Arduino Uno shown in Figure 0-1 The Arduino Uno is open source meaning its designs may be freely copied so as well as the official board which costs about 25 you will find numerous compatible clone boards for around 15 RESET BUTTON USB CHIP 14 DIGITAL IN OUT PINS 0 13 USB SOCKET SURFACE MOUNT PIN 13 LED TX RX LEDS ICSP HEADER ATMEGA328P CONTROLLER POWER SOCKET 2 1 MM BARREL TIP 9 VOLTS POWER PINS 6 ANALOG IN PINS 0 5 The Arduino controls components you attach to it like motors or LEDs by sending information to them as output information sent out from the Arduino Data that the Arduino reads from a sensor is input information going in to the Arduino There are 14 digital input output pins pins 0 13 on the Arduino Each can be set to either input or output see Arduino Pin Reference on page 253 for a full pin refer ence table Power When you connect the Arduino Uno board to your PC to upload a program it is powered from your computer’s USB port When the Arduino is not linked to your PC you can have it run independently by connecting it to a 9-volt AC adapter or 9-volt battery pack with a 2 1 mm jack with the center pin connected to positive power as shown in Figure 0-2 Simply insert the jack into the power socket of the Arduino 3 Primer