I found a simple phototransistor circuit online(top-left):

I've combined this with a simple NPN transistor switch and I've got a working circuit. What I'm struggling with is the math and components.

Here's my circuit:

The phototransistor is a general purpose thing I bought and have no data on. It works as is, but I'd like it to be correct and optimal. The led it's lighting is a 3V 20mA ultrabright white led.

AFAIK:

180Ω is about correct to light this LED (please correct me if I'm wrong).

Shouldn't there be a base resistor on the switch? How do you calculate that value?

I've been trying to find results online, but can't seem to convince myself I've got it right. Here goes:

Min. hFE: 420

Ic = 20mA

Typ. Vbe: 660mV

Vs = 3.2V (Single 3V button cell)

My calculation (probably incorrect, but still):

[SIZE=+1]Ib = Ic / hFE = 20/420= 0.05mA

[/SIZE][SIZE=+1]Rb = (Vs-Vbe)/Ib = (3.2-0.6) / 0.05 = 52K?

[/SIZE]Is this calculation correct, or should I be put to pastures?

PS! R1 = 10K because that's what it said in the first schematic I found. The one I posted here says 4.7K

Hope someone might find a minute to guide me on the correct path.

Sincerely,

Geir Andersen