Transistor Circuit Help

Thread Starter

smartpoints

Joined Mar 10, 2008
7
Hi, I am working to create a circuit In which I can control a light using my computer's parallel port; however, I am having trouble getting my transistor to work properly.

Circuit Diagram:


I have preformed the following tests with my voltage meter. Note that the junctions described are notated on the circuit in green text. For reference, the parallel port provides an output of 6.2v when set to high, and 0.11 when set to low.
  • Port On; Point 4 (6.2v); Point 2 (12v); Point 1 (7.93v)
  • Port Off; Point 4 (0.11v); Point 2 (12v); Point 1 (4.92v)

I need to expand this range of voltages to the relay coil in both directions. The voltage needs to be higher to trip the relay, and needs to be less (the coil remains tripped at 5v) to deactivate it.

How can I expand the range of this transistor. I thought initially that it might have to do with my resistor. If so, what value resistor should I use?

Thanks for your help.
 

SgtWookie

Joined Jul 17, 2007
22,230
Replace your PNP 2N3906 with an NPN type 2N2222A or (preferably) 2N4401.
With the NPN transistor, the emitter needs to be on ground, and the collector to the ground side of the relay's coil.

You would be better off using a Darlington pair like a TIP120. However, you could make your own Darlington pair using a couple of NPN transistors.

A 2N3904 would not carry enough current; neither would your 2N3906. Automotive relays usually require around 250mA; the 2N3904/3906 can handle that only for a short period of time.
 

Thread Starter

smartpoints

Joined Mar 10, 2008
7
I'm trying to build this circuit using parts that I already have. I also have the following transistors.
2N404, 4124, 2907's, M644

Would it be possible to build this circuit using any of those.

I also understand that most of those are PNP. The ones suggested were NPN. What is the distinction and why does this affect the circuit?
 

Ron H

Joined Apr 14, 2005
7,063
I'm trying to build this circuit using parts that I already have. I also have the following transistors.
2N404, 4124, 2907's, M644

Would it be possible to build this circuit using any of those.

I also understand that most of those are PNP. The ones suggested were NPN. What is the distinction and why does this affect the circuit?
You can do it as below. The 2N2907 is the only transistor you have that can handle the current required by the relay coil, but it needs to be run in common emitter mode, as below. The NPN level shifts your parallel port signal to drive the base of the PNP.
Your original schematic was using the transistor in common collector mode, also known as an emitter follower. This will replicate the input voltage swing, but with a 0.7V offset. It is basically a current amplifier, but it has no voltage gain, so it will not reliably switch a 12V relay with a 5V signal (not sure how you are getting 6.2V from your parallel port).
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
The 2N404 is a germanium PNP of ancient design and low power handling capabilities.
It wouldn't work.
The 2N2907 is PNP, but will handle 600mA.
The 2N4124 is NPN, but is limited to 200mA.
With a quick search, I couldn't find a datasheet for the M644 - are you sure that's right?

Anyway, see the attached. I had to go through a few iterations to make what you had fit your needs. As it is, the 2N4124 will be sinking 80mA just to turn on the 2N2907. This is certainly not an optimal design by any means; simply one that works with what you have on hand.

One of the big limiting factors to success here is that you have very little in the way of output from the parallel port. Decreasing the size of the 4.7k resistor isn't really an option, as you must protect the port. This limits your control output from about 0.8V to around 2.8V (TTL levels) at very low current.

Using NPN transistors, your output can be amplified by the hFE of the transistor and you can sink the load of the relay's coil. If you go with a Darlington pair configuration using a couple of transistors, the hFE of one multiplies the hFE of the 2nd transistor; thus you can control a large amount of current with a very small amount input. In the case of using NPNs with this project, all of the current sunk will pass through the coil to trip the relay, which is useful energy.

But in this case, we have to use R2 (see attached) to hold the base of Q2, the 2n2907 PNP transistor high so that it doesn't conduct. Q1, which is driven by the parallel port, must sink enough current to pull Q2's base low in order to cause it to conduct. The current sunk by Q1 does no useful work other than to turn on Q2.

Your Mileage May Vary. You may need to adjust the value of R2 somewhat to get it to work properly. Use Ohm's Law to ensure that you don't exceed the maximum current that the 2N4124 can sink (200mA). If you can get it to work reliably with a somewhat higher resistance (the SPICE simulation says no) then go with it. The hFE and performance of transistors varies widely even within the same batch, let alone from manufacturer to manufacturer. All they will do is guarantee minimums.
 

Attachments

Thread Starter

smartpoints

Joined Mar 10, 2008
7
Wow, your post was extremely useful. However, my supplies are limited and the closest resistor I could find was 470 for R2. I am unfamiliar with how to use the Ohms law to calculate if this will be enough or too much to make the circuit function properly. Can you help?
 

SgtWookie

Joined Jul 17, 2007
22,230
If you have two 470 Ohm resistors, and connect them in parallel, you'll wind up with 235 Ohms, which should be close enough.

My simulation indicated problems with resistances exceeding 270 Ohms. If you go below 60 Ohms, you will exceed the current handling capabilities of Q1, so that's your absolute floor. Besides, the lower that resistance, the more power you are wasting in heat.

You might try Ron_H's schematic - as he was kind enough to model it for you.

Resistance in parallel:
If there are only two and they are equal: Rtot = (R1+R2) / 2
If the two are not equal: Rtot = (R1 x R2) / (R1 + R2)
More than two: Rtot = 1/ (1/R1 + 1/R2 + ... 1/Rn)
Check: the total resistance of a network of resistors in parallel will always be lower than the smallest value of resistance.

Helpful hint:
Capacitors in series are calculated the same way that resistors are in parallel.
Capacitors in parallel are calculated the same way that resistors are in series.
 

Ron H

Joined Apr 14, 2005
7,063
If you have two 470 Ohm resistors, and connect them in parallel, you'll wind up with 235 Ohms, which should be close enough.

My simulation indicated problems with resistances exceeding 270 Ohms. If you go below 60 Ohms, you will exceed the current handling capabilities of Q1, so that's your absolute floor. Besides, the lower that resistance, the more power you are wasting in heat.

You might try Ron_H's schematic - as he was kind enough to model it for you.
Sarge, you need a current limiting resistor between the PNP base and the NPN collector. As is, one or both trannies will be destroyed. You don't need a low value resistor from base to emitter. That was a requirement of germaniums, but silicon has such low leakage that you can completely omit that resistor for transistors that are not running hot, although I wouldn't recommend it. A small-value resistor basically helps clean out the excess base charge of a saturated transistor, allowing it to turn off faster.
My circuit was designed for a 150mA nominal coil current. If the coil requires higher current, a conservative designer would decrease the value of R2 (in my circuit), to keep the forced beta (Ic/Ib) of the PNP at about 10. I think the 2N4124 has high enough beta that the extra collector current can be supported by the base drive shown.
 

SgtWookie

Joined Jul 17, 2007
22,230
Ron_H,
Plan on the coil of the relay to require in the vicinity of 350mA. Could you plug that into your model, and re-post?

I really need to use LTSpice more - but haven't had the time to set up all of the models yet.
 

Ron H

Joined Apr 14, 2005
7,063
Ron_H,
Plan on the coil of the relay to require in the vicinity of 350mA. Could you plug that into your model, and re-post?

I really need to use LTSpice more - but haven't had the time to set up all of the models yet.
Sarge, I looked a a bunch of 30A automotive relays, and the highest current requirement I could find was 160mA. Can you reference one that requires 350mA?

http://www.allelectronics.com/cgi-bin/category.cgi?item=RLY-351&type=
http://catalog.tycoelectronics.com/...280,119286,121141,115673,119568,119569,119570
http://www.fujitsu.com/us/news/pr/fcai_20080204-01.html
http://www.hascorelays.com/electro_30_amp_car_series.asp
 

SgtWookie

Joined Jul 17, 2007
22,230
Well, someone posted the other day about an automotive relay that needed in the vicinity of 250mA to pull in the contacts. I was planning on the OP's coil to require in the vicinity of 300-350mA to be reliable.

If in fact it can be pulled in with less than 200mA, the OP would be better off using the NPN transistor (2N4124, I think) to sink the current from the coil, as it can handle up to 200mA. Better if the OP has a couple of them they can use in a Darlington configuration - but I'm not sure if they have more than one of the previously listed transistors available.
 

Ron H

Joined Apr 14, 2005
7,063
Well, someone posted the other day about an automotive relay that needed in the vicinity of 250mA to pull in the contacts. I was planning on the OP's coil to require in the vicinity of 300-350mA to be reliable.

If in fact it can be pulled in with less than 200mA, the OP would be better off using the NPN transistor (2N4124, I think) to sink the current from the coil, as it can handle up to 200mA. Better if the OP has a couple of them they can use in a Darlington configuration - but I'm not sure if they have more than one of the previously listed transistors available.
But if you look at the curves on the 2N4124 datasheet, it is only spec'ed to Ic=100mA, and Vce(sat) is soaring at that point. It would probably be OK, but I don't like to extrapolate curves. I think I would still be happier with the NPN/PNP, although a Darlington NPN would require about 10% less current from the supply. I don't think he could get enough base drive from the parallel port to get by without either a Darlington, or two cascaded common-emitter NPN stages (which is less efficient).
 

Thread Starter

smartpoints

Joined Mar 10, 2008
7
So will SgtWookie's original circuit work properly, because I have the parts to build it. If it wouldn't, is there any way to make it work using only the transistors and resistors that I already have?
 

Ron H

Joined Apr 14, 2005
7,063
So will SgtWookie's original circuit work properly, because I have the parts to build it. If it wouldn't, is there any way to make it work using only the transistors and resistors that I already have?
No, it won't. There is a resistor missing. What resistor values do you have on hand?
 

SgtWookie

Joined Jul 17, 2007
22,230
Ron_H has tested his simulation using LTSpice, which is a really good (and free!) program.

His version didn't work in the simulator I tried it in, but CircuitMaker has been out of support for a number of years, and the models may not be that accurate. I really need to get out of the habit of using it. :p

In his circuit, he's reduced the current limiting resistor from the parallel port from 4.7k to 2.7k. That gives much more drive current to Q1. I don't know what he used for a signal input, as it is not shown on his simulation's schematic.

In my simulation, I used 0.8v for a "low" output and 2.8v for a "high" output. If you measure differently, you should let us know. I retained the 4.7k resistor you have shown previously.

I made an addition to my simulation; a 220 Ohm resistor that limits collector current through Q1 to about 50mA.

Ron_H,
Interesting that they rate the 2N4124 transistor for 200mA maximum continuous collector current, but don't give plot data past 100mA.
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
Now that I've re-read your 1st post, I see you actually DID say what signal levels were on the port. I missed that. It makes quite a difference in the simulation if one is using the correct control voltages :rolleyes:

Now that I'm actually using the correct control voltage, the values Ron_H provided in his circuit also works in the simulation software I was using, including using a 4.7k limiting resistor from your parallel port output.

Now the maximum collector current through Q1 will be about 16mA; much better.

If you don't have those exact resistor values on hand, post what you DO have - or figure out series/parallel combinations of resistors to get within 20% of the values in the schematic.
 

Attachments

Audioguru

Joined Dec 20, 2007
11,248
Most transistors have a max allowed collector current that is higher than what is pracical in a circuit.
A 2N3055 power transistor has a max allowed collector current of 15A. But the highest current for the hFE spec is 10A where the minimum hFE is only 5.0. The max saturation voltage loss of 3V is also spec'd at 10A when the base current is a whopping 3.3A.
 

Thread Starter

smartpoints

Joined Mar 10, 2008
7
CORRECTION: It appears that when I initially measured the voltage of the parallel port, there was interference from the transistor or something along those lines that lead to a high value. The real value of the isolated parallel port is 4.8v high and 0.04v low.

And for the record, these are the parts I have right now.

2 460 resistors
1 4.7k resistor
3 2907 Transistors (I am not certain that this IS a 2N2907. On the physical chip it says ITT 2907, however ITT could be the production company.)
1 2N3906 Transistor
1 2N4124 Transistor
4 1k resistors

Again, the equipment I'm dealing with
4.8v high, 0.04v low out of the parallel port
12v power supply
12v 30A Automotive Relay

Thanks for the help.
I might be able to scrounge for a few spare resistors in old electronics if necessary, but those transistors are pretty much all i've got. I'm trying to do this project on a 0$ budget.

One more thing:

|
|_ _ _ _ _
|............|
|...........1k
1k..........|
|...........1k
|_ _ _ _ _|
|
|

That arrangement yields 667 ohms and could be used in place of the 680 reisistor, correct?
(I know its awefully ghetto, but its what i've got :) )
 
Top