Introduction: Simple, Cheap Motor Controller

About: I work at RobotZone ( the folks behind Actobotics and ) in Winfield, KS. I love working on projects with my kids and seeing what they create.

I've used this simple circuit several times to drive motors (like in my Stair Climbing robot) as well as solenoids. I originally picked it up from this instructable which is focused on controlling a solenoid. I wanted to isolate this circuit in its own Instructable as a motor driver so I could easily reference it from other future instructables and also provide example code to show how to use it in this manner.

Step 1: Parts List

The parts list is pretty short:

  • A 1N4001 Diode
    adafruit has a 10 pack for $1.50
  • A small solderless breadboard
  • Jumper wires
  • A 1K resistor
    (you'll need 2 if you want to add an optional LED which I'll cover later)
  • A DC brushed motor
    (When choosing a motor for this project, note that the TIP120 transistor can handle 5A continuous and 8A peak.)
  • A battery with enough power to run your motor and enough voltage to power the arduino (7-12V)
  • An arduino uno (or other flavor of your choice)... really anything that can supply a pwm signal.

Step 2: Operation Principle

PWM stands for pulse width modulation. This basically means it is a circuit that is being turned on and off (pulsing) and you can change how long it is on and how long it is off (that's the modulation part).

In the world of servos, a PWM signal acts as sort of Morse code... a micro-controller in the servo reads the duration of each pulse and uses that to decide where to turn the motor to.

However, this speed controller is simply fully proportional... that is to say: you can change (modulate) the pulse from all the way off to all the way on and the motor will go from standstill to running at full speed. If the pulse is such that is is on half the time and off half the time the motor will turn at 50% of its maximum speed.

The transistor is using that low voltage / low amp pwm signal and using it to switch a higher voltage, higher amp signal going from the battery to the motor. It is acting as an amplifier in this sense.

An advantage of using this method to alter the motor's speed vs changing the voltage is that you maintain the motor's torque. This is because at any given time the motor is either completely off or completely on.

Step 3: Connecting the Circuit

I've posted the circuit on fritzing:

(Look for the "downloads" section in the lower right.)

I also have the example code on codebender:

Step 4: Options

You can optionally add an LED. The PWM signal will control how bright it glows. So the faster the motor goes the brighter the LED will be!

Just connect the anode (the + side with the longer leg ) middle transistor leg or negative side of the motor - then connect the cathode (the - side of the LED with the shorter leg) to the a 1k transistor which is then connected to the positive power rail.

Powering the arduino with the same battery as the motor is optional but convenient. You don't have to disconnect the Vin pin when you connect the USB to program the arduino since "The Arduino Uno can be powered via the USB connection or with an external power supply. The power source is selected automatically.... external power will be chosen if it's above 7.4V or so, otherwise USB power." - source

This circuit is very simple and only drives one motor in one direction. Though I have duplicated the circuit and driven a Bogie Runt Rover with it (which has 6 motors - I drove the left 3 motors with one of these circuits and the right 3 motors with the other). Since there is no reverse you don't get a full tank style steering but it is certainly maneuverable (in fact I built a line follower using this setup).