Brushed DC motors are simple to drive. Just give them a voltage and they go. Lower the voltage and they slow down. Reverse the voltage and they go backwards.
Simple Speed Control
If all you need is speed control, you can drive a motor with a PWM pin and a simple transistor circuit. The PWM pin controls the transistor which switches the current to the motor. The higher the PWM duty cycle, the faster the motor will go.
Learn how to build one in Arduino Lesson 13
from the Learning System:
Basic Speed and Direction Control
Need to reverse direction too? That requires some more circuitry. The H-Bridge is a 4-transistor circuit that allows you to reverse the current flow to the motor. With an H-Bridge and a PWM pin, you can control both the speed and direction of the motor.
You can learn how to build an H-Bridge circuit using an L293D chip in these Learning System Guides:Arduino Lesson 15 - DC Motor Reversing
.Raspberry Pi Lesson 9 - Controlling a DC Motor
This guide was first published on May 21, 2014. It was last
updated on May 21, 2014.
This page (Brushed DC Motor Control) was last updated on May 04, 2015.
Motor Control Boards
The Adafruit Motor Shield V2
is an off-the-shelf solution capable of powering brushed DC motors up to 1.2A continuous (3A peak) at up to 12v.
Learn how to use this shield for DC motors in the Adafruit Motor Shield V2 Guide
in the Learning System Guide
The nice thing about the shield is it handles all the PWM speed control on its own, and uses only the two shared I2C pins to control motors. It's also stackable so you can add more shields as desired to control more motors without taking up any more pins.