Voltage Comparator help for Robotic Dog Project

Discussion in 'The Projects Forum' started by scooter13z, Jul 13, 2007.

  1. scooter13z

    Thread Starter New Member

    Jul 13, 2007
    Hello, this is my first post, but I have been on here before and found these forums very helpful. Here is my question:

    I am building a robotic dog for a class and everything has gone smoothly until now. What I need to do is have my Infrared photodiode(http://info.hobbyengineering.com/specs/sfh205.pdf) connected to the non-inverting input of an LM339 comparator. The supply voltage for the comparator is at 5V. I also have a 2.5V reference voltage going into the inverting input of the comparator.

    I have tested the comparator (which has a 220ohm pull up resistor on the output) using the reference voltage and a secondary varying voltage for the non-inverting input and it worked perfect. When I connect the IR photodiode, it does not work properly.

    What happens is I turn the power on my breadboard on and the output voltage is at around .6-.7volts, which is fine. But after about 5 seconds, the output jumps up to 5volts and stays there.

    Now, testing the photodiode separatly, I connect one side to 5V, then the other side to a .1uF capacitor, and the cap then goes to ground. I take the measurement in between the photodiode and the cap. I then use my IR emitter and the circuit works perfect, the closer I get, the higher the voltage (5V being the max).

    Basically what I need to do is have the comparator output 5V when the photodiode is outputting over 2.5V and have the comparator output 0V when the photodiode outputs <2.5V. This has been a very frustrating part of the project because I know that it will work, I just can not get it exactally right. Thanks in advance for any help you can give.

  2. nomurphy

    AAC Fanatic!

    Aug 8, 2005
    Based upon your description, it appears the photo diode's resistance increases with light (and decreases with dark).

    Place a 100k resistor from +5V to the photo diode anode, and tie the cathode to ground. Connect the comparator (+) to the resistor/anode junction.

    When dark, the diode will be low resistance and the (+) voltage should be less than the +2.5V reference. As light is sensed, the voltage should rise until it is above the reference. The value of the resistor will determine the sensitivty of the circuit.

    You might check the new HP/Agilent site for a better device with much better documentation: http://www.avagotech.com
  3. scooter13z

    Thread Starter New Member

    Jul 13, 2007
    Thanks a lot! I was able to get my circuit working while holding the IR emitter at a distance of about 1 foot. I tried it with a 100k resistor and it did not work very well at all (I had to litterally touch the emitter to the sensor). So I put in a larger resistor and the bigger the resistor, the more distance I got. I am next going to try to lower the reference voltage a bit to get my distance even greater. Thanks a lot for your help!

  4. cumesoftware

    Senior Member

    Apr 27, 2007
    Photodiodes work in two "modes": reverse biasing and photovoltaic. The photovoltaic is when you connect the diode in a "forward biasing" fashion, without connecting it to a power supply. Thus, the voltage generated at its terminals is proportional to the amount of received light.
    However, in reverse biasing mode, you connect the photodiode to power supply, and the current biasing it will be proportional to the light being received.

    Your diode might be working as a photovoltaic device when it needs to work in reverse biasing.
    No, all photodiodes share the same principle. Actually, that's why phototransistors use a photodiode in reverse biasing, connected to the base and collector of the transistor, and I might add that phototransistors also decrease their resistance with light.