## Arduino Tutorial 27# How to control 12V LED and motor with 5V Arduino using Transistor TIP 122

Posted in Arduino

In this tutorial we will see how to control 12V LED and motor with 5V Arduino by using Transistor TIP122. And we are using transistor as a switch and also controlling led and motor with plus width modulation. We will also see how to calculate base current resistor. So let’s get started.

For this you will need

1. Arduino,
2. Transistor (TIP 122),
3. Diode (1N4007) If you are controlling motor,
4. 12V battery,
5. 2K ohms Resistor,
6. Jumper wires,
8. 12V LED, (If you are controlling LED)
9. 12V Motor (If you are controlling Motor)

##### How to find base current resistor?

First we need to calculate base resistor for transistor. Using this method you can find any transistor base resistance. Download data sheet of transistor TIP 122. Now goto page number 3 and in second figure we can see equation on top right corner Ic=250 X Ib,

So we need to check how much load current is require to run a motor.  My motor require 0.44Amp current. It may be printed on motor or it is written in motor specification. So my Ic value will be 0.44Amp. Now calculate Ib which is equal to 1.76mA.

Ib = 0.44/250

Ib= 1.76mA

Look at figure 2 again now we know collector current. Check 0.44 value in figure 2 and Match with Vbe saturation. Its value is around 1.375 V.

Vbe= 1.375 V

It means that Arduino has voltage drop of (5-1.375) which is equal to 3.625V. Now according to ohms law R = V/Ib.

3.625/1.76×10-3 = 2059.65 ohms

So we get 2059 ohms as a base current resistor value.

but I am using 2.2K ohms resistor. You can calculate base resistor according to your load current.

To control 12V LED we need to connect our circuit like this.

After doing connection. Open Arduino IDE software,

goto file > Examples > Basics > blink.

Upload led blink sketch. Now we can see we are using transistor as a switch it will turn on and off 12V led for 1 second.  Now again goto Arduino IDE software

goto file > Examples > Basics > fade,

upload fade sketch from examples. Change pin number to 9. Now we can see it is fade on and off. We are controlling this with plus width modulation.

Now we will control motor. Just add diode across the motor.

Now upload the blink sketch. I have given 1 second delay for ON and 3 second delay for OFF. So that we can see clearly motor is stop spinning. Now we will control motor with plus width modulation. Upload the sketch of fade from examples. Now we can see it is varying its speed in every 300 millisecond.

##### Components list to buy online:

http://amzn.to/2fvSRJq   (Arduino)

http://amzn.to/2zPbscy (Transistor TIP 122)

http://amzn.to/2nd75Ch (12V Battery)

http://amzn.to/2jx6031 (12V LED strip)

http://amzn.to/2jwb0Vv (12V Motor )

http://amzn.to/2AfkqyH (Diode 1N4007)