The Arduino Inventor's Guide (4 page)

Project 6
Balance Beam
Introduces the servo motor and how to control it with an external device to make a balance beam desk game.

Project 7
Tiny Desktop Greenhouse
Teaches you how to make a greenhouse that senses temperature and automatically turns a fan on and opens an air vent when it’s too hot. This project introduces concepts like controlling a motor with a transistor.

Project 8
Drawbot, the Robotic Artist
Explores simple tabletop robotics using an H-bridge motor controller. You’ll build a simple robot that you can program to draw a picture for you.

Project 9
Drag Race Timer
Shows you how to build a racetrack for toy cars that records their speeds. You’ll use the servo motor, light sensor, and LCD to build a race timer. This project is a Christmas morning dream!

Project 10
Tiny Electric Piano
Teaches you how to make music with your Arduino, using a soft potentiometer as a small keyboard. This project explores the piezo buzzer and how to use the
function. Time to get your piano man on!

More Electronics Know-How
Includes handy tips for using a multimeter, soldering, and reading the color bands on resistors.


All the resources you’ll need for these projects are available for you to download, reference, use, and modify. The resources include all the example code shown and discussed in the book, the cutting templates for the final builds, and code to get you started with hacking and modifying your projects to experiment further.

You’ll find all of these resources in a single ZIP file that you can download from
. If you get stuck or something doesn’t seem to work, you can always reference these files as a guide and a fallback.


SparkFun is a hardware and electronics company with a strong focus on being open source—it is one of the core tenets the company was founded on. When we build projects, we love to share our ideas, code, and design files with our community so that you can leverage our knowledge base to use in your next project. As you build up your projects, we encourage you to share what you’re doing, too. Show a friend, or post it online. There are many different places that we’d love to see your work!

Use social media like Twitter, Instagram, or Facebook to tell us about what you’re making. Tag us
. We also have an online project gallery called InventorSpace at
. If you have an idea or a project that you want to show off, post it there. We hope this book provides you with some inspiration to start something amazing!

Finally, you can also email us with your projects, photos, or general comments and questions at
[email protected]
. We’ll occasionally pick some great photos and projects to highlight on our blog. Who knows, we might end up asking to use one of your projects in our next book!

Electronics Primer

This chapter provides a broad overview of electronics to readers who have little to no experience with electronics and electricity. If you’re already comfortable with some of the topics in this chapter, you can treat it like a
choose your own adventure
book and skip to subjects you want to learn more about or even move directly on to
Project 1

If you’re new to electronics or just want a refresher, we suggest reading this chapter in full. While it’s not a complete guide to electronics (there are whole books, classes, and degrees on the subject), this chapter is a handy reference designed to arm you with basic concepts and vocabulary. If you’re looking for more in-depth information on electricity, electronics, and circuits, please see the recommended reading list at the end of this chapter.


Electricity is an odd beast. In a lot of ways it’s predictable, but it can be a little sneaky at times. If you look up
in the dictionary, you’ll probably find the definition sheds little light on what it is, how it works, or, most importantly, how you can use it. Let’s start with the basics.

What Is Electricity?

To understand electricity, you first need to understand the structure of an atom. Atoms are the building blocks of everything around you. An atom is made up of protons, neutrons, and electrons. The electrons have a negative charge, and the protons have a positive charge. A typical atom has the same number of electrons as protons and therefore is neutral in charge. Electricity is a form of energy that involves the movement or storage of charges; it is the phenomenon that occurs when we push or force charges to move in a prescribed manner or a defined path. If you’ve ever seen a lightning storm, you’ve seen evidence of the transfer of charges between the clouds and the ground. These charges are transferred through the air molecules of our atmosphere, lighting up the sky as they move. The movement and transfer of charges is called
. Current is measured in units called amperes (A) or milliamperes (mA).


Conventionally, we refer to current as the movement of a positive charge. Though technically the electron is the part of the atom that can be moved, it is still common to refer to current as the movement from positive to negative.

Except for lightning, arc welding, and the odd static shock, we don’t normally see electricity directly. Even the bright light we see in lightning is merely the air molecules changing form as charges move through them.

Charges move when there is an electrical force that acts on them and a path for the charges to move along. That electrical force is created by an
electrical potential difference
, or what we commonly call
. Voltage is what ultimately causes charges to move, and it’s measured in volts (V). For a reference, typical batteries range in
voltage from about 1.5 V to 12 V. A 12 V battery will cause charges to move faster than a 1.5 V battery.

Types of Electricity

In general, electricity can be broken down into two basic types:
direct current
alternating current (AC)
. AC is the kind of electricity in the power lines outside your house and in your wall outlets. AC electricity is great for power generation (for example, power plants), transmitting power over long distances (like from the power plant to your home), and driving large devices (like motors and heaters). We don’t use AC electricity for most of our household electronics, however. Most small appliances and household electronics that plug into the wall outlet require DC electricity and use a
to convert from AC to DC. Further details on AC and DC are beyond the scope of this book, but the projects you build here will focus on DC electricity.

What Is a Circuit?

Even with the electrical forces pushing them, charges need a path to follow from a point of higher potential to a point of lower potential. The path by which charges move from the positive (+) side of a battery (high potential) to the negative (–) side of the battery (low potential) is called a
. A circuit consists of a closed path from the positive terminal to the negative terminal through a device such as a light-emitting diode (LED), resistor, light, or motor.
Figure 1
shows a simple circuit containing an LED, a battery, and a resistor. Notice that the shape of the circuit loosely resembles a loop or a circle, hence the name

A basic DC circuit

In order for charges to move, the path must be made out of a material that is
. Conductivity is not an absolute measure but more of a continuum. While some materials are generally considered conductors and nonconductors, most materials occupy a range of values for conductivity. In other words, some materials allow charges to move more freely than others. Think of driving a car on different surfaces. On the smoothly paved interstate, you can go much faster than if you were off-roading or driving down dirt roads. Different roads allow for different speeds the same way that different materials allow for more or less conductivity. We use the term
to describe how much a material slows down the movement of charges.

Ohm’s Law

As you may already have guessed, there is a relationship between current, voltage, and resistance. This relationship is commonly called
Ohm’s Law
, and it is represented mathematically as follows:


In this equation,
represents the voltage,
represents the current, and
is the resistance. (Don’t let this bit of math scare you: this is one of only about three equations you’ll see in this book.)

Visualizing Electricity as Water in a Pipe

To understand what’s going on in a circuit, it’s useful to think of electricity like water moving through pipes. Imagine water flowing through a garden hose. When you turn on the valve, water starts to flow through the hose to the other end, as shown in
Figure 2

Water and electricity model

The water molecules moving in the hose represent the flow of charges (current). If we turn the water valve up or down, we can change the water pressure in the hose. The water pressure in the hose is similar to the voltage in a circuit. If you increase the water
pressure, the flow also increases. This is the same with circuits: if you increase the voltage, the current also increases. The final part of the analogy is in the hose itself. If we put a kink in the hose or restrict its diameter, we create resistance. The increase in resistance slows down the flow (lowers the current).

This model works pretty well to describe the flow of electricity, but you don’t want to set up this whole system of hoses, valves, and pipes to just let water run out onto the ground (unless your goal is to water the lawn). You want to do something with it; you want it to do
. In terms of circuits, we use devices that change electricity into other forms of useful energy, such as illuminating a light, rotating a motor, or sounding a buzzer. A device that converts electrical energy to other forms of energy is called a
. Thomas Edison discovered that he could convert electrical energy into light energy with the light bulb; you will do that and a whole lot more throughout this book.


While pictures are nice, it’s not efficient to meticulously draw out every component to show how a circuit is wired up. Throughout the book, you will see
like the one in
Figure 3
as well as illustrations to help you with your circuits.

This simple schematic shows a battery, an LED, and a resistor.

Schematics are simplified drawings of circuits. We sometimes also call these
wiring diagrams
circuit blueprints
. A schematic shows what is connected to what and which components to use in building the circuit. We will use the IEEE (Institute of Electrical and Electronics Engineers) US standard for drawing circuits in this book. The schematic in
Figure 3
actually represents the same circuit as the illustration in
Figure 1
. The straight lines represent wires, and each component has its own unique symbol.
Figure 4
shows some common schematic symbols you’ll see in this book.

Some standard IEEE schematic symbols

The IEEE schematic symbol format is internationally recognized and used to communicate and share circuit drawings across the world. It’s intended to quickly represent components using very simple lines and drawings.


As you work through the projects in this book, you will build and test a variety of designs. As you build a circuit, you may also want to rearrange parts, swap things around, or add new components. This process is called
. You can prototype electronics in a way that is similar to building with wooden blocks or LEGO bricks by using a
solderless breadboard
like the one shown in
Figure 5

A translucent solderless breadboard with horizontal rows and vertical power rails

Other books

Antiagon Fire by Modesitt Jr., L. E.
Bleeding Kansas by Sara Paretsky
The Great Bedroom War by Laurie Kellogg
Little Grey Mice by Brian Freemantle