Instructables

Easy DC Motor Controller

Featured
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.
 
Remove these adsRemove these ads by Signing Up

Step 1: Parts List

Picture of 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

Picture of The Finished Circuit
Here's a picture of the complete circuit on a breadboard, with some additional part labels.
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!
mgingerich (author)  atenwesteneind2 months ago
Glad to hear it worked for you! Heat sinks are your friend
jp-diy2 days ago

Very nice circuit , I am trying to built this WE

2 questions

what is the aim of bipolar transistor ?

I use IRFZ24, I think diodes are not mandatory because there are integrated to mosfet ?

thank you

mgingerich (author)  jp-diyyesterday

The bipolar transistors allow you to connect 12v to the gates of the MOSFETS when you turn them on. Without them, the microcontroller would only connect 5v to the MOSFETS, and the they wouldn't turn on all the way. This limits the power you can deliver to the motor. You're right about the diodes, they aren't mandatory if your MOSFETS have them internally. I still use them as an extra precaution, in case someone builds this circuit with different components than I did.

sacnorth14 days ago

This article really rocks, But here we used more components, for a simple project of mine where i just wanted to drive a motor from my arduino board , i found the very simple circuit here"http://ehowplus.com/diy/make-simple-dc-motor-drive...

I think this will help for people who need a simple driver using a transistor switch

Akbar134 months ago

Hi,

Thanks for such a good information about dc motor controller! :)

I'm planning to make a Segway using Arduino Uno microcontroller. I have two 24V 250W DC motors. Is it possible to control them using this circuit? If it's possible do I have to make two such circuits?

Otherwise I plan buying a sabertooth 2x25 motor driver which costs 128$ :(

H-bridge is much cheaper but I think it can not drive 24V motors.

I'm waiting for any suggestions and recommendations for this project.

Thanks in advance,

mgingerich (author)  Akbar134 months ago

It's possible to control them using a circuit like this, but you'd definitely have to use different mosfets that could stand up to the high power. If you put them in parallel and add heatsinks and fans you should be able to get it to work. You'd also have to use a 24 volt battery and regulate it down for your arduino. If it might save you $250 then it's worth a shot, right?

Thanks for your reply,

I ask you because you have an experience, could you please provide me parts list like in step 1 above to control 24V 350W or 250W dc motor.

Below I provided a link for the details of motor, I would appreciate your help thanks

http://www.aliexpress.com/item/High-Quality-UNITE-...

Gabse1 year ago
ARDUINO!!!!
JesusGeek1 year ago
Save up a few hundred, buy these parts from www.taydaelectronics.com, and start an eBay kit business! (before I do)
wankeye1 year ago
Thanks, I tried this with zero knowledge besides a Google search of various H-bridges and I had pretty poor results. I look forward to looking at yours to see where I went wrong and to try again!
nroche1 year ago
Hey. I can see where the collector / emitter confusion has come from - it's wrong in the PNP circuit on that Adafruit quick reference sheet you linked in. In principle that sheet would be great, but in practice its really not good. They have also made very dangerous generalizations about device pinouts which are definitely not safe blanket statements - they could well confuse the beginner / hobbyist users who they are aimed at even more! Silly people! My advice: take the link down - it will do more harm than good and frustrate people who are trying to learn how this stuff works.
Anyway, that's my 10 cents. Nice instructible though - pretty straight forward and I think I might just use this.
mgingerich (author)  nroche1 year ago
Thanks, looks like I fell into that trap! That reference sheet worked for me, but I probably just had forgiving transistors. I took the link down, maybe I'll find a more accurate one. Wouldn't want to confuse my fellow electronics geeks!
Wyle_E1 year ago
Quibble: the control element of a bipolar transistor is called the base, for historical reasons.

This "H-bridge" configuration is so common that it's available as a single chip from the companies that make power MOSFETs.
mgingerich (author)  Wyle_E1 year ago
Good point about the transistor's base, I'll fix that. I know you can buy integrated circuits that will do this, but where's the fun in that? I try to avoid using ICs in my projects because it forces me come up with my own solutions and I like to use salvaged parts. Thanks for the input!
profpat1 year ago
nice circuits!
mgingerich (author)  profpat1 year ago
Thanks :)
mgingerich (author) 1 year ago
It's been brought to my attention that Q5 and Q6, which are BC327 PNP transistors, appears have their emitter and collector swapped in my diagram. They worked fine for me in this configuration, but you might get different results if you use different transistors. If the MOSFET section of the circuit works, but you have trouble getting the BJTs to switch them, try reversing the emitter and collector.