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.

Non Inverting Operational Amplifier


In this configuration, the input voltage signal, \(\) is applied directly to the non-inverting (+) input terminal(Pin 3 of OPA336) which means that the output gain of the amplifier becomes positive.
Feedback control of the non inverting operational amplifier is achieved by applying a small part of the output voltage signal back to the inverting (-) input terminal via \(\) voltage divider network, again producing negative feedback. This closed-loop configuration produces a non-inverting amplifier circuit with very good stability, a very high input impedance \(\) approaching infinity(in ideal conditions no current flows into the positive input terminal) and a low output impedance \(\) (\(\) in ideal conditions).

For an ideal Operational Amplifier no current flows into the input terminal and then, the potential of inverting terminal \(\) is always equal to the non-inverting\(\) one. \(\) & \(\) form a simple potential divider network across the Op-Amp with the voltage gain of the circuit being determined by the ratios of \(\) and \(\).

Then using the formula to calculate the output voltage of a potential divider network, we can calculate the closed loop voltage gain \(\) of the non-inverting amplifier as follows:

\(\) and for the Ideal Summing Point, we have \(\). The voltage gain is equal to \(\) and combinig the previus equations we get:


We can see from the equation above, that the overall closed-loop gain of a non-inverting amplifier will always be greater but never less than one, it is positive in nature and is determined by the ratio of the values of \(\) and \(\).
If the value of the feedback resistor \(\) is zero, the gain of the amplifier will be exactly equal to one. If resistor \(\) is zero, the gain will approach infinity, but in practice it will be limited to the operational amplifiers open-loop differential gain, \(\).

Best regards, ecasa.