i want to build an optical grey shaft encoder i understand how to biuld most of it but was wondering if there is an advantage in using phototransistors over photodiodes? if so how would you go about wiring up a phototransistor as i have never used one before?
Phototransistors are more sensitive but slower, so it partly depends upon how fast your shaft rotates.
You connect a phototransistor similar to a photodiode with plus on the collector and minus on the emitter. Some have the base connection also available which can be used to adjust the sensitivity and speed by connecting a resistor from the base to emitter.