Transistor BJT as a Switch

This is an example of the most typical usage of a transistor in digital design. A Direct Current Load Switching Transistor is used to control the power of a load(like solenoid, motor, ...) when it need an amount of power that an IC chip isn't capable to provide, in terms of voltage & current. Take for example a DC Relay as load for a microcontroller, like the Panasonic JS1-5V-F(PCB type power relay). As we can see in the relay's data sheet, we need a current of \(\) to close the NO(Normally Open) contact(or for opening the Normally Closed one).
A microcontroller cannot provide this amount of current. A solution for this issue is to use a transistor driver that is capable to amplify the microcontroller's output voltage or current(or both), in particular, the common emitter amplifier connection with fixed bias, as follow.


Now we have to choose a transistor. There are thousands of different transistors to select from. So, we need to narrow our selection range.

  • Collector current \(\): The transistor must be able to provide enough current for the load. Our load requires \(\) in the worst case which is not critical and almost any transistor can provide this current.
  • Collector \(\) Emitter voltage \(\): The transistor must be able to switch \(\) across its collector & emitter leads.

There are typical low-cost transistor used for such low-current & low-voltage switching applications and BC337 is a safely choose for this application. Let's take a quick look at the transistor's characteristics:


First of all, the collector current. We want to provide \(\). Generally, always overpower this current requirement of at least 20%, so we want our transistor to be able to provide about \(\). As you see, the BC337 is able to provide up to \(\) (\(\)) which is more than enough. As for the voltage, we will power the transistor with \(\). Again overpower this value by 20%(\(\)). The BC337 can switch up to \(\) (\(\)) which again more than enough.

Now, we can calculate the value of the resistor connected to the base of the BC337. To do so, we start from the current that we need to provide. The relay requires at least \(\) but since our transistor can provide up to \(\), we can safely double the provided current. So we will run our calculations for \(\) collector current.


So, the base current is calculated by dividing the collector current by the current gain hybrid parameter. Each transistor has the \(\) range indicated in the datasheet. Here another piece of the datasheet for the BC337:


For \(\) the current gain varies from 100 to 300 because the hybrid parameters are not stable. For our calculations we will use the worst case scenario which corresponds to the lowest current gain, and that will be 100. So:


So we will calculate our resistor so that it provides at least \(\) into the base of the transistor and then:


From the last picture of the datasheet of the BC337 we have that \(\) is equal to \(\) in the worst case, and so:


Note: Hobbyist usually have only an \(\) series resistors, that have a \(\) of tollerance; In this case we have to choose between \(\) & \(\). Considering that we over estimate a lot the collector current, we can safely choose the \(\) value for \(\) resistor.

In the schematic, you can se the presence of a LED and a Diode. The LED is only used to indicate the state of the Relay; It's ON when the Relay is ON and viceversa. It's drived by the same current that control the relay (controlled by BJT transistor). We had over estimate the collector current and there isn' t the need to recalculate the value for a few tens of \(\).

The relay coil is an inductive load. As all inductive loads, when current runs though it builds a magnetic field. This field is maintained as long as current keeps running. But when we stop powering the coil, the energy that was stored in this magnetic field is then returned to the coil. The coil generates a voltage of high magnitude and reverse polarity. This voltage can potentially damage the transistor. Here is where the diode D1 becomes necessary. The energy will be dissipated by this diode as the reverse current will flow through it in a closed circuit with the coil itself protecting this way the transistor. This diode is generally called "flyback diode" or "freewheeling diode".

Best Regards, ecasa.

Graduate at the Faculty of Electronic Engineering of Bologna.
Posted in Electronics and tagged , , , .

Leave a Reply