The Arduino Inventor's Guide (3 page)

Introduction

Welcome to
The Arduino Inventor’s Guide
! This book will get you started working with electronics, programming, and making cool things. Anyone can be an inventor, and this guide will walk you through a series of projects that combine common materials with the powerful Arduino to help inspire you to start making your own inventions.

WHAT IS THIS BOOK ABOUT?

At the heart of this book is the Arduino (
https://www.arduino.cc/
), an open source microcontroller board that you can program to control LEDs, measure temperature, react to light, interface to GPS satellites, and do much more. Arduino is also the name of the programming language and development environment that we will use throughout this book.

Arduino is the ultimate tool for makers looking to add control to their projects. A quick search online for “Arduino projects” returns millions of hits. There are thousands of projects and ideas available on sites like Instructables, hackster.io, and YouTube. That shows just how many makers out there are using Arduino.

At SparkFun Electronics, we encourage people to experiment, play, and tinker with common household items by altering and integrating electronics components. This is sometimes known as
hacking.
This book will teach you some core electronics and coding skills, and we hope it will inspire you to build something new and unique with materials you find around your house.

WHY ARDUINO?

There are dozens of different microcontrollers and development platforms out there, so why are we creating another set of projects for Arduino?

The answer lies in the simple fact that Arduino was not originally created for makers, engineers, or hobbyists but for design students in Ivrea, Italy, as a learning platform to help them make their projects function without needing years of electrical engineering courses or tons of math and theory. It was designed to shorten the time from
“nothing” to “awesome!”—that is, from idea to physical product—for nontechnical people.

Arduino did its job so well that the maker community and hobbyists picked up the platform and ran with it. This is due to a number of factors—low price, good documentation, open source hardware— but we think the core reason Arduino is so popular is that it is easy to learn on. Arduino is a gateway for anyone into making, inventing, and prototyping projects. The projects in this book are designed for someone who wants to learn and is driven by the initial spirit of Arduino: to bring an idea to fruition.

HOW IS THIS BOOK DIFFERENT FROM OTHERS?

A lot of programming books read like reference manuals, jumping right away into coding or electrical concepts before providing context, and collecting dust on your bookshelf until you need to look up a command or concept you’ve forgotten.

This book is not like that. It aims to teach new concepts through fun, interesting, and practical projects. The projects progress in complexity and difficulty incrementally from
Project 1
to
Project 10
, and they will help answer the age-old questions: Why am I learning this? Why is it important? And why should I care?

We assume you’re reading this book because you’re eager to learn something new or looking for materials to share with others. Whether you’re an interested novice, a teacher, a librarian, or a parent, this book is a hands-on guide for people who want to learn and is not meant as a reference manual to sit on your bookshelf.

You don’t need any experience with electronics or programming to get started with Arduino. We assume you know nothing at the start and that you may be a little apprehensive about diving in. That’s okay! This book progresses steadily from introductory material to more complicated and challenging projects.

We also know that there are plenty of people out there with experience looking for something new—maybe a new spin on an old topic, such as a fresh look at blinking LEDs. Many of these projects can be used as starting points for you to hack and develop further or build out of better materials for a more polished and durable finish. In the end, this book is for someone who is proactive—a problem solver who jumps in with both feet.

We encourage you to build the projects as you go, learning by doing. These projects have been carefully designed to introduce both the tools and skills for programming and circuit building, as well as fabricating using cardboard, scraps, and other household items. The fun of learning is in playing out the entire process, and that is what this book offers.

MATERIALS

The electronics components used throughout this book are based around our flagship product, the SparkFun Inventor’s Kit (KIT-13969), and are also readily available individually from a number of sources online. We’ve also used a few parts that aren’t in the Inventor’s Kit, and these additional parts are available as a single kit as well (
https://www.sparkfun.com/NoStarchArduino/
).

If you already have an electronics starter kit or want to buy the components separately rather than getting the Inventor’s Kit, you can find the full Bill of Materials (BOM) for the book in
Tables 1
and
2
. We’ve included individual lists of materials at the beginning of each project as well.

We’ll also be using many basic building materials like cardboard, cardstock, construction paper, drinking straws, and paper plates to build the enclosures for the projects. As you start working with electronics and integrating them with common materials, you’ll find yourself looking at everyday household items in a new way.

TABLE 1:
SparkFun Inventor’s Kit parts used in the book

QTY

PART NUMBER

DESCRIPTION

1

DEV-13975

SparkFun RedBoard (or other Arduino-compatible board)

1

CAB-11301

USB Mini-B cable

1

PRT-12002

Solderless breadboard

1

PRT-11026

Male-to-male jumper wires (qty 30)

1

COM-12062

Assorted color LEDs (qty 20)

1

COM-09264

RGB LED (common cathode)

1

COM-11508

10 kΩ resistors (qty 20)

1

COM-11507

330 Ω resistors (qty 20)

2

COM-10302 or COM-09190

Push buttons

1

COM-08588

Diode

1

COM-09806

10 kΩ potentiometer

1

COM-13689

NPN transistor - 2N2222 or BC337

1

SEN-09088

Photoresistor

1

SEN-10988

TMP36 temperature sensor

1

SEN-08680

50 mm SoftPot membrane potentiometer

1

COM-07950

Piezo buzzer

1

LCD-00709

16 × 2 character LCD

1

ROB-09065

Submicro size servo motor

1

ROB-11696

Hobby motor

TABLE 2:
Additional parts used in the book (not included in the SparkFun Inventor’s Kit)

QTY

PART NUMBER

DESCRIPTION

1

PRT-12043

Mini breadboard

1

PRT-13870

Short 4-inch male-to-male jumper wires (qty 30)

2

PRT-09140

Male-to-female jumper wires (qty 10)

1

COM-12062

Assorted color LEDs (qty 20) (additional LEDs)

1

SEN-09088

Photoresistor (additional)

1

PRT-09835

4 AA battery holder

4

PRT-09100

AA battery

1

ROB-13845

TB6612FNG H-bridge motor driver

1

ROB-13302

Geared hobby motors (qty 2)

1

ROB-13259

Rubber wheel fit for the geared hobby motor (qty 2)

1

COM-00102

Mini slide switch

REQUIRED TOOLS

The only tools you’ll need for these projects are a pair of scissors, a craft knife, and a hot glue gun. However, don’t feel limited to these tools. If you have a laser cutter available to you, use it. If you are itching to 3D-print a project, feel free. Our designs are made with paper craft and cardboard in mind, but they can be combined with any fabrication technique you want.

You shouldn’t have to spend any money on the materials for this book if you don’t want to. In fact, there are probably a few projects you could use the book itself as a material for. If you do, that’s awesome! As former teachers, we are familiar with working with very small budgets, and our focus is always on the most cost-effective building materials, such as cardboard, paper, wood, and recycled plastics and metals.

Most of the projects in this book are designed to be built as prototypes that can be easily taken apart and reused. However, if you really like a project and want to make it permanent, check out the appendix to see how to solder your project. The tools for soldering and electronics prototyping are relatively inexpensive, and you can buy them from SparkFun (
https://www.sparkfun.com/
) or any hardware store near you.

REQUIRED COMPUTER

Finally, you’ll program the Arduino using a computer and a specific set of software tools. Just about any average computer can handle the Arduino software. If you have a PC running Windows, you’ll need to be running Windows XP, Vista, 7, 8/8.1, 10, or newer. For Mac users, currently the latest version of Arduino is compatible with OS X 10.7 Lion or newer. If you’re running a fairly standard version of Linux, odds are there is a version of Arduino available.

As of this writing, iOS and Android devices are supported only through beta-release software packages still under testing and development. You’re welcome to try these, but they may not work, and if they do, they may not be reliable.

For Windows, Mac, or Linux users, we’ll walk you through the process of setting up your computer in the first project.

WHAT’S IN THIS BOOK?

This book includes 10 hands-on projects, as well as a primer on electronics and an appendix that covers soldering and other handy tips. The projects start with a simple blinking LED and gradually incorporate different electrical components, programming concepts, and layers of construction sophistication as the projects progress. Each project has separate sections on wiring, programming, and construction so that you can focus on individual aspects. We wrap up each project with a “Going Further” section that gives you ideas for hacking and modifying the project. Remember, we want you to use these projects as launching points for your own inventions, not as end goals.


Electronics Primer
Before jumping into the projects, we present the foundations of electricity and electronics and introduce key concepts used throughout the book.


Project 1
:
Getting Started with Arduino
Covers installing software and gives you a foundation in building and programming circuits by walking you through a project that lights up an LED.


Project 2
:
A Stoplight for Your House
Explores using a breadboard and controlling multiple components at once to build a three-LED stoplight.


Project 3
:
The Nine-Pixel Animation Machine
Extends the stoplight to nine LEDs in a 3 × 3 matrix and teaches you about custom functions in Arduino.


Project 4
:
Reaction Timer
Walks you through using a button and an LED to make a game that tests your reaction times.


Project 5
:
A Color-Mixing Night-Light
Explores using a voltage divider and a light sensor to detect a room’s light level and automatically turn a multicolored LED on or off depending on how dark it is.