CHAPTER 13
Controlling Motors with Arduino
So far, we’ve created projects that have had an impact on the real world. We’ve
made LEDs shine, and we’ve controlled devices using infrared light. In this
chapter, we’ll create an even more intense experience: we’ll control motors
that will actually move things. We won’t go so far as to build a full-blown
autonomous robot, but we’ll create a small device that does something useful
and funny.
First, though, you’ll learn about the basics of different motor types and their
pros and cons. Today you can choose from a variety of motor types for your
projects, and this chapter starts with a brief description of their differences.
We’ll concentrate on servo motors, because you can use them for a wide range
of projects and they’re cheap and easy to use. You’ll learn to use the Arduino
servo library and to control a servo using the serial port.
Based on these first steps, we’ll then build a more sophisticated project. It’s
a blaming device that uses nearly the same hardware as the first project in
the chapter but more elaborate software. You’ll probably find many applica-
tions for it in your office!
What You Need
1. A servo motor, such as the
Hitec HS-322HD
2. Some wires
3. A TMP36 temperature sensor (it’s optional, and you need it only for the
exercises)
4. An Arduino board, such as the Uno, Duemilanove, or Diecimila
5. A USB cable to connect the Arduino to your computer
report erratum • discuss
www.it-ebooks.info