Output Pin Transistor Driver project

As a general rule of thumb, when using a transistor as a switch the base current should be 1/10 of the collector current, for example if 30mA is required to drive some load in the collector, say a large buzzer, then 3mA of base current would be required, this would be okay, particularly if it was been switched very fast.                                          If the base voltage is say 5v from a micro pin then the base resistor will be  Rb=(v-vbe)/ib=(5-0.7)/0.003=1433R for the base resistor,           so a 1.5k could be used here, using the general rule of thumb.                 Using calculations from the data sheet for a given transistor, the calculations would look something like this:                                                         Selecting a general purpose transistor, for example a bc337                     the bc337 transistors can handle up to around 800ma  of collector current so will be okay to drive anything up to this amount.   Here we want to drive a load current of 30ma  so from the data sheet for the bc337, the hfe or gain of the transistor is around 100 @ 100ma and as low as 60 for 300ma so for base resistor ib=ic/hfe = 0.03/100= 0.0003 A or 300 micro amps. As there is a 0.7v drop across base-emitter, our equation is  (5v-0.7) = 4.3v (we choose 100 for the gain as it is closer to the  current we are using here).
so.. (4.3)/(0.0003) = 14.3k ohms, we want to ensure the transistor is  in full saturation and operating as a switch, and not in its linear  region, we factor in a safety margin of at least half times this value  and have chosen a 6.8k resistor, this will ensure the transistor will  fully saturate and switch on.                                                                                     The 14.3k is a maximum value and due to worst case scenarios this is why we have halved the amount to make sure it is fully saturated, values used above this 14.3k can cause the transistor not to switch.

So the minimum amount of current required from the driver is 300 micro amps, looking at the relationship between the first calculation using the general rule of thumb Rb was 1433 ohms, and using specs from data sheet the resulting Rb was 14.3k ohms, a factor of 10 higher, this though is maximum value, and can be divided by 10 to use a 1.5k, so any range from say 1k to 10k should be okay.

Knowing the minimum base current required to drive the load from the above calculations (300 micro amps), is useful, because if the micro was driving other devices on other pins, the general source current goes down, per pin, and may not be able to continue to output say 10mA on this pin as there are other loads on different pins, (this is found on the data sheets for a given device/micro)               So, if a micro pin is limited by this, then a higher base resistor for the transistor can be selected other than the 1k, but below the 14.3k, as this will reduce the power consumed from the micro-controller itself. It is worth checking what a given output pin can source, because this base current set by Rb is being drawn from the micro’s pin.

A project for LedLabs using a standard 5 volt buzzer and a transistor and the 555 pulse circuit and on board resistors. Wire up this small circuit as illustrated,  the 555 timer is already on Led Labs, this will more or less prove the above. move up the range of resistors from 1k to 10k, all okay, then when 22k is selected a noticeable change is noticed in the buzzer sound and when 47k is used it does not work as these are outside the calculated values.( don’t use the spare buzzer on board as this is wired to ground on some earlier boards).                       A separate transistor and and buzzer is required for this experiment if using an earlier ledlab board.

(Where the base resistor of the 1k for the transistor  is shown in the diagram, simply substitute this by using clock out and wiring it to the different resistor values in the resistor bank, and then to the base of the transistor).