Continue to Site

# Is this how a transistor amplifies current?

Status
Not open for further replies.

#### New2PIC

##### New Member
I've been reading a variety of books and I'm trying to apply some basic electronics information to a breadboard circuit. The setup: A PIC microcontroller sets an output pin to high. A 100 ohm resistor is between the PIC and the transistor (see diagram).I use a resistor to increase the voltage enough to turn on the transistor (2V to 6V). I then allow the emitter and collector to pass electrons, which allows current to flow across the emitter and collector from the battery. I put the relay along the wire which is flowing electrons with the 5V potential of the battery and the battery supplies the current to turn on the relay (see diagram).

When I build this circuit the transistor collector cycles from 5V to 2.5V as the PIC output pin goes from high to low (PIC output changes every 300ms or so), which I believe is a good sign. There's 82mA of current across the diode, which should be enough current for the relay. I hear faint clicking noises from the relay, but when I measure the resistance change on the relay, the relay isn't switching.

Please let me know if I don't understand how to properly setup the transistor or if there's a component I'm missing. I enjoy being able to practice ohms law and calculate currents, so any explainations that tell me how and why I should change my setup would be very appreciated.

#### Attachments

• transistor_setup.JPG
23.2 KB · Views: 831
What is the beta of the NPN transistor ? The specs in the schemy are just max tolerance voltages, is there something written on the transistor so we can look up the data sheet (s) ?

If the relay coil draws 89.3mA @ 5 volts , the coil has a resistance of,

R = V/I
= 5/.0893
= 56 ohms

Collector current = beta x base current but if you are reading a base current of 20mA i'd think that should be sufficient for saturation, most TO92 transistors have atleast a beta of 100 units.
Faulty relay maybe ?

I changed the resistor from 100 ohm to 67 ohm and the relay now switches fully. The transistor I'm currently using is a TO-92 case, 2N3904 NPN silicon.

Thanks for the post. On the transistor package the Hfe(min) is 100. Perhaps that the beta that I multiply the base current by to get the collector current?

On the transistor package the Hfe(min) is 100. Perhaps that the beta that I multiply the base current by to get the collector current?

Yep, well actually that would be the minimum, to insure saturation especially at different temperatures its a good practice to use a base resistor thats about 1/10 the value calculated.

Relay driver

You don't need the diode in series with the relay, but there should be one across the relay coil in order to protect the transistor from the back EMF when the transistor turns off.

I presume the transistor is going into avalanche breakdown but is not sufficiently stress to fail.

The diode should be connected with the cathode to the 5V supply and the anode to the collector.
This will increase the release time of the relay a little, but I expect that will not be a problem. If it is, insert a 390 Ohm resistor is series with the diode.

Len

diode placement

In thinking about the function of a diode, that it only allows the electrons to flow in one direction, if I want to stop electrons from surging from the relay coil to the transistor, it makes sense to me to put the diode in series in the relay to transistor connection. I don't see the advantage of placing the diode across the relay coil instead of between the transistor and relay. If I were to place the diode across the metal relay coil, the electrons could travel around the diode by going through the coil. What do the experts think?

#### Attachments

• tran_protector.JPG
15 KB · Views: 740
I have to agree with Len . The diode should be placed in parallel with the relay coil and in reverse polarity to shunt CEMF voltage spikes, generated from switching the relay coil, away from the controlling electronics. If the diode is placed in series with the transistor the only protection you have is the reverse break down voltage of the diode.

Hello new2PIC,

From your original drawing I would want to suspect that the transistor has gone 'caput'!
I gather that the PIC switches the relay ON and OFF repeatedly. It only takes a few of these without the spark protection diode across the relay coil to damage the transistor. The weak clicking of the relay may be caused by this. Suggest you check the transistor before going further. I have recently used a 12V relay in a similar circuit (with the diode correctly placed of course) being driven by an output pin from a 16f84 PIC with 9V to the transistor, 2n2222, and it works fine.
Never, never, use a bipolar transistor to operate a relay coil (or any inductive load) without the spark quench diode. The back e.m.f will very quickly kill the transistor. The relay coil could be put in the emitter line from the transistor, in which case you connect the diode cathode to the collector and the anode to ground (for NPN), the other way for PNP.

Good Luck

Trini

There are few thinkg to check. First of all you are overloading your PIC output. Try replacing resistor for higher value so PIC output current
is less than 20mA. Suggestions to put diode accross relay coil are valid.
Without diode, you might have transistor that turns on but dies painfully
when it tries to turn off.
I cannot think of small transistor with hfe less than 30-50 so transistor should be turned fully on even with much lower base current
(resistor value 1k for example). For example if your relay draws 80mA
and you want to make sure that transistor is turned fully on (say 200mA
max) and the gain is for example 25, than base current to do this should be 200mA/25=8mA. you can check this when transistor is on, just measure voltage accross collector and emiter. It should be less than 0.2Volt. If you get this, than it is not the transistor problem, it could be
that relay you have is not intended for 5V circuits.
If you see something like 1-2Volt, you might want to try darlington transistor or equivalent circuit like :

#### Attachments

• pic_433.gif
9.8 KB · Views: 730
Thanks for everyone's input.

Diode placement

You don't appear to understand inductance. The "Ohm's law" of inductance is v = L di/dt, where v is the voltage across the inductor and i is the current throught it. di/dt is the rate of change of that current.

If the circuit is opened without anywhere for the current to go (eg. a diode across the coil), the rate of change of current (and hence the voltage) is infinite (in theory), in practice, it will depend on stray capacitance and in your case, the transistor will go into avalanche breakdown which may destroy it if the chip heats up to a dangerous level.

Incidentally, why are you using the common collector configuration? This means that the relay does not receive the full supply voltage. If you used the common emitter configuration, most of the supply voltage would be applied to the relay coil.

Status
Not open for further replies.