NPN resistor selection - Clarification!

Hey,
I have been browsing around the web a little and have just gotten myself more and more confused as I delve in to the maths behind resistor selection for transistors...

I am using an 2N222A - used a multimeter and got an hfe of 200.

Am I right in assuming that means (up to the max base current...which from this looks like its around 100ma : NPN Transistors - PNP Transistors) will allow 200x the amount of current to flow from collector through the emitter?

For example, if I had some LEDs rated at 3.1v 20mA (so around 12ma at 5v for same power) and wired up this circuit...would this be a "mathematically" perfect wiring up?

Worked from:
Current needed (Ib) = 12mA/hfe = 12/200 = 0.06mA (6E-5A)
Resistor required at base = 5/6E-5 = 8333ohms (approx 10k ohms).

Just when I measure the current though the collector-emitter it comes out as 70ma approx...
In the ball park but what am I doing wrong?

Dropbox - Error - Simplify your life (Circuit diagram).

Ah hold on....this could be my rusty maths...

You're right, but:

a) There's a lot of variation between individual transistors. 100 is only "typical".

b) There's no need to bother with the calculation because all you want is to make sure it's fully open. Use a 330 Ohm resistor.

Johnny010:
Resistor required at base = 5/6E-5 = 8333ohms (approx 10k ohms).

This voltage drop won't be 5V, there's some drop from B to E.

hfe varies considerably with current. The datasheet should list some values for different voltage/current combinations.

Here's what I do:
I figure the Vbe will be ~0.7V, i.e. one diode drop from base to emitter, and emitter will be connected to Gnd, with collector to cathode of LED to sink current.
I want the transistor to turn on hard - so make the base current big, like 20mA.
With Arduino output at 5V, then (5V - 0.7V)/20mA = 215 ohm, so use a 220.
Then the LED current will be limited by the current limit resistor, and the transistor will let flow whatever the resistor allows, so it acts more like a switch and less like a linear device, which is where hfe really comes into play.
If the LED is powered from 5V, and the drop across the transistor is 0.5V:
(5V - (Vf of LED) - (Vce of transistor) )/current flow = current limit resistor
Say 2.2V for Vf and 0.5 for Vce:
(5V - 2.2V - 0.5V)/20mA = 115 ohm, so use 120
In reality, there is some variation in all the numbers:
5V might be as low as 4.2V, resistor might have 5% tolerance, LED might have some range depending on temperature, transistor may vary depending on current flow, with lower Vce at lower currents; you would (in industry) take the worst case collection and design for those: 5V, low end of LED Vf, low end of resistance value, low end of transistor Vce. Then any that move away from those would only serve to reduce the current flow and not fry the LED.

Current thru LED/resistor/transistor =
(Vs - Vf - Vce)/400 = A
Vs shown as 4.7V, assume 2.2V (typical for red) and 0.7V (look up 2N2222A datasheet, might be lower, and/or vary by manufacturer):
(4.7 - 2.2 - 0.7)/400 = 4.5mA