Easy DC Motor Controller

158,991

472

68

Published

Introduction: Easy DC Motor Controller

About: I'm a UM engineering student. I like to build robots, machines, and electrical systems based on whatever parts I can scrap out of old or broken things.

If you're building a robot or other microcontrolled gadget, you will need to drive DC motors forwards and backwards. In this instructable, I'll demonstrate a simple and inexpensive circuit that controls a DC motor from two I/O pins. It requires no integrated circuits, and uses commonly available parts. I recommend you build it on a breadboard the first time. I designed this circuit, but I'm not the inventor of this type of motor controller. I got interested in motor control circuits like this one when I saw the amazingly precise movements of the Makerbots and CNC routers at Maker Works in Ann Arbor.

Step 1: Parts List

Here are the parts you'll need. All of them should be available at your local RadioShack or hobby store.

(1) DC motor

(4) MOSFET transistors. I used the IRF540N, but any N-channel MOSFET will do.
 
(4) Diodes

(2) NPN bipolar transistors. I used the BC548.

(2) PNP bipolar transistors. I used the BC327.

(4) 2200 ohm resistors (red-red-red)

(4) 10K ohm resistors (brown-black-orange)

Some jumper wires and a breadboard, if desired

The resistor values are not critical. Values that are fairly close will most likely work fine. 

Step 2: The Finished Circuit

Here's a picture of the complete circuit on a breadboard, with some additional part labels.

Step 3: How to Use It

This circuit is designed to run a motor from the same power source as your microcontroller. Setting I/O pin 1 high makes the motor spin in one direction, and setting pin 2 high makes it spin in the other. Setting both pins low stops the motor, so speed control can be achieved through a PWM signal to a pin. I should also mention that setting both pins high at the same time shorts your battery, and should be avoided. I used a 12 volt power supply I made, but you could go as high or low as your transistors can handle. If you are driving very large motors, I recommend putting the MOSFETS on a heatsink or fan. Attached is a video of the circuit in action. 



I'm connecting the transistor gates to positive by touching them with a jumper wire in this video, but they also are easily switched by two microcontroller I/O pins. I put a piece of red tape on the motor shaft to make it easier to see.

Step 4: How It Works

When you set pin one high with your microcontroller, the NPN transistor Q7 switches on. This connects the base of the PNP transistor Q5 to ground, turning it on as well. Q5 then connects +12 volts to the mosfets Q1 and Q4, which connect the motor to positive and ground. Setting pin 2 high connects the motor to positive and ground in the opposite polarity. The four diodes protect your transistors from voltage surges that sometimes occur when a DC motor is abruptly stopped. The 10K ohm resistors pull the bases of the transistors to ground when your I/O pin goes low, and the 2200 ohm resistors limit the current that can be drawn from your I/O pins to protect them. Have fun spinning motors! I used two of this circuit for the drive train of my robot butler.

Share

Recommendations

  • Clocks Contest

    Clocks Contest
  • Planter Challenge

    Planter Challenge
  • Oil Contest

    Oil Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

I would really like a pcb layout to mill out a few circuit boards for this. I would certainly be willing to send back a few milled circuit boards in return.

68 Comments

I'm considering making these as kits and selling them. Would anybody be interested in buying a kit if I go through with it?

5 replies

You can also sell the PCB and schematic diagram of this motor drive circuit.

Yes this circuit seems to work exceptionally well, A PCB version would be preferable for durability and professionality. Maybe a variety of circuits with different power handling capabilities. Like a little pack you get with the PCB and the components and you solder them on yourself?

I would like to thank you for this circuit as I was able to adapt it further to create a robot arm controller and control 5 motors with this one circuit.

On what? A breadboard or a circuit board?

Presumably a circuit board. I was thinking a solder-it-yourself type of kit that comes with the necessary parts and a pcb. I could probably do a breadboard or veroboard instead though. What would you prefer?

id be exceptionally interested
higher voltage/amperage ones would be a must for my applications though :)

Hey thank you for this awesome circuit, used it in a trade school project for proportional forward and reversing relative to temperature. I used the IRF511 MOSFETS and boy do they get hot!

1 reply

Glad to hear it worked for you! Heat sinks are your friend

If anybody had a file or even made scale pencil drawing which I could convert to file for milling a pcb circuit I would gladly send you a few milled boards..

Hello.

I mistakenly emitter the collector in BC327. Can it still be?

how many amps can this handle?

I think you have the collector and emitter swapped on Q5 and Q6 in your schematic. The emitter should go to your supply and the collector should go to the load. PNPs will work with the emitter and collector swapped, but the current gain will be horrible (<<10). More importantly you will be limited to the reverse breakdown of the emitter-base rather than the much larger collector-base breakdown. The BC327 has a emitter-base breakdown of 5V, but your circuit will put 12V across the junction when off - not good!

Very good circuit! driving a DC motor with Mosfets. I simulated your circuit with proteus and works great, I builded it up and works pretty good.

Can you please tell me how i connect my arduino or motors to this type of motor driver .

IMG_20160827_163807.jpg

I am curious how you turn on the high side N-MOSFETS in your circuit. To turn these on the gate voltage would need to be significantly higher than the source. In other words, you would need a separate voltage source which supplies the voltage to charge the high side gates. I am unsure why your schematic would even work as the high side MOSFET source is close to 12V already.

Hi,thank you for this great project. I want to control the speed of the motor using pwm with Arduino. How can I do that using this circuit ?

Can you add a simple circuit to run this dc controller with only 1 pmw input which is similar circuit to a L293D driver? I have a Kyosho 370 dc motor.

Hey nice work, but i will ask why did you use NPN and PNP transistors back to back? Cant you connect NPN transistors directly to N-Mosfets, it will work aswell?

Hey nice work, but i will ask why did you use NPN and PNP transistors back to back? Cant you connect NPN transistors directly to N-Mosfets, it will work aswell?