Introduction: Use Arduino With TIP120 Transistor to Control Motors and High Power Devices

Picture of Use Arduino With TIP120 Transistor to Control Motors and High Power Devices
Hello again.

So you have a DC motor or lamp but no matter how you connect them to your Arduino they just won't work? Guess what, the Arduino is a brain that comes with small muscles. It can control LEDs and other low power nicknacks but not those power motors or lights you need for your next project. The Arduino is good at thinking but not for heavy lifting. Lazy lad.

There are a few add-ons out there that you can buy such as power and motor shields for your Arduino. They have all the muscles in one nice package. Slap those shields on your Arduino and you are ready to control motors and other high power stuff (some soldering may be required.)

Or you can do it yourself for a fraction of the cost and double the pleasure. Enter the TIP120 and its sidekicks.

The TIP120 is an NPN Power Darlington Transistor. It can be used with an Arduino to drive motors, turn lights on, and drive other high power gadgets.

The TIP120 acts as a power broker or gatekeeper between the Arduino realm and the high power realm composed of the PC fan and its battery pack. The Arduino can tell the TIP120 how much power to pass from the external battery pack to the PC fan but the Arduino does not share any of its power or share pins with the PC fan or its batteries. The TIP120 is the go in between.

The TIP120 has three pins. One is called Base, which we will connect to any of the Arduino PWM pins. Through the Base pin, the Arduino can tell the TIP120 how much power to supply to the motor from the external battery pack. That's it. The TIP120 does the heavy lifting while Arduino sits back and gives orders through one of its PWM pins to the TIP120 Base pin telling it how much power to pass to the motor. The poor TIP120 has to then pass the requested power from the external power to the motor based on Arduino's request.

In this tutorial, I will build a basic circuit in which I use an Arduino to control the speed of PC fan via the TIP120. You can take this basic circuit and replace the fan with other devices.

If you want to know more about Darlington transistors you can spend some time at Wikipedia It's an interesting read but you don't really need to understand it to use the TIP120. Heck I don't know what most of this stuff means.

The TIP120 is a very robust item. It can handle lots of power (see specs) but the Arduino can't. So we must protect the Arduino from potential party crashers. For starters, we use a 1K Ohm resistor between the Arduino pins and the TIP120 Base pin. This is insurance against electric shorts. The TIP120 can handle 60V and 5A but I assure you the Arduino won't.

Then we have those DC motors. The internal brushes on toy/hobby DC motors generate lots of potentially harmful sparks and stray electricity that needs to be blocked. Instead of guessing which motor is safe and which is not, we simply add a $0.20 diode and $0.10 1uF ceramic capacitor to our circuit. Some electromechanical devices such as solenoids may require different capacitors.

Placing the ceramic capacitor on the + & - poles of the motor will act as suppressor of sparks and surges generated by motor brushes, which can be harmful to your circuit.

A small ceramic capacitor in the range of .01 to 0.1 uF is probably sufficient to offer protection from hobby DC motors. But If you are using brushless motors, such as the PC fan I am using in this tutorial, don't use a capacitor.

As for the 1N4004 diode, it allows current to pass in one direction from positive to negative but will block any stray current that tries to go in the opposite direction, which might have undesirable effects on your circuit.

Unlike resistors which allow current to flow in both directions, diodes were designed to let current pass from positive into negative, not the other way around. When you look closely at those small diodes we use in our projects, you will see a ring on one end of the diode cylinder. This tough guy can block high voltage (400V) with high current (1A). Again, no need to understand all this stuff so long as you connect the circuit properly.

I am a picture person so I have lots of pictures to help me explain my point.

- TIP120 transistor (datasheet: ) $0.70
- Diode 1N4004 (datasheet: ) $0.20
- 1K Resistor (Brown, Black, Red, Gold) $0.10
- 1uF ceramic capacitor to be used with hobby DC motors $0.10
- Arduino UNO with IDE
- Breadboard
- PC fan or hobby DC motor
- 9V Alkaline or 7.2V NiMh batteries (6 X AA)
- Wires.

NOTE: I don't get commission or any perks from linking to I just like their service and prices so far.

// Define which pin to be used to communicate with Base pin of TIP120 transistor
int TIP120pin = 11; //for this project, I pick Arduino's PMW pin 11
void setup()
pinMode(TIP120pin, OUTPUT); // Set pin for output to control TIP120 Base pin
analogWrite(TIP120pin, 255); // By changing values from 0 to 255 you can control motor speed

void loop()

I must thank for his super blog.



Swapnil P (author)2017-10-01

how to change AC voltage using transistor??

MichaelR152 made it! (author)2017-08-11

I used this guide to build a circuit to drive a laser. My device has an internal build that controls current, so I dispensed with the capacitor and diode. At any rate, this quide's information was super helpful and clear and the circuit runs much better than what I had before.

Note: Sorry the picture isn't great. It's just some pic I snapped another time... I didn't realize I had to have a photo to post that I made this.

MichaelR152 (author)2017-07-13

Thanks, this is really thorough and well explained. I'm still fairly uncomfortable with transistors, but your explanation has made me comfortable with not only using the TIP120 but in modifying the circuit for my specific needs. Cheers.

RodrigoB10 (author)2017-06-01

Is there any way of achieving the same thing without using any batteries, just arduino connect to the wall?

JoelM91 (author)RodrigoB102017-06-10

Of course. If your AC-to-DC adapter supplies 12V and at least 1A, it's enough to power your UNO board and drive your small hobby 12V DC motor.

SarahD25 (author)2016-07-14

My circuit drives the the motor, but does not vary the speed. I wonder if its a coding problem? Heres what I wrote;

// Define which pin to be used to communicate with Base pin of TIP120 transistor
int TIP121pin = 11; //for this project, I pick Arduino's PMW pin 11
void setup()
pinMode(TIP121pin, OUTPUT); // Set pin for output to control TIP120 Base pin
analogWrite(TIP121pin, 255); // By changing values from 0 to 255 you can control motor speed

void loop()
digitalWrite(TIP121pin, HIGH);
analogWrite(TIP121pin, 5);
digitalWrite(TIP121pin, HIGH);
analogWrite(TIP121pin, 100);
digitalWrite(TIP121pin, HIGH);
analogWrite(TIP121pin, 255);
digitalWrite(TIP121pin, HIGH);
analogWrite(TIP121pin, 0);


Any ideas most welcome

SarahD25 (author)SarahD252016-07-14

Please note I'm using a TIP121, I'm also using a switching mode power supply (set at 9v) and not batteries, my motor is DC 6-15v

Your sketch is always setting the speed to maximum speed.

If you remove the digitalWrite(TIP121pin, HIGH) instructions it'll work!

igourlay (author)SarahD252016-07-28

Hey SarahD25,

So I tried your code with a different transistor but the same type and it gives me the usual behavior of a variable current flow. I would recommend removing those digitalWrite(TIP121pin, HIGH) commands because the analogWrite is all you probably need. However, the problem at hand is that your motor isn't varying its RPM so if I were to guess, the transistor might be damaged and it is acting like a short circuit.

If you have a multimeter there are tests you can do on the leads to see if it is damaged; Google can help there.

Otherwise your code is fine minus the digitalWrite(), unless they are purposefully put in there but I don't really see why. The digitalWrite() is just outputting a fraction of time of a digital high signal so ~5V (Arduino Uno) then your analogWrite() is sending periodic digital high signals (aka PWM). So long story short I don't think you need those digitalWrite() commands in this instance.

I'm new here, sorry if that was long winded.

Hope that helps!

JeffD158 (author)2017-03-05

You may want to move to a MOSFET instead of a TIP-120. Runs alot cooler. Check out:

Franciscodr made it! (author)2017-03-03


I made the same but to control a DC motor for a drone. Thanks! ;-)

Esan.shraideh (author)2015-05-28


lowendguru (author)Esan.shraideh2015-07-25

You shoud use an "H Bridge" and 2 pins of the arduino, that way you can choose the polarity. And you should turn CAPS LOCK off, keeping it on is bad Internet etiquette..

pls tell me the codes for u said

scshepard (author)2016-11-29

hi, many thanks; got my simple little LED output from transistor under Arduino control now. wee!

drtuto made it! (author)2016-10-31

Used it to control a strip of 12V LEDs and it is awesome. So a microphone board from Sparkfun controls the brightness. Thanks much...

RobertV89 (author)2016-09-09

I created the circuit and uploaded the sketch to my Arduino without issue, or so it seemed. My varying the analogwrite value between 0 and 250 I can change the output voltage, but I can only vary it between 5V and the 10V of my power supply. At a value of 0 it is still outputting 5V. Is that a limitation of the transistor used in this demo? If so, what do I need to look for in a transistor? I do not necessarily need it to go to zero but it would need to 'turn off' at some point.

NaveenN27 (author)2016-05-04

can we control two directions? and can v use pwm for speed control?

Gabrielin (author)NaveenN272016-06-08

If you want to control two directions, check out for a transistor H bridge. It is basically a circuit made of 4 transistors that allows you to choose a direction for the motor. And yes, you can use PWM for speed control. Anyway, I recommend using MOSFET transistors instead of TIP120, because the TIP ones are too old, and they usually dissipate a lot of your power, and might even overheat and stop working.

NaveenN27 (author)Gabrielin2016-06-08

ok , thank you so much (y)
May i know how to control the speed of the moors using mosfets as a h bridge?

JuneilS (author)2016-02-29

i have tried making the circuit, but instead of 9v battery, I used 12v dc from unregulated power supply. but when i measured the voltage supplied to the motor. it barely reaches 8v. i dont seem to understand it. does anyone know why does it happen?

Gabrielin (author)JuneilS2016-06-08

TIP120 is an old and outdated transistor. For higher power applications, like yours, you would rather use a MOSFET. TIP120 will overheat and dissipate lots of your power, and might even stop working if it gets too hot.

Gabrielin (author)JuneilS2016-06-08

TIP120 is an old and outdated transistor. For higher power applications, like yours, you would rather use a MOSFET. TIP120 will overheat and dissipate lots of your power, and might even stop working if it gets too hot.

alexandru_88 (author)2016-05-18

The electrical diagram it;s not good.The N conection of the tranzistor it,s separate from P conection.

7-Factories (author)2016-04-21

This is great, and thank you for posting this, but do you know how to do something like this on a tiny scale? What much smaller transistor can handle this current when you need to make a tiny board for the project?

OmiW1 (author)2015-11-28

hello, i've already setup the circuit as shown but only different on diode 1N4007 and TIP122. the problem is my fan does not spin. i tried to swap TIP122 with 2N222 and the fan is spinning but even though i change the output value it still in the same speed... would you help me?

CharbelE (author)OmiW12016-03-26

hello, i did this project with TIP122 and 1N4007 and it worked great... i used a 10k potentiometer to control the speed . I don't think the problem is from your diode or transistor so make sure you connected the sensor correctly

kriekit (author)2016-03-21

I made did this project a while ago. It worked perfectly. Then I left to do some stuff, but when I came back hours later, the TIP120 had burned the plastic around the holes in the breadboard, it was that hot. From what I understand, you're supposed to attach a heatsink to the TIP120, or better yet, just use a different transistor. I'm redoing this with a 2n7000.

Altoidian (author)2016-02-25

I made it and also applied a 5 v voltage regulator (xx7805) for the Arduino so I could run it from a 12 V DC wall wart unregulated. I used a Nano and hooked up the same pin numbers. My project required the motor to be on for one second and off for ten seconds to slowly rotate a wheel to reduce the RPM from 150 to just once every two minutes. It worked perfectly after I included appropriate delays in the program.

Thanks very much for your help in this instructable. I will post my project as an instructable and refer back to this project to help viewers learn how to do the motor control.

lpradhan1 (author)2016-01-10

Can I use TIP122 instead of TIP120 ??

Altoidian (author)lpradhan12016-02-16

Yes...TIP120-122 are all NPN Darlington Transistors.

Anytime you wonder about your transistor, lok up the data sheet and it will tell you. for example, here: You will see your TIP120 listed with the TIP122.

RoarLionman (author)2016-01-14

I am trying to do this with a 5VDC heating pad:

Should I still have the capacitor across the two heating pad leads?

cgalliher (author)2015-10-07

so I'm looking at the spec sheet, and it looks to me like the minimum input voltage on the collector is 5V. What can I use with 3.3V outputs like on a teensy lc? I'm googling it, but haven't come up with the right component yet. I want to address LED strings as in a costume using teenies, in case you are wondering...

ColinC15 (author)2015-10-02

This is a great setup thank you.

Should I get a larger resistor if I were to use a large 12v battery with a drill motor?

BasmanD (author)2015-07-04

if i dont have tip 120, which one can substitute it?

cheekid (author)BasmanD2015-10-01

Any NPN transistor rated for your application will do.

ahbee87844 (author)BasmanD2015-07-15

i am using this s8050 npn & it work

eyalasulin11 (author)2015-07-21

i can use dc motor and don't use pc fan?

cheekid (author)eyalasulin112015-10-01

Yes, you can.

icey.hood (author)2015-09-22

Does it matter if i wired the transistor directly to power and the +ve of fans to the emmiter?

cheekid (author)icey.hood2015-10-01

I'm not sure what you mean. Show a diagram and we can assist you.

SpencerD1 (author)2014-12-08

if i do all of this except put the capacitor on the motor what are the consequences?

cheekid (author)SpencerD12015-10-01

The capacitor is there to filter nosie. Depending on your curcuit you may be fine without it. Everything will still work just not as smoothly as it could work.

satchelfrost (author)2015-03-05

Hi, I just recently built a project using the ATtiny85 (rated I think somewhere between 2 to 5V). The project uses a simple code with a potentiometer to control the speed of a DC motor. Wouldn't you know it, after spending a lifetime soldering, the motor doesn't have enough torque for my needs. I had put a 5V voltage regulator in the circuit with the IC to prevent frying the thing, but now it's looking like I need a more powerful DC motor. Do you think this TIP120 will solve my problems?

cheekid (author)satchelfrost2015-10-01

Your project requires a geared motor. The TIP120 will not solve this problem.

dfshk (author)2015-05-31

Would this also work with a 3.3V Arduino Pro?

cheekid (author)dfshk2015-10-01

Yes, bare in mind the Arduino is not handling the voltage or amp draw. The Arduino like the posted stated is only there to give orders. Your connected device and power source are operated independently. The Arduino is the boss. Make sure you understand the basics before doing this project. If you start with less you'll be much better off because you'll have a greater understanding.

SIM-Tech (author)2015-07-15

this is so stupid like a 12V fan ? really why wud anyone need to do this with a MCU ? is a over kill just stick a 9V battery to it with a switch thats it,,, NOW if your going to include some IF statements while adding some sort of sensor NOW this is a reason to use a MCU but as a stand along is just a waste of time, even a DC motor could have suffice with just a 9V a resistor and a TIP120??? hell no a Voltage regulater 7805 would have done the trick while saving voltage obvs by regulating it no need for a mcu

i included one of my mini humanoid robots and this is worth a ATTINY MCU for all this motor i have used here

cheekid (author)SIM-Tech2015-10-01

Of course it isn't needed. He is demonstrating how to use the transistor with an arduino nothing more. He could have connected other devices as well but the basic setup will remain the same. It's all about building blocks. Switch on a led, now switch on led with a transistor, now switch on an led with a transistor through a relay. Those basic steps with the addition of other components will allow the user to control many things. So is it really "stupid" Nope not at all.

vipul.swamy (author)2015-09-20

Wow!! thank you...

About This Instructable




Bio: Did I unplug the solder iron?
More by techbitar:IR Remote Control Station for Android - TURN THE TV DOWNSensoDuino: Turn Your Android Phone into a Wireless Sensors Hub for ArduinoModify The HC-05 Bluetooth Module Defaults Using AT Commands
Add instructable to: