Electronic – Understanding voltage and current of a phototransistor w/ collector resistor

infraredphototransistor

I want to study the circuit of an Infrared proximity sensor, so I assembled a circuit with an infrared LED (940nm) and a phototransistor.

Schematic showing a IR LED beside a NPN phototransistor with 10kOhm collector resistor and "Q" at the collector

When no current passes from the LED, obviously the phototransistor is switched Off, thus the whole amount of current passes from the A0 branch. In that case I read from A0 a 1023 value which is equal to 5V for a 10bit ADC (Arduino).

When current passes from the IR Led, thus the Led is on, the phototransistor should be switched On, thus a considerable amount of current should pass from the phototransistor to Ground. Yet, even if LED and phototransistor are positioned extremely close, I read from A0 a value no less than 900, which means that only a 10% of the total current reaches the Ground.

I expected (and desired) when the IR Led is On, the value of A0 to be near zero, thus the phototransistor to be fully open and almost the whole current to pass from it.

Do I miss something there? Should I change something to the circuit or the components, in order to get an almost clear 0V or 5V?

Best Answer

Read the datasheet. It should tell you what the expected phototransistor current will be. That is apparently not enough to cause 5 V across a 10 kΩ resistor.

Do the math. At full illumination, the A/D reads 900 out of a 0-1023 full scale range, which is 5 V. That means the output is at 4.4 V, which means that there is 600 mV across the 10 kΩ resistor, which means that the current is 60 µA. That is apparently the current your phototransistor can support with the illumination you are supplying.

There are several things you can do about this:

  1. Nothing. As things are now, you can read the illumination to one part in 123, or basically 7 bits. Is that perhaps already good enough? What are you really trying to measure. For many applications, 7 bits plenty.

  2. Use a larger resistor. In this case, the pullup resistor is being used as a current to voltage converter. You can think of the resistance as being the gain of the conversion. A 20 kΩ resistor would give you twice the voltage, for example.

    The downside to this is that the impedance of the voltage signal goes up. Check the A/D datasheet to see how high a source impedance it is specified to work with. For some A/Ds, higher source impedance can be tolerated if the acquisition time is lengthened. Again, consult the A/D datasheet to see what your A/D needs.

  3. Amplify. You have a 600 mV signal that you want to be closer to a 5 V signal. That's exactly what amplifiers do.

    In that case, I'd probably flip the phototransistor and resistor so that the signal starts at 0 V with no light and goes up with more light. A gain of 8 would just about do it.

    If the value at low light levels is important, then make sure to use a opamp that can handle signals down to ground on both the input and output. Or, use a small negative supply from a charge pump or something so that 0 V is well within the opamps linear region.

  4. Use a higher resolution A/D. Many microcontrollers have 12 bit A/Ds built in nowadays. Changing only the 10 bit A/D to a 12 bit A/D gives you 4x the resolution, or about 9 bits in this case. Is that enough?