To control a lot of components, especially motors, physical devices or bright LEDs, you typically need to accommodate more current than your typical microcontroller can provide. Eric Wolf wrote a nice introduction for using transistors as a current amplifier to solve this common scenario.
In regard to current capability, generally speaking, most microcontrollers will only source around 20 mA or less (usually less) of current before you start running into problems. This is less than the amount of current used to power a super bright LED at maximum intensity (the ones I use run around 30 mA, a lot can run less). There comes a time in every man and woman’s life when they just need more power.
A Bipolar Junction Transistor has many different functions and applications in a circuit. It can be used in an amplifier configuration, a device to regulate the flow of current (think of a valve on a water pipe), or, in our case, a switch. For all intents and purposes, this “switch” can be referred to as a current amplifier.
If you want to control larger motors, you’ll probably need to use a device called a Darlington Pair, which is actually a combination of two transistors. These can be purchased as a single package component which simplifies the wiring a bit.
If you’re interested in controlling motors from a microprocessor, you might also want to check out an article I wrote about building an h-bridge circuit. An h-bridge is a simple circuit that you can build that will allow you to control a motor, both forwards and backwards, with the output on two IO pins. It uses a number of Darlington transistors in combination to both power the motor and to switch the direction of the current based on the input from the two IO pins. In my case, I used an h-bridge to control an RC car with a Basic Stamp microcontroller.
Use a Transistor as a Current Amplifier – Link
Control a Motor with an H-Bridge – Link