Easy, Reversible Motor Control for Arduino (or any Microcontroller)

Picture of Easy, Reversible Motor Control for Arduino (or any Microcontroller)
This project uses just three main components to provide forward and reverse control for a single motor.  You can easily interface it to an Arduino or any other microcontroller.

It's so simple - you can wire it up "free-form" without a circuit board in about 15 minutes.

All parts available at Radio Shack for under $9
Supports PWM for variable speed control
Handles up to 5 amps peak / 2.5 amps continuous (5 amps continuous with heatsink)
Controlled using just two pins - "enable" and "direction"

Requires at least 7.5 volts to operate
Relay is rated for "only" 100,000 cycles and may not be appropriate for some high vibration projects
Doesn't provide motor "braking"

The most common way to provide reversible motor control is with an H-Bridge.  A basic H-Bridge is made up of 4 transistors - but commonly end up requiring more like 10 components when you include things like flyback diodes and secondary transistors.  

I wanted something simpler for a CNC project I'm working on - so I came up with this design.  I'm fairly sure I'm not the "inventor" of this circuit - but it's not widely documented.  As far as I can tell it doesn't have a name.

I am hereby naming it the RAT Controller.  RAT being an acronym for Relay And Transistors.
Remove these adsRemove these ads by Signing Up
1-40 of 99Next »

I have built the exact circuit you have, same parts. I wired it up and hooked it up to a motor. The motor immediately turned on as the 12v clicked the relay, it seems like the arduino is doing nothing to the circuit. Volt meter shows the arduino sending signal but the relay isn't switching back. I think the enable transistor is shot, unknown. Thoughts?

Nazih9 days ago

Hi, I am planning to build one for a moving santa going up and down on a rope using a 12 volt DC electric motor, could the reverse action of the motor be set to a certain timings (say 2 min) after which the motor will automatically reverse the rotation, for un limited period, until it is shut off? Regards, Nazih

nothinglabs (author)  Nazih8 days ago
as long as you use a microcontroller (like arduino) - you can do pretty much whatever you want.

good luck!
nothinglabs (author) 27 days ago

So - not totally following what you're trying to do. I think if you're using a i-o-ii type switch with two poles (probably 6-pins total) - that might be enough to do forward / reverse / off on a motor..


I am not too clued up on this sort of thing but I will be making one of these to control the opening and closing of a drawer using a threaded rod and nut, although, I will only be using a 'I-O-II' switch. I assume I would replace that piece of kit for the 'I-O-II' switch? And I assume that 'I' will go forward 'O' will kill it and 'II' will reverse if I use this same setup?


jason5312 months ago

Thanks for this. I was looking for an inexpensive H-bridge I could make from locally-available parts.

I am new to this type of thing, so forgive me if this is a naive question. If you were only interested in on/off and not PWM, couldn't you use the "enable" pin to drive the coil on an SPST relay which would then connect ground the common pin on the DPDT relay? That way you would only be driving the coils (your DPDT only uses 60ma) and would only be limited by the max current of the relays themselves. The TIP120s should be able to handle just about any size relay (RS sells a 10A DPDT with a coil rating of only 130mA).

I am asking because I want to use an old cordless drill and I've read that those things can pull over 100A! Thanks again for posting this guide.

nothinglabs (author)  jason5311 month ago
Sorry for slow response.

Yes - I suspect you can add an additional relay after the "enable" TIP120 - and then use it to drive as large a load as it can handle.

Sounds like a good idea if you're not interested in PWM. You might even be able to do very slow / loud PWM - not sure how long that would last though...

Have fun!


What would you need to add or do to make the motor go faster forwards and backwards and have a manual mode and auto - mode for 30 seconds involved into the circuit?

gcarter56 months ago

This is absolutely brilliant Thanks a bunch for awesome instructions. its exactly what i was looking for as h bridges keep over heating and cooking my BD135 NPN transistors. I owe you a beer. Cheers

nothinglabs (author)  gcarter56 months ago

Happy to be of service!

atai079 months ago

hello .. I have tried your circuit but the motor only moves in one direction only .. the delay is still there ... but I still hear the sound Click on the relay ..

so where is my mistake ... can you explain

I use tip 122 ..

relay as you use

batery 12 v 1.2 AH

plz help me ...


nothinglabs (author)  atai079 months ago
If the relay is engaging - but the motor direction isn't changing - I would triple-check how you have the relay wired. (assuming you're using the same kind of relay as described)

Good luck!

brij_malhotra9 months ago

Can I connect two motors to the pins of relay instead of one for my project

or I need to make two similar circuits?

and, any other 6v relay should work fine, should nt it?

erich.haubrich10 months ago

It worked pretty well until I burned it up. :)

ArthurCornelis10 months ago

Hi, i stumbled uppon a problem. I can hear my relay switch but when i hook up a 6/9v dc motor to it my motor doesn't turn. I'm using 7.4v.

nothinglabs (author)  ArthurCornelis10 months ago
The relay is only used to switch the direction of the motor - as opposed to actually toggling the power.

The tip120 connected to the "enable" pin is responsible for toggling the actual power - so I'd start troubleshooting there.

Good luck!

zhungu1 year ago
Hello again. is there a way it can be modified to have "brake"?
nothinglabs (author)  zhungu1 year ago

I think typically motor controllers "brake" by shorting the motor leads. I don't think that's possible with this setup.

However - you could try quickly toggling the direction pin (maybe 20hz - 40hz) - and then doing some level of PWM on the enable pin.

Can't say if this will work - but it might. It will certainly make some noise though - and might not be very "nice" to the various components...
zhungu1 year ago
Hie. would this relay work as well? How do i know which ones are the normally open, normally closed pins and so on? Thanks
nothinglabs (author)  zhungu1 year ago
I believe that relay would work assuming you provide the needed voltage.

I would suspect there is some indication on what pins do what on the relay itself. Otherwise - I might just experiment using a multimeter.
crob091 year ago
Hope you don't mind the question but I'm wondering how this circuit could be used to control a high power device, it looks like the 12V-power charges the relay coil and drives the motor, I maybe wrong but is there a way to connect another power source to drive say a 36VDC motor?
Thanks for any help,
nothinglabs (author)  crob091 year ago
Should be able to - just find a DPDT relay and "drive" darlington of the values you need.

The darlington that triggers the relay can probably stay a tip 120.

On this page I mention I higher power darlington option:

(the solid state relay on that page might also be of interest)

That link takes me to an awesome project thanks!!
Maybe I'm confused about the Relay, I notice they have two values one for the coil (I think) and the other for the max load, will the Max-load value work for the coil too, for example below the relay is rated at DC5V 28VDC?
Sorry I really don't see how I connect a higher voltage to this, My relays are "JQC-3F(T73) DC 5V 5PIN 250VAC 28VDC Power Relay"
I suppose this won't work also because of them being five pin opposed to six?
nothinglabs (author)  crob091 year ago
For this project you'll want DPDT relays - which I don't think those are.

Good summary on what this means here:

Relays are commonly rated at a voltage / current required to engage (you can usually go somewhat higher or lower) - and the maximum voltage / current it can switch (often different for AC and DC).

Cool I've ordered some of the DPDT relays and the proper voltage.
Thank you for the summary link, you're right it has tones of good information.
Also thank you for the reply to my question and great job on the Tutorial.
Is it alright if I post something like this on my MOSFET page on
nothinglabs (author)  crob091 year ago
Good luck with the build.

Please feel free to use / share any aspect of this instructable however you like!
Ohh yeah one more thing I was looking at your website and the Arduino Laser show is awesome!!!!
TomDunlap1 year ago
Just finished a prototype of this to run the motor for the solar forge I'm building. Here is a clip of it running a re-purposed Skil cordless drill:
nothinglabs (author)  TomDunlap1 year ago
RISL1 year ago
hello friend i have a question about your proyect and it is posible to use with a step direction 3d printer, the 3d printer use an arduino but is the only thing i need or is necesary a interpreter, i use a sprinter firmware, i need some change or only i have to conect direct.
nothinglabs (author)  RISL1 year ago
it should be able to drive any standard DC motor.

Not totally sure - but your printer may user stepper motors - which won't work with this project.
saip1 year ago
i dont understand all this circuit connections....can u suggest me any website where i could learn about all this stuff.......plz help me.................
itshuang1 year ago
Thanks for your suggestion. I found a wiring that might work for my need:

If I use the forward and reverse leads (2.5~3v) to activate the top and bottom relays (e.g a SPDT relay, such as this one: respectively, and power(+) connected to the top NC, and power(-) to the bottom NO, do you think it will work? I appreciate your comments to a newbie like me.
itshuang1 year ago
While I am searching for ways to make my high torque DC motor reversible, I came across this instructable. It is amazing. What I am trying to do is to use a RC car's Transmitter(Tx)/Receiver(Rx) to control my DC motor's rotation(forward/reverse). The outputs from the Rx are one forward and one reverse which may be "high" depending on what is triggered on the Tx side. It works for low power DC motors. However, it is too weak to drive a high torque motor. So I need to get extra power to drive my motor reversibly. Is this control can be modified in some way to meet my need if I use the outputs from Rx as triggering signals (Say forward connects to one transistor and reverse links to another transistor)?
nothinglabs (author)  itshuang1 year ago
Hard to say - but maybe.

You might try connecting both leads from the RC car to the "enable" pin through their own diodes. Then - additionally connect just one of the leads directly to the reverse pin.

I think this -might- work (or it might make smoke).

have fun / good luck!

I am planning to buy a new DC motor driver board which can run 5amp motor but I don't know how to connect it with Atmega 8A chip. Please see the pdf I attached for Atmega 8A.

Here are the 7 pins in DC motor controller:-

Pin No. Pin Functionality
1 GND Ground
2 IN-1 Logic input for the motor direction.
3 Diagnostic 1
(DG-1) Output pin with logic 1 output in normal operation. Represents side of the internal
H bridge corresponding to IN-1. Pin is pulled to logic low by the motor driver in
case of over temperature or overload due to short circuit.
4 PWM Used to apply Pulse Width Modulation to control motor velocity
5 Diagnostic 2
(DG-2) Output pin with logic 1 output in normal operation. Represents side of the internal
H bridge corresponding to IN-2. Pin is pulled to logic low by the motor driver in
case of over temperature or overload due to short circuit.
6 IN-2 Logic input for the motor direction.
7 CS* Current Sense output to measure the current flowing through the driver
schmidtbag1 year ago
Great guide. I'm using motors that operate up to 24V 36A (I'm running them at 6A though) so I used different relays and transistors, which work fine. The problem is (which I found out the hard way) was the transistors don't have the built-in transistor that the TIP120 has and so blew up from the EMF. Thankfully I have more and only 1 transistor died. Anyways, which diode would you recommend and where do I place them in the schematic you have above? Thanks
nothinglabs (author)  schmidtbag1 year ago
Glad you like the instructable!

I haven't used an EMF protection diode with this circuit before (and haven't done too much with them in general) - so take this with a grain of salt.

I would place the diode between the transistor's collector and the positive input voltage. Wire it so the arrow points towards the positive voltage input (the other way round will cause a short).

more info here:

Sizing is a good question. There is some info at link above. The back EMF voltage can be higher than the driving voltage. Might look for something that can handle the input current at some multiple of the voltage than your'e driving it at. Might be able to get away with something less beefy since it's not getting hit constantly.

Good luck!

asharma712 years ago
I used this circuit with the following parts:
1k resistor
and tip122
everything works fine but reverse. i suspected 6 volt battery was a problem but i am using a 12 volt battery now.

Please help
nothinglabs (author)  asharma712 years ago
I would use a multimeter to make sure you're getting higher than 9v coming -out- of the reverse tip122.

You'll loose some voltage through the transistor - and if the battery is too small - it'll drop more when it tries to turn the motor.

Easy test is to leave enable off - and then just toggle reverse back-and-forth in code. Make sure you hear the relay go "click"
1-40 of 99Next »