Driving Motors with Arduino

Pages
Contributors: bri_huang
Favorited Favorite 2

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-13969
4 Retired

Required 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:

SparkFun RedBoard - Programmed with Arduino

SparkFun RedBoard - Programmed with Arduino

DEV-13975
$21.50
49
Breadboard - Self-Adhesive (White)

Breadboard - Self-Adhesive (White)

PRT-12002
$5.50
48
Hobby Motor - Gear

Hobby Motor - Gear

ROB-11696
$2.10
4
Jumper Wires Premium 6" M/M Pack of 10

Jumper Wires Premium 6" M/M Pack of 10

PRT-08431
$4.50
2
Transistor - NPN, 50V 800mA (BC337)

Transistor - NPN, 50V 800mA (BC337)

COM-13689
$0.55
Diode Small Signal - 1N4148

Diode Small Signal - 1N4148

COM-08588
$0.25

Resistor 330 Ohm 1/6 Watt PTH - 20 pack

COM-11507
2 Retired

These 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.

Voltage, Current, Resistance, and Ohm's Law

Learn about Ohm's Law, one of the most fundamental equations in all electrical engineering.

How to Use a Breadboard

Welcome to the wonderful world of breadboards. Here we will learn what a breadboard is and how to use one to build your very first circuit.

What is an Arduino?

What is this 'Arduino' thing anyway? This tutorials dives into what an Arduino is and along with Arduino projects and widgets.

Transistors

A crash course in bi-polar junction transistors. Learn how transistors work and in which circuits we use them.