Introduction: Easy DC Motor Controller

Picture of Easy DC Motor Controller

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

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.

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

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


mgingerich (author)2015-03-03

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

Jarez Patel (author)mgingerich2016-01-04

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.

HerobrineAK (author)mgingerich2015-04-02

On what? A breadboard or a circuit board?

mgingerich (author)HerobrineAK2015-04-09

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?

MattA4 (author)mgingerich2015-03-04

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

atenwesteneind (author)2014-05-16

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!

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

Domino122 (author)2017-09-03


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

allangee (author)2017-06-22

how many amps can this handle?

dirty_valentine (author)2017-06-18

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!

NevzatT made it! (author)2016-12-24

I made on Proteus and i am going to make it real. Thanks for now.

Edd-electronic (author)2016-09-26

Very good circuit. It works great

Edd-electronic (author)2016-09-26

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.

NakshatraL (author)2016-08-31

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

ThomasE28 (author)2016-07-21

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.

Armagan-Er (author)2016-07-01

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 ?

VickyK29 (author)2016-06-29

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.

mbişkinler (author)2016-04-05

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?

mbişkinler (author)2016-04-05

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?

ManishVarma (author)2016-03-28

Hi dude...
I m giving power supply of 12 volts but only getting about 8 volts at motor o/p...this voltage would give low rpm nd low power to motors.pls help me i want full 12 volts output @ output.i hav used bc557 and bc 547 transistors and corrected the emitter collector of Q5 ND Q6 as stated by u but then also m getting only 8 volts which is not sufficient to run the motors..pls reply ASAP...
-Thnks in advance... :-)

kbrumleve (author)2016-03-28

I am designing a thermostat circuit using 741 op amp as a comparator, 555 timer as adjustable pulse with controlled DC and a MOSFET fire the dc motor control. Would your application work with this?

Abhi909 (author)2016-01-31

great project

can i place your project on my website.

i'm working on a website which is related to electrical projects.

i also mention your name, link and other info.

plz reply

mgingerich (author)Abhi9092016-01-31

Sure, as long as you credit me and link here! What's your website? :)

kayg9 (author)2016-01-18

Do the Mosfets need a heat sink

mgingerich (author)kayg92016-01-25

If you drive a motor that draws a lot of current they might need heatsinks. I didn't need any with the little motor I used to demonstrate it though.

kayg9 (author)kayg92016-01-18

Also can I use 3904 and 3906 transistors?

MarcusT11 (author)2015-11-26

What kind of voltage do you see at the motors with this circuit? Doesn't having N channel mosfets on the high side of the motor cause a large drop since the gate voltage is the same as source voltage?

BugraS (author)MarcusT112015-11-27

Using this circuit we are trying to drive a dc motor, if supply is 7.2V, the motor gets around 3.5V. I think the bjt part can not put mosfets into saturation mode because the appropriate voltage difference between pnp's base and collector is missing. We now try using a smaller mosfet instead of the pnp's.

TagLegend (author)2015-10-06

Can i control the speed of the motor using pwm arduino?

mgingerich (author)TagLegend2015-11-07

Yes you can!

SenithU (author)2015-08-10

this circuit will on with any remote or special remote?

SenithU (author)2015-08-10

shailendarak (author)2015-06-28

EricT8 (author)2015-06-18

drake.lesage (author)2015-04-19

what is the device on the far left and what is the entire use of it? I haven't seen it before. Also how quickly would we be able to get a kit from you if it's still possible?

mgingerich (author)drake.lesage2015-04-20

If you mean the little rectangle on the far left of the circuit diagram, that isn't intended to be a device, it's just a symbol for a port. It shows that two I/O pins connect to the two wires there. I have not actually manufactured any kits yet, since I'm still exploring how much demand there would be for kits. I plan to begin selling kits within a month or so, but nothing is set in stone yet. If you have any on the type of kit you want (breadboard,solder-it-yourself pcb, finished product, etc.) I'd love to hear it.

frtrev (author)2015-03-18

what is the capacitor in the motor for?

mgingerich (author)frtrev2015-04-09

I didn't add that capacitor, it came soldered to the motor. I assume it smoothes the pwm signal the motor receives to make the movement less choppy.

Haroldcrick (author)2015-02-08

Will this motor work by putting a PWM signal on the I/O pins? I'm trying right now and I cannot get the motor to spin backwards by changing the duty cycle.

mgingerich (author)Haroldcrick2015-02-08

A pwm signal should cary the speed of the motor. What sort of duty cycle signal are you feeding it? Is it behaving oddly or not spinning at all?

Haroldcrick (author)mgingerich2015-02-08

I had forgotten to put diodes in... It was behaving oddly but it is rectified now. One more quick thing, what frequency would you recommend, I would like it to not spin at 50 percent duty but it seems to spin slowly.

mgingerich (author)Haroldcrick2015-02-08

In that case you should probably just experiment with different frequencies until you find one that works. I think raising it might help.

Con_D (author)2015-01-09

What where the diodes you used? I have a few 1N4007's laying around, would they work?

mgingerich (author)Con_D2015-01-28

Those would probably be fine. I just used generic diodes. I'd breadboard it first if I were you just to make sure though.

mgingerich (author)Con_D2015-01-28

Those would probably be fine. I just used generic diodes. I'd breadboard it first if I were you just to make sure though.

KyleC5 (author)2015-01-26

Sooo, quick question about H-Bridge's in general. I've designed about 4 different versions (Including modeling this one) of these type of drivers. But I keep having the same problem where my High voltage is 12V, but the output to the motor is only about 8.5V :/ Does anyone know why this is and if there is a work around? TY!

bmiller73 (author)2014-12-07

how many amps does this circuit put out?

mgingerich (author)bmiller732014-12-07

I haven't tested the circuit under extreme conditions. According to the datasheet for the mosfets, they can handle up to 33 amps before they break. I bet you'd need a giant heatsink on them though. If you want to drive even bigger loads, you could switch to a different kind of mosfet that can handle more current. My power supply is kind of wimpy, so I couldn't push the circuit to the limit.

agr00m (author)2014-10-08

Interesting design. I'm wondering what's the purpose of having an NPN turn on a PNP, turn on a MOSFET. Do you know if there's an advantage to this design over driving the MOSFETs directly from the MCU? You'd just need a logic level MOSFET like a FQP30N06L (or any with an "L" at the end).

mgingerich (author)agr00m2014-10-08

I found that switching the FETs directly from the microcontroller didn't work very well because I was using a Parallax Propeller, which has a logic level of 3.3 volts. Switching the FETS with this low a voltage wouldn't turn them on all the way and limited the maximum motor speed. The transistors allow me to feed the gates of the FETS 12 volts, which is more than enough to turn them on. You could be right about the logic level MOSFETS, try it and let me know how it goes!

About This Instructable




Bio: 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 ... More »
More by mgingerich:Easy DC Motor ControllerHow To Make an OptocouplerSmall robot made from hacked toys
Add instructable to: