An op-amp may not be needed to measure phototransistor output with a microcontroller.
A microcontroller can dynamically change a digital input-output pin to one of three states:
- tristate (high-impedance)
Any microcontroller is adept at measuring time (using an internal counter). The time taken to charge or to discharge a capacitor is measured. Charge/discharge time is inversely proportional to phototransistor current.
First, the capacitor is charged up to the microcontroller's DC supply voltage by setting the I/O pin to output a logic 1.
Then the I/O pin is switched to input, and the internal counter is started.
Once the I/O pin reaches a logic low state, the counter is stopped. It now contains a count value inversely proportional to light level.
simulate this circuit – Schematic created using CircuitLab
The I/O pin could be polled in a tight loop, or it could generate an interrupt-on-change. You're looking for that high-to-low transition. It is a good idea to also be able to terminate this process should the counter overflow....if there is NO light, the high-to-low transition may never occur. This method can be used with almost any microcontroller - even one with no internal analog-to-digital converter.
The capacitor can take on a smaller or larger value, depending on how much light the phototransistor sees. A small-value capacitor can detect candle-light. A large value is better for sunlight.
This light-measuring process does take some time and is not appropriate for rapidly changing light sources like photo-flash. However, it is more linear than using a photo-resistor. The threshold voltage of a digital I/O pin is not greatly dependable - linearity of this light measuring method can be improved by using an analog voltage comparator to detect the high-to-low transition voltage: many microcontrollers include one (like Arduino).