Thanks for the reply. I'm still a little confused. If the transistor is like a switch (on/off), isn't that just transmitting two values (0V or 5V)? I thought phototransistors varied their output based upon how much light they absorb (e.g. much more than two values)?
Okay, Now you want to know exactly what happens opposed to basically.
A transistor is a current controlled device.
Light falling on the base junction is analogous to transistor base current in a regular BJT.
The more light, the more base current, the more the transistor will turn on.
Transistors have something called Gain (HFE)
The amount of base current times the HFE gives the transistor collector current allowed to flow
(Ic = HFE * Ib) .
If the Gain/HFE of the transistor was 1,000,000, you should be able to see the transistor would allow a maximum amount of collector current flow for a small amount of base current.
If the Gain were 1 (one) the collector current would be little.
Most Phototransistors have high Gain.
Hence, think of the transistor as a switch, a small base current will allow a lot of collector current.
No base current or no light, no collector current.
If there was 5v across the 10k resistor, you would have Ic = 5v / 10k = 500uA of current flowing through it.
For this 5V across the 10k, let us say the Gain of the transistor was 1,000, this means the effective base current would be, Ib = Ic / 1000 = 5uA
5uA is a small amount of base current.
If the Gain were only 100 the base current would need to be 50uA, still a very small amount of current.
It should be pointed out that since the collector current is so small, the transistor can enter ‘saturation’ at very low base current level, Google transistor ‘saturation’.
If you vary the light carefully, you could effectively very the collector current hence give an analog variable input voltage to the input on the Arduino.
Thinking of a transistor as similar to a variable resistor is okay if it makes you comfortable.