Driving Motors with Arduino
Introduction
There are 20 GPIO (General Purpose Input \ Output) pins on the standard Arduino Uno and the SparkFun Redboard. These pins are limited to driving no more than about 40 mA of current. For controlling things like motors, 40 mA is just not enough. A small hobby motor requires at least 100 - 200 mA to spin up. To do this, we need to use a circuit called a transistor amplifier.
This project has been adapted from the Circuit #12 in the SparkFun Inventor's Kit (SIK) v3.3. We've updated the Fritzing diagrams and the code examples to make the connections easier to follow. The SparkFun Inventor's Kit is a great beginners kit to introduce you to the world of physical computing and Arduino.
SparkFun Inventor's Kit - V3.3
KIT-13969Required Materials
We suggest that you start with a full SparkFun Inventor's Kit, but for this tutorial, we are going to be using the SparkFun RedBoard, but you can use any microcontroller development board you like including: Arduino, RedBoard, Photon or Teensy. The concepts covered here are universal to nearly all systems.
Hardware used in this tutorial:
Resistor 330 Ohm 1/6 Watt PTH - 20 pack
COM-11507These parts are all included in the standard SparkFun Inventor's Kit.
Suggested Reading
If you aren’t familiar with the following concepts, we recommend checking out these tutorials before continuing.