0

I have a 9V DC motor and I want to control its speed with an Arduino board with help of a power transistor TIP120. In one of the web-tutorials the writer explains how to calculate the resistor resistance. Here is the link to the page: http://teachmetomake.wordpress.com/how-to-use-a-transistor-as-a-switch

In Example 1, if you scroll down to read the paragraph starting with: “Finally let’s take a look at the datasheet for the TIP120. First, we see that Ic(max) = 5 A, and that Vceo(max) is 60, 80, or 100 V, so we are fine so far. Next we check the base current...” you can read his explanation.

Here the writer of the blog uses a logic to calculate the resistor value for the base. If I use his logic I obtain a resistor value which is very low comparing to other examples in other websites. Here is my scenario using his logic and by looking at TIP120 data sheet:

1-) The DC motor will be fed by a 9V battery and will be controlled by a pwm pin from the Arduino using a TIP120 transistor.

2-) The DC motor draws 500mA with no load; and 2500mA stall current as Imax_load. I measured these with an ampermeter.

3-) In this case the TIP120 satisfies the condition for Vce and Ice_max.

4-) Since Ic/Ib = 250, Ib_max will be 2500mA/250. So Ib_max = 10mA.

5-) Accoridng to TIP120 data sheet, in saturation zone for 2500mA the base emitter voltage will be Vbe = 1.75V.

6-) Since Arduino pin output is 5V, the voltage drop in resistor should be Vr = 5V – Vbe = 5 – 1.75 which means Vr = 3.25V.

7-) We can then use the base current Ib as 10mA < Ib < 40mA. Below 10mA the current will be too low and above 40mA might damage the Arduino. So I also choose a calue as 20mA. This means a resistor value R = Vr/Ib = 3.25V/20mA so that I obtain the proper resistor as R = 162.5 ohm.

I found many tutorials for Arduino and this transistor they use resistors such as 1k or 2.2k ect. For example here at this webpage they use 1k resistor: http://www.instructables.com/file/F9LKDFGGU7FXUMH There are many other use 1k and 2.2k.

My question is, is his logic and my calculations are right? Can I safely use the resistor I calculate?

user16307
  • 11,802
  • 51
  • 173
  • 312
  • 2
    It is safe to use, most arduino tutorials don't add the stall current in. Where does "Ic/Ib = 250" come from? If I read this right the datasheet says it's more than 1000... EDIT: Ah ok, found it. Tiny text on figure 2. Yepp, it is save to use, then! ^^) – Alzurana Oct 20 '14 at 19:11
  • 2
    I agree the design method is sound. Only thing I'd add is you probably don't need the factor of 2 margin on Ib. Beta > 1000 is guaranteed, so in effect the datasheet curve already includes a factor of 4 margin in the definition of "saturation" vs "linear" behavior. You could design for 10 or 12 mA base current and still be okay. – The Photon Oct 20 '14 at 19:25
  • The Photon thanks, do you have an idea how to figure out how to find the lower limit for switch/saturation mode? I mean 10mA is ok for switch mode but what can be the lower limit? it shouldn't operate in amplification mode right? – user16307 Oct 20 '14 at 19:34
  • @user16307, AFAIK, it's just a fuzzy transistion, so they just picked arbitrarily to use the point where gain drops by 3/4. – The Photon Oct 20 '14 at 20:41

1 Answers1

4

Following the instructions on the blog I can assure you that it is safe to use for your application.
It seems that most arduino tutorials either drive much smaller motors, or use standard resistor values.
As in: "Oh well, I don't wanna calculate it, lets just whack 1k in there."

Just to be clear:

The datasheet says b = 250 on total saturation in figure 2.
You go from there and take your collector current, which is Ic = 2.5A

Ib = Ic / 250
Ib = 25mA

Then you look at figure 2, again. Vbe for Ic = 2.5A is about 1.75V
->(Don't be afraid to overshoot a LITTLE bit)
The output voltage of your controller is Vaduino = 5V
so you can calculate the resistors voltage:

Vr = Varduino - Vbe
Vr = 3.25V

Therefor your resistor is:
Rb = Vr / Ib
Rb = 130 ohm

Yes this is extremely small, but you are driving large currents and your signal voltage from the Arduino is very low. The TIP120 operates at the upper range of it's specs, that's why Vbe is that high.
What you can do is add a 2nd transistor to drive the TIP120 to decrease current on your I/O pin of the Arduino. But as far as I know the Arduino is able to drive 25mA. It's on the edge, but it CAN do it.

Here's a schematic:
lower Arduino Current
This lowers the current on your arduino I/O pin. This setup is useful for even larger loads, even though I'd recommend a mosfet in that case.
Another problem with this: it inverts the output, so whenever the I/O pin is HIGH, Q2 is off.

Also:
You said you're driving this from a 9V cell. Keep in mind that 9V batteries are not able to provide 500mA without a significant voltage drop, and they certainly don't provide 2.5A! So you might wanna think about your power source, too.

Alzurana
  • 173
  • 1
  • 8
  • Thanks for answer . Btw I'm planning to power the DC motor by a 9V battery? What do you mean by " add a 2nd transistor to drive the TIP120 to decrease current on your I/O pin "? – user16307 Oct 20 '14 at 19:36
  • aha ok you re talking about the base current draw. – user16307 Oct 20 '14 at 19:44
  • Yepp. I did an edit on my answer, check it out. ;) – Alzurana Oct 20 '14 at 19:54
  • thnx for the input! one last question about this. i saw in another tutorial one was using a 1uf capacitor parallel between motor imputs. what would it be for? – user16307 Oct 20 '14 at 20:09
  • Parallel caps are used to compensate the cosPHI factor of an AC motor (The motor is an inductor). But I've never seen one on a DC motor. Theoretically a PWM signal is an AC signal with DC offset, so it could be compensation or protection. But don't ask me how to calculate that one, as I said, never seen them on DC motors and it was never mentioned in my electrical engineering classes as well. ^^ – Alzurana Oct 20 '14 at 20:15
  • 1
    @user16307 - The capacitor across the motor is noise suppression, to try and filter-out the noise caused by the high-speed electrical switching which happens inside a brushed DC motor. –  Oct 20 '14 at 20:55
  • one more thing. in your diagram with 2 transistors when Q2 is triggered by the arduino pin, it will saturate and the Q1 will turn OFF. similarly when Q2 is "not" triggered by the arduino pin(base current is zero), then the Q1 will be ON. does that mean when pwm is zero the motor will be ON? – user16307 Oct 23 '14 at 17:37
  • Yes, it inverts the output, so whenever the pin is HIGH, the motor is off. You have to consider this in your software and invert the PWM output. It is possible to prevent this with a third transistor, but one line in software is cheaper than an additional resistor and transistor. Also you save space on your PCB layout. – Alzurana Oct 23 '14 at 18:04
  • @Alzurana i actually implemented your version and exactly how you say with a programming we can workaround the inverting issue. 5V is coming from arduino's fixed 5V and I used a power supply for DC motor. but i made some current measurements with an ampermeter and here what i measured: first i applied around 7.2 Volt to the DC motor and when Q2 is OFF and Q1 is ON the current through R1 becomes 26.1mA (motor runs). and when Q2 is ON and Q1 is OFF, the current through R1 becomes 36.7mA. – user16307 Oct 23 '14 at 23:14
  • 1) is there way to make sense why in the latter case more current driven? 2)i didn't observe a large current change in arduinopin1 (0 to 1.9mA). does that mean I can use this 2 transistor system for much more higher voltages? – user16307 Oct 23 '14 at 23:15
  • 1) When Q2 is ON the collector-emitter drop is ~0.2V. This circuit is designed to drop the base-emitter voltage of Q1 below it's switching point. Therefor, the voltage on the resistor = 4.8V. But when Q2 is off, the base-emitter voltage (Q1) is 1.75V, leaving 3.25V across R1. This is one of the downsides of this circuit, btw. It has a "standby current". 2) Depends on what you call "much higher voltages". As long as your components can take it you can go up, ofc. As long as no higher voltage gets passed to the uC, of course. – Alzurana Oct 23 '14 at 23:52
  • I must say that I feel uncomfortable with such high base currents. Whenever I get close to switch currents > 1A I pick mosfets as power transistors. – Alzurana Oct 23 '14 at 23:56
  • @Alzurana when i added capacitors the peaks softened. anyway 1)my new observation is about the voltage across the motor depending on this implementation. I was expecting to see a square wave with a Vmax when Q1 is ON and zero when Q1 is OFF like this: http://www.zembedded.com/avr-introduction-to-pwm-part-i/ But what I saw in oscilloscope: – user16307 Oct 24 '14 at 17:14
  • here is the video where i adjust the pulse with frequency: https://www.youtube.com/watch?v=1oS1zyJJTWA&feature=youtu.be why is the voltage is not going to absolute zero during Q1 OFF,instead it is increasing when duty cycle is increased. 2)what are the peaks related to because they dont change when i adjust pwm frequency. is that noise? – user16307 Oct 24 '14 at 17:16
  • The coil of the motor is an inductor. On the ON cycle this inductor is building up a magnetic field, using the energy provided. Said magnetic field induces a reverse voltage in the coil, making it appear to be lower. On the OFF cycle said magnetic field still induces a voltage as it's getting weaker, again. That is the decreasing voltage you see. The motor basically becomes a current source. D1 allows that current to flow freely through the motor. It's basically how DC motors behave when driven by a PWM signal. (Btw, can't watch YT videos, I'm on dial up xP) – Alzurana Oct 24 '14 at 17:59
  • The peaks you see are related to switching. The fast switching of your components causes signals to overshoot a little. This is also related to wire inductance and you normally don't have to compensate them for these PWM signals. They become a big deal on digital data transmission lines which operate > 1MHZ, though. Add me on skype, it's the same username. Should be easier. ^^ – Alzurana Oct 24 '14 at 18:03