Contents in Detail

Introduction

What is This Book About?

Why Arduino?

How is This Book Different from Others?

Materials

Required Tools

Required Computer

What’s in This Book?

Online Resources

Spread the Word: Sharing Your Work

Electronics Primer

Electricity, Conductivity, and Basic Terms

What Is Electricity?

Types of Electricity

What Is a Circuit?

Ohm’s Law

Visualizing Electricity as Water in a Pipe

Schematics, Circuit Blueprints, and Wiring Diagrams

Prototyping Circuits

Discrete Components vs. Breakout Boards

Analog vs. Digital

What Is A Microcontroller?

Project 1
Getting Started with Arduino

Materials to Gather

About the Arduino

An Accessible Hardware Platform

About the SparkFun RedBoard

Installing the Arduino IDE and Drivers

Installing on Windows

Installing on OS X

Installing on Linux

A Brief IDE Tour

Changing the Default Preferences

Test Drive: Plugging in the Arduino for the First Time

Choosing Your Board in the IDE

Selecting the Communication Port

An Arduino “Hello, World!”

Basic Arduino Troubleshooting

Anatomy of an Arduino Sketch

Key Sketch Elements

The setup() Function

The loop() Function

Your First Piece of Hardware

Going Further

Hack

Modify

Saving Your Sketch

Project 2
A Stoplight for Your House

Materials to Gather

Electronic Parts

Other Materials and Tools

New Component: The Resistor

Build the Stoplight Prototype

Connect the Red LED to the Breadboard

Add Power to the Breadboard

Add the Yellow and Green LEDs

Program the Stoplight

Confirm Your IDE Settings

Create Placeholders for Pin Numbers

Write the setup() Function

Write the loop() Function

Upload the Sketch

Make the Stoplight Portable

Build the Stoplight Enclosure

Cardboard Construction

Make the Stoplight Lenses

Make the Shades

Mount the LEDs and Arduino

Going Further

Hack

Modify

Project 3
The Nine-Pixel Animation Machine

Materials to Gather

Electronic Parts

Other Materials and Tools

Build the Nine-Pixel Animation Machine Prototype

Program the Nine-Pixel Animation Machine

What Are Custom Functions?

Design Your Artwork

The Test Sketch

Build the Nine-Pixel Animation Machine Enclosure

Cardboard Construction

Connect the Electronics

Create an Led Animation

Plan the Animation Sequence

Write Custom Functions

Tweak Your loop() Function

Going Further

Hack

Modify

Project 4
Reaction Timer

Materials to Gather

Electronic Parts

Other Materials and Tools

New Component: The Push Button

How Push Buttons Work

Using Resistors with Push Buttons

Build the Reaction Timer Prototype

Program the Reaction Timer

Write the setup() Function

Write the loop() Function

Test the Reaction Timer Sketch

Play Again?

Add a Game Element

Upload the Complete Code for the Reaction Timer

Build the Reaction Timer Enclosure

Cut Out the Cardboard

Assemble the Electronics

Spice Up Your Game Enclosure

Going Further

Hack

Modify

Project 5
A Color-Mixing Night-Light

Materials to Gather

Electronic Parts

Other Materials and Tools

New Components

The RGB LED

The Photoresistor

Build the Night-Light Prototype

Wire the Voltage Divider

Wire the RGB LED

Test the Night-Light with Basic Color Mixing

Program the Night-Light

Prepare to Check the Light Level

Control the Night-Light Based on the Light Level

Prevent False Alarms

Recalibrate the Night-Light

Create More Colors with Analogwrite()

Create Analog Signals with PWM

Mix Colors with analogWrite()

Find RGB Values with Color Picker

The Custom-Color Night-Light Code

Build the Night-Light Enclosure

Cardstock Construction

Put the Electronics Inside

Let It Glow!

Going Further

Hack

Modify

Project 6
Balance Beam

Materials to Gather

Electronic Parts

Other Materials and Tools

New Components

The Potentiometer

The Servo Motor

Build the Balance Beam Prototype

Program the Balance Beam

Test the Servo

Complete the Balance Beam Sketch

Build the Balance Beam

Cut Out the Parts

Build the Beam

Build the Base and Attach the Servo

Final Assembly

Going Further

Hack

Modify

Project 7
Tiny Desktop Greenhouse

Materials to Gather

Electronic Parts

Other Materials and Tools

New Components

TMP36 Temperature Sensor

Standard Hobby Motor

NPN Transistor

Taking a Systems Approach

Build the Temperature Monitor

Measure Temperature with the TMP36

Connect the Temperature Sensor

Program the Temperature Sensor

Build the Servo Motor Autovent

Program the Autovent

Build the Fan Motor

Program the Fan Motor

Isolate the Motor Effect

Build the Tiny Desktop Greenhouse Enclosure

Add the Autovent Window Servo

Create the Paper Clip Linkage

Add the Roof

Build the Fan-Motor Box

Connect It Up

Going Further

Hack

Modify

Project 8
Drawbot, The Robotic Artist

Materials to Gather

Electronic Parts

Other Materials and Tools

New Components

The H-Bridge Motor Driver Integrated Circuit

Geared Hobby Motor

Build the Drawbot Prototype

Program the Drawbot

Create a Custom Function

Clean Up the Code

Wire the Second Motor

Drive Both Motors

Build the Drawbot Chassis

Test and Troubleshoot

Turn and Make Patterns: A Robot Square Dance

Going Further

Hack

Modify

Bonus

Project 9
Drag Race Timer

Materials to Gather

Electronic Parts

Other Materials and Tools

New Component: The 16 × 2 Character LCD

Drag Race Timer Operation

Build the LCD Circuit

Power the LCD

Control the Contrast

Connect the Data and Control Wiring

Test the LCD

Add the Rest of the Electronics

Program the Drag Race Timer

A Quick Test

Build the Drag Race Track

Build the Starting Tower

Assemble the Starting Gate

Build Your Own Track

Add the Photoresistor

Test and Troubleshoot

Going Further

Hack

Modify

Project 10
Tiny Electric Piano

Materials to Gather

Electronic Parts

Other Materials and Tools

New Components

The SoftPot Membrane Potentiometer

The Piezo Buzzer

Build the Circuit

Program the Tiny Electric Piano

Test the Buzzer

Create Specific Notes

Generate Sound with the SoftPot

Play a Song

Build the Piano

Going Further

Hack

Modify

Bonus Project: Binary Trumpet

Appendix
More Electronics Know-How

Measuring Electricity with a Multimeter

Parts of a Multimeter

Measuring Continuity

Measuring Resistance

Measuring Voltage

Measuring Current

How to Solder

Heating the Iron

Perfecting Your Soldering Technique

Cleaning the Iron

Soldering Tips

Additional Soldering Tools

Third Hand

Flux Pen

Solder Wick

Solder Vacuum

Resistors and Bands

Afterword

Additional Resources

Acknowledgments