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. 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 the base-emitter, the 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 microamps, 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 microamps), 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) 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.
The 555 timer module gives a variable frequency clock generator of square waves.
The frequency is varied through a potentiometer (VR!) and a set of four dip switch settings that change the capacitance, that allows for 10 HZ, 200 HZ, 5 KHZ and 50 KHZ.
By selecting dip switch 1 with the others set to off will allow the slower range of frequencies the sweeping (VR1) to its maximum will end that range.
For this test set up a bcc337 or similar and connect the 5v buzzer module to the collector of the transistor. Take a wire from the output of the clock and connect one end to a 1k resistor on Ledlabs and the other end to the base of the transistor, set the clock frequency quite high, say fully turned to the right with dip switch 1 positioned to on.
The buzzer can be heard beeping on and off at the clock frequency then move the wires up the range of resistors to 10k, there should be no noticeable change as it is in the range of 1k to 10k as set out by the equations above, so any of these values could be used for a base resistor, now to the next value of 22k and a noticeable change is heard in the switching, and the next value up 47k makes it fail as these two values fall out of the range calculated.