3
\$\begingroup\$

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?

\$\endgroup\$
  • \$\begingroup\$ How about providing links to the LED and phototransistor. \$\endgroup\$ – Andy aka Dec 15 '16 at 13:02
  • \$\begingroup\$ They are both no name, so no specs are available except from the fact fhat they work in 940nm. \$\endgroup\$ – user3060854 Dec 15 '16 at 13:04
  • \$\begingroup\$ So you have two components, which the only spec you know is 940nm. You expect us to find out why you aren't getting what you're expecting how exactly? \$\endgroup\$ – Doodle Dec 15 '16 at 13:10
  • 1
    \$\begingroup\$ Rather than 10K, try 100K, or 330K, etc. Also, get a 2N2222 transistor and combine with phototransistor to make a Darlington pair, for far higher gain and lower minimum volts (Vce(sat)=0.3V) \$\endgroup\$ – wbeaty Dec 15 '16 at 23:45
  • \$\begingroup\$ Check that you haven't put the phototransistor in backwards. It is easy to do when it only has two leads. \$\endgroup\$ – glen_geek Dec 22 '16 at 14:27
6
\$\begingroup\$

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?

|improve this answer|||||
\$\endgroup\$
  • 1
    \$\begingroup\$ 5. Use a brighter LED or give more current to the one you have now. 6. Direct more of the LED's light in the direction of the sensor. \$\endgroup\$ – The Photon Dec 15 '16 at 15:37
  • \$\begingroup\$ @Olin Lathrop Thank you in advance for your answer. Additionally I managed to find the specs of the phototransistor: datasheets360.com/part/detail/l-932p3bt/-1164504578976408361/… \$\endgroup\$ – user3060854 Dec 15 '16 at 21:31
1
\$\begingroup\$

You may be misunderstanding the way in which the circuit is working. The Arduino's analog input pin should have a high impedance, and so should have little effect on the action of the circuit.

So, to a close approximation, all the current in the circuit runs from the +ve supply, through the 10k resistor, through the phototransistor, to ground.

The thing that is varying is the current that the transistor is allowing through. The more photons hit the transistor, the more electrons it lets through.

Your circuit is measuring the voltage across the transistor, which is equal to 5V minus the voltage across the resistor, at whatever current the transistor is allowing through.

Realistically, the voltage across the transistor will never be zero - because it's a transistor not a switch. And the current it lets through will be limited by the amount of light you can shove into it.

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

The voltage across the phototransistor cannot go to zero, even if hit with a many-watts IR laser.

The Vce(sat) from your phototransistor specsheet is 0.8V. So, if Arduino gives 1023 for +5v, that means the very lowest reading for your transistor (when in bright sunlight, etc.,) the Arduino would report a value of 164 ( = 0.8/5*1023).

If replacing the 10K with a 330K doesn't fix the problem, then use a voltmeter to check the actual voltage across the phototransistor. How low does it go when the IR LED shines upon it? Also try blasting it with an old-style non-LED flashlight, also a 100watt incandescent bulb, or some outdoor sunshine. And, power up two or three of your IR LEDs, and aim them all at the phototransistor.

Verify that Arduino D/A input pin is actually measuring a 5V span when reporting 1023: for example, feed it 1.6v from a new alkaline cell, and see if it reports approximately 330 ( = 1.6/5*1023). Feed it 0V and make sure it reports a value very close to zero.

PS

Add a vis-red LED in series with the 10K resistor. That way you can "see" any changes in the phototransistor current.

Once you figure out the original problem, next try connecting an IR LED in series with the phototransistor, then aim them at each other. It becomes a flip-flop which detects IR light. A brief pulse of ambient IR light will turn on the circuit, and then it keeps itself turned on via the IR LED. Then to turn it off again, you have to momentarily turn off your LED (or stick cardboard between the two.) Also add a vis-red LED in series, so you can see this happening without an Arduino or a voltmeter.

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.