Resistor value for base of TIP 120

I am driving some solenoid valves with some TIP 120's. Powering them with 12v, 2 amp supply. I think the valves are 8 watt coils drawing about .6 amps. Not powering more than one at a time.

I burned out my original Uno (sad face) trying to drive some MOSFET's directly so I am very gun shy and still sad and using some PC817 optoisolators between my new 5v Mini and the TIP's.

I am assuming the pin current out of the Mini to be close enough to 5v. The PC817 datasheet suggests it wants 1.2v on the input side so I said 5v - 1.2v means I need to drop at least 3.8v. 3.8v over 20 milliamps is 190. Let's put a 220 ohm resistor between the mini and the optoisolator input. So far, so good I think.

PC817 looks like it can handle 35 volts so no need for a resistor between it and the power supply. But I'm thinking I don't need to jam 12 volts onto the base of the TIP because it looks like the TIP needs less than a volt to turn on. So I'm thinking resistor between the PC817 output and the TIP base.

I poke around on the Web and I see a 10K resistor is a super common value people put on the base.

Well, says I, I'll be good and run the math. 12v - .7v means I need to drop 11.3v. 11.3 over ummm what do I put here? Looks like the TIP is rated for 120 milliamps base current max so let's be conservative and use the same 20 milliamps current. 11.3/.02 = 565. Nowhere near 10k. The equation would need a figure like 1 milliamp to get a 10K value.

So, 1) what am I doing wrong in trying to calculate the resistor value and 2) what resistor value should I use/what resistor value would you use?

Thanks in advance!

Edit: Oops! Looked at my notes wrong and reGoogled. The TIP120 circuits I see out there commonly want 1K on the base, not 10K like I said above- read my writing wrong. 565 to 1000 is not that bad and is achievable based on the current needed assumption. 11.3/.01 = 1130.

I am leaving this post up in the hopes that the thought process involved will benefit someone else.

I am just going to use the 1k or whatever I actually have that is close.

It is safe to connect an Arduino output to the base of a TIP120 (with emitter grounded) through a 1K resistor.

The current gain of the TIP120 is at least 1000, so a base current of about 5 mA will allow the TIP120 to conduct at least 5 Amperes.

Don't forget to connect the grounds.

I am using an optoisolator precisely so I do not need to connect the grounds.

The gain of 1000 is only correct if not saturated. The datasheet gives base currents at saturation for 3A and 5A:

IC = 3A, IB = 12mA
IC = 5A, IB = 20mA

So drive it with about 1/250th the maximum CE current.

It is a darlington pair, so the drop from base to emitter is more like 1.2V. In fact, the datasheet says at 3A CE current, expect about 2.5V drop from base to emitter.

So 12- 2.5 = 9.5 volts to drop.

9.5/.01amps gets me 950, which is spot on the 1K Web recommendation.

I burned out my original Uno (sad face) trying to drive some MOSFET's directly

How did that happen? On the face of it then it seems impossible, because the input resistance of a FET is so high you can hardly get any current down it to burn anything out.

You must have done something else wrong.

+1 for what Grumpy Mike said.

You don't know why you fried a board trying to use a FET - which is actually a far better and easier to use part than an opto and a TIP120 - so now its change gears to a TIP120 and let's blow up another board?

PC817 looks like it can handle 35 volts so no need for a resistor between it and the power supply

That's the first alarm bell and then you say:

I am assuming the pin current out of the Mini to be close enough to 5v. The PC817 datasheet suggests it wants 1.2v on the input side so I said 5v - 1.2v means I need to drop at least 3.8v. 3.8v over 20 milliamps is 190. Let's put a 220 ohm resistor between the mini and the optoisolator input. So far, so good I think.

Not so good, I say. You're going to just suck ~20 ma out of an Arduino pin, the absolute maximum recommended value, to drive an LED when you have never established the actual drive current requirement? Why?

So, 1) what am I doing wrong in trying to calculate the resistor value

As stated above, you've neglected to examine the first line of the spec sheet, the Current Transfer Ratio - which can be as low as 50% for the PC817A.

Assuming a worst case of 50% CTR, you need only 8ma of LED current to get 4ma of TIP120 drive current (per polymorph's suggestion, which is fine). Not the 20ma you're currently planning to shove into the diode. If the PC817 is a D series part with a CTR of 300 to 600%, you could knock that down to 1.5ma drive into the LED and the TIP120 should still be saturated.

Care to recalculate that LED drive resistor?

bigred1212:
I am driving some solenoid valves with some TIP 120's. Powering them with 12v, 2 amp supply. I think the valves are 8 watt coils drawing about .6 amps. Not powering more than one at a time.

I burned out my original Uno (sad face) trying to drive some MOSFET's directly so I am very gun shy and still sad and using some PC817 optoisolators between my new 5v Mini and the TIP's.

I think we need to get to the bottom of this first. You shouldn't be able to damage an Arduino that
way unless something was very wrong, like not having a free-wheel diode across the solenoid valve, or
having different ground potentials between valve supply and Arduino.

@markt I think I had bad MOSFETs.

@avr_fred

Not so good, I say. You're going to just suck ~20 ma out of an Arduino pin, the absolute maximum recommended value, to drive an LED when you have never established the actual drive current requirement? Why?

Because the data sheets says 50mA max and suggests 1.2v at 20mA as what to do so I didn't much worry about that.

Assuming a worst case of 50% CTR, you need only 8ma of LED current to get 4ma of TIP120 drive current (per polymorph's suggestion, which is fine). Not the 20ma you're currently planning to shove into the diode. If the PC817 is a D series part with a CTR of 300 to 600%, you could knock that down to 1.5ma drive into the LED and the TIP120 should still be saturated.

I think this is crossed somehow. The current or voltage that goes into front end of the optoisolator doesn't affect what the back end controls. It isn't like if I turn the LED on brighter I get moar power. I think what you are trying to suggest is that I might not need very much current at all at the base of the 120.

In any event, if you disagree with the 1K value, perhaps you could suggest a different resistor value?

@grumpy_mike I think I have bad MOSFETs.

It isn't like if I turn the LED on brighter I get moar power.

Well.....

Look up current transfer for an opto isolator.

Well...

It looks as if there are linear mode and digital mode for optoisolators. My error. I just assumed digital- if it is on, it is on. Who knew?

Since I'm clearly a Philistine, I'll just slam a bunch of current into the front end and make sure it's fully on. Lol.

Seriously though, would appreciate any suggested actual values for my resistors.

Edit: Since I haven't actually received any suggestions for resistor values, I'll ask again. What would be your suggested resistor values? TIA.

The answer is in post #6 of this thread... (5v - 1.2v) / .008a = 475 ohms. That's for the worst case of 50% CTR.

avr_fred:
The answer is in post #6 of this thread... (5v - 1.2v) / .008a = 475 ohms. That's for the worst case of 50% CTR.

I want to put a resistor between the output pin of the Arduino and the input of the PC817. I originally thought 220 ohm. I also would like a resistor between the output of the PC817 and the base of the TIP120. I originally though 1000 ohm.

I don't know for which resistor you are suggesting this value. I thought optoisolators were simple little on/off things and it turns out they are a bit more complicated.

And I don't know what the other resistor value would be.

The input side if an opto is simply an LED, so drive it like you would an LED. You have no need to put one on the output side, the current is limited by the current transfer you get.

Grumpy_Mike:
The input side if an opto is simply an LED, so drive it like you would an LED. You have no need to put one on the output side, the current is limited by the current transfer you get.

Well, that simply isn't helpful. Drive it like an LED? I proposed doing just that with a 220 ohm resistor and was told to recalculate that. I have a suggested 475 value now that I don't know where goes. Maybe in place of the 220. This is the first I've heard of the idea of no need for a resistor at all on the output side (and can't see that suggestion anywhere else on the Web).

Perhaps you could ELI5.

Well, that simply isn't helpful.

Please read this:-
How to use this forum

Specifically section 14
Maybe you would like to rephrase that response?

I have a suggested 475 value now that I don't know where goes.

It goes in series with the LED.

This is the first I've heard of the idea of no need for a resistor at all on the output side (and can't see that suggestion anywhere else on the Web).

Is that not your problem rather than mine?
An opto has a current transfer ratio, this means that the current out of an opto in inherently current limited to a specific value. Therefore their is no need for an extra current limiting resistor on the output transistor. But their is not much harm in putting one in as long as you understand what it is doing in your circuit.

This discussion is schematic-free; how curious.

Grumpy_Mike:
Maybe you would like to rephrase that response?

Nah, I think it was accurate.

But your subsequent response clarified things so thank you for that.

runaway_pancake:
This discussion is schematic-free; how curious.

Ok. Didn't really think it needed it but here is a very crude one.

![](http://<a target=)

">

Q1 is a TIP 120. The PC 817 is an optoisolator.

I have been looking for the values for R1 and R2. I thought 220 was good for R1 but 475 has now been suggested. I thought R2 needed to be about 1000, but it has been suggested the optoisolator is a current limiter and R2 is not needed. This was something I didn't know and has been my major lesson.

I would value your opinion.

"Please update your account to enable 3rd party hosting"

polymorph:
"Please update your account to enable 3rd party hosting"

They have apparently changed their polices.

Trying again.

Of course, after all that hosting problem I drew that backward. The solenoid is high side of the transistor. And there will be a diode on it