O.k. so im trying to power a relay with a tip120 transistor. When I look online at other peoples projects they say to use a 1k or 2.2k base resistor. I cant for the life of me figure out how they figured this out.
The transistor is a darlington pair.
It is going to switch the relay on and off.
I will use my arduino uno to control the transistor.
This is not critical, the resistor must be such that the current In the base times the transistor's gain is at least equal to the current in the collector / emitter. Make it twice as much but more doesn't matter, up to the limit of what the base can take and arduino can deliver.
Thats the problem im having. Its not simple gor me because i kerp getting what seems like all the wrong numbers.
So if the relay coil is 87 ohms at 12 volts I have a draw of 137ma. How do I figure out the base resistor from this? I know the output from the arduino is 5 volts and since this transistor is a darlington pair so I subruct 1.4 from 5 to get 3.6 volts. Whats next?
TIP120 collector current = 137mA
TIP120 base current = 137mA/1000 = 137uA
times 2 ~= 300 uA
R = 3.6v/300uA ~= 12K
So 12K is the maximum resistor you should use. In fact the TIP120 is overkill for this application (switching 137mA), a small signal transistor with a current rating of 200mA or more would have done, e.g. BC337 with 1K base resistor.
Don't forget to include a flyback diode across the relay coil.
It does seem strange to use a TIP120 to switch an automotive relay. The TIP120 is a power transistor that can switch up to 5 Amps. You can often use it in place of a relay.
As noted by dc42, a BC337 would be a better choice. Compared to the TIP120, it's cheaper, and uses less power. Just right for the application.
Well, there's certainly nothing wrong with using what's at hand. As dc42 says, the TIP120 is overkill. But it will certainly work. No need to use anything else to get your project working.
But in general, the BC337 is a good choice for projects like this. You can get them for about 7 cents each.
The flyback diode in the transistor is connected across the transistor and protects it against negative voltages between the collector and emitter. When switching a relay, you need a flyback diode across the relay coil, to protect the transistor against high positive voltages between the collector and emitter.