in response to conditions, whereas analog circuits tend to use components to vary the current, voltage, and resistance of a circuit to achieve the same result.
There are advantages and disadvantages to both ways of thinking, but you can’t solely use one and not the other. For example, you couldn’t read the temperature using a microcontroller without using a number of analog components as well.
WHAT IS A MICROCONTROLLER?
A
microcontroller
is a small computer that you can program by uploading a program or set of instructions. Microcontrollers are used to automate simple tasks, like controlling the temperature of your house or watering your lawn when it’s dry.
The projects in this book use the SparkFun RedBoard microcontroller board, which is 100% compatible with the Arduino Uno. Both are pictured in Figure 12 .
FIGURE 12: The SparkFun RedBoard (left) and the Arduino Uno (right) microcontroller boards
In an average day, you probably use 15 to 20 microcontrollers and you don’t even know it. They are in your coffee maker, alarm clock, and microwave. Your car alone has anywhere from 5 to 10 of them that control the braking, stereo, and ignition systems. Our world practically runs on microcontrollers. This book will help you learn how to harness that fact to take back a bit of control over your world.
NOTE
You will learn more about the Arduino, how to program it, and what its capabilities are as you build the projects. For now, just know that a microcontroller is a programmable brain that makes electronics easier for anyone to build and prototype ideas that automate the world around them.
We hope that this short primer has given you a little background and a preview of what the rest of this book will cover. We’re excited that you’ve decided to embark on this adventure with us. Now, let’s get to building our first project!
ADDITIONAL RESOURCES ON BASIC ELECTRICITY AND ELECTRONICS
If you’re eager to learn about electricity and electronics in more detail, we highly recommend you check out the following books:
•
Basic Electricity
by the Bureau of Naval Personnel (Dover Publications, 1970)
•
Arduino Workshop
by John Boxall (No Starch Press, 2013)
•
Getting Started in Electronics
by Forrest M. Mims III (Master Publishing, 2003)
•
Practical Electronics for Inventors, 4th edition
by Paul Scherz and Simon Monk (McGraw-Hill Education, 2016)
1 Getting Started with Arduino
This project covers everything you need to get your Arduino up and running! We’ll introduce the hardware, show you how to install the programming environment, and help you make sure everything works by loading a simple program. At the end, you should have your own blinking light and the excitement to move on. Let’s go!
MATERIALS TO GATHER
You’ll need the following hardware (shown in Figure 1-1 ) to complete this project:
• One SparkFun RedBoard (DEV-13975), Arduino Uno (DEV-11021), or any other Arduino-compatible board
• One USB Mini-B cable (CAB-11301 or your board’s USB cable)
• One LED (COM-09590, or COM-12062 for a pack of 20)
FIGURE 1-1: Required components
ABOUT THE ARDUINO
An
Arduino
(pronounced är·də’wēn·ō or “arr-dween-oh!”) is a small programmable device that can add smarts to nonintelligent things. You can use an Arduino to run robots, create LED art, and even act as a handheld gaming console. In this section, we’ll go into more detail on what the Arduino is and how it can change the way you think about the world around you.
An Accessible Hardware Platform
An Arduino is like a small computer. You can program it using very simple instructions, and you can power it with just a few AA batteries. What makes an Arduino really different from a regular computer is that it uses a
microcontroller
, rather than a CPU, to process information and take action. This small chip acts as the brains of your project, and it can receive input from sensors (like light detectors, temperature sensors, or buttons)