Maker Pro
Maker Pro

basic transistor switch with input from parallell por( i know it's been discussed) but i need help

A

aiwarrior

Jan 1, 1970
0
Hi im near the point of giving up of trying to learn electronics...
My problem is that i cant switch a relay with my parallell port trough
a transistor.

The design is basic and calculum too..and i wander whats wrong. Please
tell me what am i doing wrong so i can get back on track :D

Transistor 2N2222a :
Vbe = 0.7V
Vce sat = 0.3V
hfe = 10
Icmax = 500mA
Vcemax=100V

Relay:
Rr = 426ohm
Vturn on= 12V

Parallell port:
Vcc= 3.4V

I_bsat= 50e-3 / 10 = 5mA
Rb = (Ve- VbeSat) / I_bsat = (3.40 - 0.3) / 5e-3 = 3.1 / 5e-3 = 620
ohm
+12V
|
relay
|
c
+3.40V -----Rb----b 2n2222a
| e
| |
---- -----
-- --
Please if you think the answer is to obvious bother to reply
 
P

PeteS

Jan 1, 1970
0
aiwarrior said:
Hi im near the point of giving up of trying to learn electronics...
My problem is that i cant switch a relay with my parallell port trough
a transistor.

The design is basic and calculum too..and i wander whats wrong. Please
tell me what am i doing wrong so i can get back on track :D

Transistor 2N2222a :
Vbe = 0.7V
Vce sat = 0.3V
hfe = 10
Icmax = 500mA
Vcemax=100V

Relay:
Rr = 426ohm
Vturn on= 12V

Parallell port:
Vcc= 3.4V

I_bsat= 50e-3 / 10 = 5mA
Rb = (Ve- VbeSat) / I_bsat = (3.40 - 0.3) / 5e-3 = 3.1 / 5e-3 = 620
ohm
+12V
|
relay
|
c
+3.40V -----Rb----b 2n2222a
| e
| |
---- -----
-- --
Please if you think the answer is to obvious bother to reply

The obvious first thing you need is a diode (a 1N400x would be good)
across the relay coil - Anode to the collector, cathode to +12V.
Without that, the first time the relay operates, you'll fry the
transistor.

Second, you say the relay has V(turn on) = 12V. If it really does need
12V to turn on, then given manufacturing spread it might not ever turn
on in this circuit. Get one rated at 5V (min). It won't hurt it to run
at 12V (but check the data sheet), and it'll have lower current
requirements into the bargain.

The base resistor should be sized as [V(o) - Vbe(sat)] / Ib(sat).
Without knowing the parameters of the parallel port, (in particular
it's Vout vs. Iout characteristics) it's hard to size properly, but
I'll assume 3V @ 5mA (easily sufficient for this application) as Ic
will be about 30mA
->
(3V - 0.8V) / 5E-3 -> 440. I would use a 470 ohm resistor here -
standard value.
Note the Vbe(sat) term - it'll be about 0.7 - 0.8V (temperature
dependent at -2.1mV/degree C). It could be lower as the device heats
up, although in this case I wouldn't worry about it (about 5-6mW being
dissipated by the transistor in the ON condition).

I don't see much else.

Cheers

PeteS
 
J

John Popelish

Jan 1, 1970
0
aiwarrior said:
Hi im near the point of giving up of trying to learn electronics...
My problem is that i cant switch a relay with my parallell port trough
a transistor.

The design is basic and calculum too..and i wander whats wrong. Please
tell me what am i doing wrong so i can get back on track :D

Transistor 2N2222a :
Vbe = 0.7V
Vce sat = 0.3V
hfe = 10
Icmax = 500mA
Vcemax=100V

Relay:
Rr = 426ohm
Vturn on= 12V

So required coil current is 12/426= 28mA
Parallell port:
Vcc= 3.4V

At what current? For some parallel ports, this can be a very low value.
I_bsat= 50e-3 / 10 = 5mA

Given the coil current of 28 mA, I think this is generous.
Rb = (Ve- VbeSat) / I_bsat = (3.40 - 0.3) / 5e-3 = 3.1 / 5e-3 = 620
ohm

You are applying the value of VceSat as VbeSat. VbeSat would be more
like .7V.
+12V
|
relay
|
c
+3.40V -----Rb----b 2n2222a
| e
| |
---- -----
-- --
Please if you think the answer is to obvious bother to reply

Even with your small errors, I am surprised this circuit does not
drive your relay. Have you a volt meter to check what voltage the
parallel port is producing while loaded with this circuit? Are you
confident you have the transistor leads correctly identified? Posting
the voltages at all the nodes for both the intended on and off state
would be helpful.

By the way, the relay coil will produce a large voltage pulse when the
transistor switches off (same principle as an ignition coil), so you
might suppress this by adding a small diode in parallel with the coil,
cathode to the +12 supply end.
 
S

Si Ballenger

Jan 1, 1970
0
Hi im near the point of giving up of trying to learn electronics...
My problem is that i cant switch a relay with my parallell port trough
a transistor.

The design is basic and calculum too..and i wander whats wrong. Please
tell me what am i doing wrong so i can get back on track :D

Transistor 2N2222a :
Vbe = 0.7V
Vce sat = 0.3V
hfe = 10
Icmax = 500mA
Vcemax=100V

Relay:
Rr = 426ohm
Vturn on= 12V

Parallell port:
Vcc= 3.4V

I_bsat= 50e-3 / 10 = 5mA
Rb = (Ve- VbeSat) / I_bsat = (3.40 - 0.3) / 5e-3 = 3.1 / 5e-3 = 620
ohm
+12V
|
relay
|
c
+3.40V -----Rb----b 2n2222a
| e
| |
---- -----
-- --
Please if you think the answer is to obvious bother to reply

Compare your setup to the schematic in the below PDF file. Also
test your setup using a couple of batterys instead of the
parallel port pins to see if it works that way.

http://lib.store.yahoo.net/lib/webtronics/kit74.pdf
 
J

John Popelish

Jan 1, 1970
0
PeteS wrote:
(snip)
Second, you say the relay has V(turn on) = 12V. If it really does need
12V to turn on, then given manufacturing spread it might not ever turn
on in this circuit. Get one rated at 5V (min). It won't hurt it to run
at 12V (but check the data sheet), and it'll have lower current
requirements into the bargain.
(snip)

I have to argue with both these points. A typical 5 volt relay coil
will badly overheat when driven with 12 volts ( (12/5)^2 = 5.7 times
its normal temperature rise). And relays of similar size typically
have an approximately constant coil power requirement, over a wide
range of coil voltages. So a 5 volt coil may need 15/5 times as much
current.
 
P

PeteS

Jan 1, 1970
0
John said:
PeteS wrote:
(snip)
(snip)

I have to argue with both these points. A typical 5 volt relay coil
will badly overheat when driven with 12 volts ( (12/5)^2 = 5.7 times
its normal temperature rise). And relays of similar size typically
have an approximately constant coil power requirement, over a wide
range of coil voltages. So a 5 volt coil may need 15/5 times as much
current.

That's why I said 'check the datasheet'. Some relays will be ok, some
won't. Some have built-in diodes, some don't.

FWIW, I have a list of relays that are fine with up to 24V, and operate
at about 5V. There's also a difference between a '5V' relay (that may
operate at about 3V) and one that has an operational switching point of
5V. Another point to keep in mind is that relays typically have
significant hysteresis which has to be accounted for. Most '5V' relays
will switch properly on a 5V supply, but it's always wise to check the
datasheet.

So our disagreement (if such it is) is perhaps because I didn't spell
out complete answers - but then, I like the OPs to do a little digging
and read *all* the words :)

Cheers

PeteS
 
J

John Fields

Jan 1, 1970
0
That's why I said 'check the datasheet'. Some relays will be ok, some
won't. Some have built-in diodes, some don't.

---
I disagree.

General-purpose relays are usually designed for "must pick up" at
about 75% of their rated coil voltage and "must release" at about
10%. That means that as the voltage on the coil of an unoperated
relay is increased, all of the contacts must transfer at or below
3.75V, and as the voltage is lowered the contacts must release at or
higher than 0.5V

Also, maximum coil voltages are usually specified as ~ 125% of
nominal.
---
FWIW, I have a list of relays that are fine with up to 24V, and operate
at about 5V.

---
Got some part numbers?
---
There's also a difference between a '5V' relay (that may
operate at about 3V) and one that has an operational switching point of
5V.

---
That's gobbledeegook, unless you're talking about a relay designed
to switch at a precise voltage, which isn't what the OP's worried
about.
---
Another point to keep in mind is that relays typically have
significant hysteresis which has to be accounted for.

---
Why? As long as you turn them on with their rated voltage and turn
them off by disconnecting that voltage, they'll always work.
---
Most '5V' relays
will switch properly on a 5V supply, but it's always wise to check the
datasheet.

---
LOL, if they're 5V relays and they're not broken, they'll _all_ work
properly on a 5V supply. Show me _one_ that won't, OK?
---
So our disagreement (if such it is) is perhaps because I didn't spell
out complete answers - but then, I like the OPs to do a little digging
and read *all* the words :)

---
So, you trip and blame the OP, huh? :)



Here's what he _ought_ to be doing:



+12V>----+-------+
|K | O------C
[DIODE] [COIL]- - -|
| | O--> |<--O--NC
+-------+ |
| +-----------NO
R1 C
VIN>--[2k7R]---B 2N2222
E
|
GND>-------------+

Since a 2N2222's got a beta of around 200 with 28mA (the relay
current) through it, and assuming that Vin is going to be 3.4V
minimum when it's hot means that if we force beta to 28 we can
switch the relay with 1mA of base current. To get there we say:


Vin - Vbe(sat) 3.4V - 0.7V
R1 = --------------- = ------------- = 2700 ohms
Iin 0.001A


and that ought to work.
 
E

ehsjr

Jan 1, 1970
0
aiwarrior said:
Hi im near the point of giving up of trying to learn electronics...
My problem is that i cant switch a relay with my parallell port trough
a transistor.

The design is basic and calculum too..and i wander whats wrong. Please
tell me what am i doing wrong so i can get back on track :D

Transistor 2N2222a :
Vbe = 0.7V
Vce sat = 0.3V
hfe = 10
Icmax = 500mA
Vcemax=100V

Relay:
Rr = 426ohm
Vturn on= 12V

Parallell port:
Vcc= 3.4V

I_bsat= 50e-3 / 10 = 5mA
Rb = (Ve- VbeSat) / I_bsat = (3.40 - 0.3) / 5e-3 = 3.1 / 5e-3 = 620
ohm
+12V
|
relay
|
c
+3.40V -----Rb----b 2n2222a
| e
| |
---- -----
-- --
Please if you think the answer is to obvious bother to reply

Your circuit is fine, except that you need a diode
across the relay coil, with the banded end connected
to the + side. (That is not the reason it doesn't
work, but you definitely want that diode in there.)
John Fields pointed out that the base resistor could
be a higher value. A good idea, but again not mandatory
to get your circuit to work.

I think John Popelish mentioned this: you may have the
leads of the transistor connected to the wrong place.
That would prevent it from working. One other point - the
ground of the computer and the ground of the 12 volt supply
*must* be connected together. If they are not connected,
it won't work.

Ed
 
Top