DC Motor Driver 1 0

From RepRap
Revision as of 10:31, 8 June 2013 by Traumflug (talk | contribs) (Cool Hacks!!!)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page describes something which is no longer the most recent version. For the replacement version see: DC Motor Driver 1 1

Cache-1890054055 f5d5293028.jpg

This board allows you to control up to 2 small DC motors individually. Each motor can be driven at a maximum of 750 mA. It supports both direction and speed control. It is designed to be interfaced with a microcontroller such as the Arduino, or even something like a Basic Stamp. Whatever you can choose, it should be able to work with this board as it has a simple and easy to use interface.

Get It!

There are currently no known kit sellers. For help on collecting the parts, see below.


Cache-1815240669 2cd432174c.jpg

You can download the release file from SourceForge that has a bunch of helpful files for this board. It contains:

  • GERBER files for getting it manufactured
  • PDF files of the schematic, copper layers, and silkscreen
  • Eagle source files for modification
  • 3D rendered image as well as POVRay scene file
  • exerciser code to test your board.



The PWM Driver has 5 input pins + Power:

Pin Function
POWER This is a power input connector. We use a polarized disk-drive style power connector found on nearly every ATX power supply in existence. If you want to directly connect your own power, the board required 12v input.
GND It's recommended to connect this to the ground on your Arduino to share a common ground.
DIR_A This pin controls the direction of the motor controller. A high signal tells the motor to rotate forward, and a low signal tells the motor to rotate backwards. The actual direction depends on how you have your motor wired up.
PWM_A This pin controls the speed of your motor's rotation. You need to supply it a PWM signal, which determines the speed.
DIR_B This is identical to DIR_A, except it controls the second motor.
PWM_B This is identical to PWM_A, except it controls the second motor.


Each motor output is rated for up to 750 mA. If you wire up a motor that draws more current than that, you risk blowing out the L293D. If you plan on doing this, its suggested you socket the L293D so you can easily replace it, should overheat and fail.

Pin Function
channel a/b This is the output for the respective motor input pins. Each output has two pins: depending on the direction the motor is being driven, the polarity will change. You will need to experiment to determine the proper way to wire your motor up to get it to rotate in the correct direction. There are only two possibilities, so don't worry. =)

Circuit Board

Cache-1588630537 1b94af0845.jpg

Currently, there are no known vendors of this PCB, so you have to make your own or order custom made ones from a prototype PCB manufacturer. The image shows the professionally manufactured PCB once sold by the RepRap Research Foundation.


Cache-1794981849 1dbf5c4ac6.jpg

Refer to the parts.reprap.org for information on where to get the stuff you need.

DC Motor Driver v1.0
Part Name Quantity Type
PCB DC Motor Driver v1.0 PCB 1 pcb
C1-C6 100 nF ceramic capacitor 6 component
C7,C8 100 uF electrolytic capacitor 2 component
IC1 L293D 1 component
IC1A 16 pin DIP socket 1 component
IC2 74HC00N 1 component
IC2A 14 pin DIP socket 1 component
MOTORS 2 pin header 2 component
POWER 4 pin molex connector 1 component
R1-R4 100K ohm resistor 4 component
Cat 6 cable 2 wire

Known Bugs

These are all the bugs we know about. If you find any, please contact us in the forums.

Silkscreen Oops

We forgot a couple layers on the silkscreen, and neither the part names, or their values are present. You'll have to refer to the pictures, the PDF in the release files to determine what parts go where. Its pretty simple to figure out though. There are only 6 different types of components to assemble, and it is very easy to see which parts go where.

Output Swap

It appears that the pins on one of the motor output is reversed. You can either rotate the header 180 degrees, or wire up the connector in reverse. Sorry about that.

Build Process

Cache-1794982487 3c47b3ee1d.jpg


Solder the resistors to the board. They are all 100 Kohm resistors, and the orientation does not matter. Make sure to clip the component leads after you have soldered them into the board.

Cache-1890878562 4529190f6b.jpg

DIP Sockets

These are the sockets to put the chips into. You solder the sockets in first (without chips!) to protect yourself from: soldering in a chip backwards, damaging a chip from the heat from the soldering process, and as insurance in case you blow a chip. Match the dimple on one end of the socket with the dimple on the silkscreen and solder it in.

Cache-1890878902 b16eb4a9ce.jpg


These are the 100nF (0.1uF) ceramic capacitors. They all fit into the rectangular silkscreens. The polarity doesn't matter with these components, so just put them in and solder them. Clip the legs close to the board after you are done.

Cache-1890880208 dc17778830.jpg

C7, C8

These are the 100uF electrolytic capacitors. These have a specific orientation, so make sure you insert them the right way. The board has a + sign near one hole, and the capacitor has a - sign along one side to identify it. Make sure you insert the insert the component accordingly (- lead goes into the - hole)

Cache-1890880594 9b93b29b22.jpg

Motor Connectors

Solder the motor connectors here. Face the connector tabs toward the inside of the board. Make sure they are flush with the PCB and then solder them in.

Cache-1904475942 50846748fe.jpg

Power Connector

This is the 4 pin connector that has 2 angled sides inside the connector. Match up these sides with the silkscreen and solder the connector to the board. This is where you will hook it up to the power supply.

Cache-1890053641 a57f679d26.jpg

Input Wires

Take 2-3 feet of Cat 6 ethernet cable, and remove 3 twisted pairs from it. Trim 1/4" from the end of each of the wires, and insert them into the respective holes for the pins. Then solder each wire into its hole. Trim the ends if required.

Color Input
GND Brown
DIR_A Blue
PWM_A White/Blue
DIR_B Orange
PWM_B White/Orange

Cache-1890053813 63c4bdffac.jpg


This is the logic chip. It has 14 pins and fits into the smaller socket. You will want to match up the dimple on one end with the dimple on the socket/silkscreen. Take care with the legs. You will insert it by first lightly inserting one set of legs into the socket, slightly pushing on the chip to bend the pins so that the other row of pins can be inserted into the socket. Once all pins are in the socket, push down on the chip to fully insert it. Take care to not damage the chip legs!!

Cache-1890054055 f5d5293028.jpg


This is the motor driver chip. It has 16 pins and fits in the larger socket. Follow the directions above on how to insert it.

Test Your Board

Now we have to test the board. Its very easy, and consists of a few steps.

Cache-1890883004 1e6d227cec.jpg

Wire up test devices

You will want to wire up two motors to the board to test both channels. If you only have one motor, you can still test it, but you'll have to test them each individually. The orientation of your motor doesn't matter, as long as it can be driven in both directions, and it pulls less than 750 mA of power.

Cache-1890054327 a08531a4e4.jpg

Connect Board to Arduino.

This part is very easy. Strip 1/4" from the end of the input wires (You used Cat6 ethernet innards right???) Now, insert the end of each input into the correct pin on the Arduino, and then connect the Ground pin to Ground on Arduino. Use the table below to determine what pins to hook up to what:

PWM Pin Arduino Pin
GND Ground

<videoflash type="vimeo">373787</videoflash>

Upload Firmware to Arduino

Now, feel free to turn on the power to your power suppply. Next, open the Arduino software, copy/paste the code below into the program and upload it. After the firmware has compiled and uploaded, the Arduino will restart and the exerciser will begin shortly.

int dir_pin_a = 4;
int speed_pin_a = 5;
int dir_pin_b = 8;
int speed_pin_b = 9;

int i;

void setup()
   pinMode(dir_pin_a, OUTPUT);
   pinMode(speed_pin_a, OUTPUT);
   pinMode(dir_pin_b, OUTPUT);
   pinMode(speed_pin_b, OUTPUT);

   //make the motors rotate in opposite directions so show that they're working independantly.
   digitalWrite(dir_pin_a, HIGH);
   digitalWrite(dir_pin_b, LOW);

void loop()
   Serial.println("Speeding motors up to max.");
   for (i=0; i<=255; i++)
      analogWrite(speed_pin_a, i);
      analogWrite(speed_pin_b, i);

        Serial.println("Motors at max.");
   Serial.println("Slowing down to 0;");

   for (i=255; i>=0; i--)
      analogWrite(speed_pin_a, i);
      analogWrite(speed_pin_b, i);

   Serial.println("Motors stopped.");
        Serial.println("Switching directions.");

   digitalWrite(dir_pin_a, !digitalRead(dir_pin_a));
   digitalWrite(dir_pin_b, !digitalRead(dir_pin_b));

The basic way the motor exerciser works is this:

  • Both motors will rotate in opposite directions.
  • Both motors will gradually speed up to maximum speed.
  • Both motors will gradually slow back down to a stopped state.
  • Both motors will then switch directions and repeat the program.

Connect Power to Board

Simply take your hacked PC power supply and plug a power connector into board. There is no power indicator, but as long as nothing starts smoking, you should be fine.


  1. First, check to see that you have supplied power to the board.
  2. If that doesn't work, check that you have the board wired up correctly to the Arduino.
  3. If the motors do not move at all, then check your circuit for shorts and dry joints.
  4. If only one motor turns, or they turn in the same direction, check the orientation of how the motors are wired.

Cool Hacks!!!

Drive a Stepper Motor

Cache-1759830918 ae59f13f46.jpg

This board can also be used to drive a stepper motor. It can only handle small motors, so make sure your stepper motor wont pull more than 750 mA. If you have a small stepper motor that you want to drive, then this board is perfect for it: small, cheap, and easy. Here is what the pins functions are:

Pin Function
GND It's recommended to connect this to the ground on your Arduino to share a common ground.
DIR_A This pin is pin #1 for the 2 wire stepper control.
DIR_B This pin is pin #2 for the 2 wire stepper control.
PWM_A / PWM_B These pins become the enable pins. When they are set to high, the motor has full torque, and when they are low it will turn freely. You should wire them together, and treat it as a single input. You can also use PWM on this pin to give a variable level of torque.

That's how it works, now here's how to do it:

First, wire up the stepper to your board: one coil to one motor output, and the other coil to the other output. If you wire one up backwards, simply reverse the leads on one (and just one) motor output, and it should drive correctly. If you have a bipolar stepper motor, its easy... just wire up the wires one to one. If you have a unipolar stepper, its a bit trickier, but if you google, its possible to wire it up as a bipolar motor as well.

Cache-1759831242 10430da3ac.jpg

Next, you'll want to wire your DC Motor Driver board to your Arduino. Here's how you do it:

PWM Pin Arduino Pin
PWM_A +5v
PWM_B +5v
GND Ground

After that, you'll want to program your Arduino with some 'exerciser' code to test the board and make sure everything is working. Copy and paste the code below into your Arduino program, upload the program to the Arduino, then apply power to your DC Motor Driver board.

 Stepper Motor Controller
 language: Wiring/Arduino

 This program drives a unipolar or bipolar stepper motor.
 The motor is attached to digital pins 8 and 9 of the Arduino.

 The motor moves 100 steps in one direction, then 100 in the other.

 Created 11 Mar. 2007 by Tom Igoe
 Modified 7 Apr. 2007 by Tom Igoe
 Modified 25 Oct. 2007 by Zach Smith


#include <Stepper.h>

// change this depending on the number of steps per revolution of your motor
#define motorSteps 200

// define the pins that the motor is attached to. You can use any digital I/O pins.
#define motorPin1 8
#define motorPin2 9

// initialize of the Stepper library:
Stepper myStepper(motorSteps, motorPin1, motorPin2); 

void setup()
   Serial.println('Starting stepper exerciser.');

void loop()
   int i;

   for (i=25; i<=60; i+=5)
      //set our new motor speed
      Serial.print("Speed ");

      // Step forward 200 steps:

      // Step backward 200 steps:


   for (i=60; i>=25; i-=5)
      //set our new motor speed
      Serial.print("Speed ");

      // Step forward 200 steps:

      // Step backward 200 steps:

If everything goes well, after a short pause your Arduino will start sending the correct stepping signals and your motor will rotate in a test pattern. Here's a basic description of what it will do:

  • Rotate forward 200 steps
  • Rotate backward 200 steps
  • Increase or decrease speed

The exerciser will test speeds from 25 RPM to 60 RPM and then back down.