Photodiode Comparator Circuit

Thread Starter

uriahsky

Joined Apr 27, 2009
43
I am working on a simple comparator circuit that uses a photo diode as one of the inputs. It is used to sense the presence of a coin sitting on top of coin flipper gun. There is no transmitter it just uses the presence of room lighting and absence when the coin covers the photo diode.

I have spent many hours on this and I am still having trouble trying to get it working like it should.

One problem happens when trying to adjust the voltage that is with the photo diode to just above or below the reference diode voltage. Lets say I have the reference at 2.5V and I am bring up the pot that is attached to the photo diode circuit and as I get close to the 2.5V it will suddenly jump up to 4V so then when I turn it down and as it gets close to the 2.5V from the high side then it suddenly jumps down to 1.5V and I keep chasing it back and forth but can never really get it set right.

It seems when I do get it kind of dialed in it will work for a little while then fall out of range. This thing did work fine for years and then the photo diode died and I couldn't get an exact replacement. I tired many different ones that I had around and ordered some from Digikey but the one that seems to respond the most is a LPT032 from eBay. The diagram is just the front part of the circuit. The rest of the circuit just sends out a high/low signal and has a LED to show when it is activated.


Does it matter what the overall Resistor values are on the voltage divider that is on the reference side of the comparator? IF I use 2M or 200 ohms potentiometer how will that affect the circuit. Right now I am using a 2M Pot on the reference side but will a 1K pot produce the same thing? This would be R1 on the schematic.

A few more questions:
Does it make any difference if the photo diode is on the Negative or Positive pin?

Would it make any difference if I swapped positions with the photo diode and R2?

What am I not understanding on this circuit? This kind of thing is used a lot in my business and it looks pretty simple but it just isn't working out.

Thanks very much,
Russ
 

Attachments

GopherT

Joined Nov 23, 2012
8,009
I assume you are using a battery as a power source. That will explain the reference falling out of range over time. The output voltage drop of a battery will cause your voltage divider "reference" to drop over time.

A better option for a reference would be a 3 pin voltage reference (e.g. lm385).
 

codeboy2k

Joined Jun 18, 2012
7
It's never a good idea to use an op amp open loop mode as a comparator like this; use a real comparator if you can. However, the TL082 is a good amp for a photo diode application, and can easily pull the uA of current from the diode.

You should close the feedback loop and use the op-amp to gain up the current from the diode, instead of trying to compare it to a reference like this.

1. put a feedback resistor between the output pin and the negative input of the op-amp. You can try 10K (less gain) or 100K (more gain) or 1M (even more) or 10Meg (most)

2. remove R2 completely.

3. You can set the off point with R1. A 2Meg here is pretty high, you can probably make do with a 10k or 50k potentiometer for R1. If nothing you do to R1 is turning it off, then it's too sensitive, and you must lower the gain by lowering the feedback resistor. Don't change R1, just adjust the gain. Once you have a feel for the gain resistor value you want, you can make the feedback resistor a potentiometer, to adjust the gain setting.

4. you can put a transistor at the output, with a pullup, in order to get a simple comparator like output from the TL082, after you have the proper gain set for your light levels.
 

Thread Starter

uriahsky

Joined Apr 27, 2009
43
I want to thank you for taking the time to respond to my problem.

Before I try what you have recommended I really want to try and make the current circuit I have work because it did work at one time and this is a typical circuit I see in many of the games I am working on. I have spent the last few days building and rebuilding the POS pcb and still no luck.

I thought I had figured out why I was having such a problem and I thought it was because I had left lots of flux on the pcb and it was building up a meg of resistance here and there and that was why but after cleaning the pcb it still gives me problems.

I have another game with a similar circuit and I am also having a problem with this pcb and it is basically the same problem.

The basic problem is that the transmitter burns up and the transmitters I have don't match the receiver so I need to replace the receiver with a different type but when I do it throws off the voltage level and that is where I get stuck. I can't seem to dial in the correct voltage with almost any value of resistance.

Attached below is the receiver part of this new circuit and I placed pot on R1 and no matter what I do I can't dial in the correct voltage. I should be able to do this??? Right?

Q: How do you pick the correct photo diode for the circuit below? Is there a data sheet spec that you try and match up to the resistors?

If I have a IR photo diode receiver how do I find the correct resistance for it, just by experimentation? but then why can't I get it to respond correctly?
I am probably missing the obvious.

Thanks again,
Russ
 

Attachments

Thread Starter

uriahsky

Joined Apr 27, 2009
43
I am still working with this circuit and need more advise. I appreciate all of the help with this. It seems simple and it probably is but Iam still having problems. I am making progress, I think some of the problems I was having was from too much flux on the pcb and that might have caused problems. I wired up this circuit that is in the earlier part of this thread and placed a 10K pot inline with the detector but there still wasn't enough light in the game to get it to work. I tried adding a bright white LED light above the diode about four inches away but it still wasn't bright enough.

So I bought a simple sensor pcb from ebay which can be found by searching for "Photosensitive diode sensor brightness sensor/intelligent​gent car sensor module" on eBay and I attached the schematic below. The only problem with this circuit is that the digital out is backwards. I need it to the opposite direction. So this brings me to my question.

I guess I just need to wire it up to an inverter but which one should I use? The 7404 or should I use a Schottkey inverter? Or something else? I tried to wire up a 7414 and it caused the sensor to stop working. Once I wired the output into the input on the 7414 the sensor was no longer responding to light changes. Do I need to wire in a pull up or?? Can someone give me an idea on how to wire up the attached circuit with an inverter to get the digital out to go in the opposite direction? So if it was 0 or low with light and high or 1 when blocked I need it to do 1 or high when light is shinning on it and 0 or low when blocked. This is where I am stuck.

Also lets say I want to build the same kind of circuit that is attached to this post and I have a different photo diode detector. How do you choose the right sized potentiometer so that you get the largest or widest light adjustment sensitivity. It seemed like there were some pots that I tried where the slightest movement of the pot would result in it going out of range. I need it so that it responds to the normal fluctuation of room lighting and not have the sensor trigger all of the time. This is wired to the coin switch.

I hope someone has made it this far.
Thanks again,
Russ

 

Attachments

Top