Author Topic: Help with photo diodes.  (Read 1897 times)

0 Members and 1 Guest are viewing this topic.

Offline cvrivTopic starter

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: us
Help with photo diodes.
« on: March 21, 2020, 05:27:29 am »
I'm creating an interactive surface, a 4x4 matrix, consisting of IR sensors and blue LEDs. This surface detects objects hovering above and adjusts the brightness of the blue LEDs based on how close the object is to the surface.

I have it working, but I noticed that some of the sensors are way more sensitive than some others. I thought it was my microcontroller at first and then my coding, but I dont think so anymore. I think it's the photo diodes.

I had setup a simple jig that holds a photo diode a certain distance away from an operational IR diode and measured the resistances of the photo diodes and found that they are all very much different. I understand tolerances, but this is clearly affecting my circuit. I cant go through my whole stash of photo diodes to find the closest matched. I want to build several of these and thats just not an option.

I want to ask if there is a way to "normalize" all the photo diodes so that all of my inputs are seeing about the same voltage for an object hovering above the sensors at the same distance?
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3273
  • Country: gb
Re: Help with photo diodes.
« Reply #1 on: March 21, 2020, 11:14:02 am »
measured the resistances of the photo diodes

Resistance is not a useful parameter here since you are dealing with a diode, not a light-dependant resistor.  The relevant parameter would be responsivity, which indicates how much incident light is converted to a current (which is most always wavelength dependant).  Show us how you have the photodiodes wired up, a schematic would be useful.

The photodiodes likely won't be very sensitive at the blue end of the spectrum but they will have some level of responsivity. Are you ensuring they don't pick up light from the LEDs?
 

Offline GerryR

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: us
Re: Help with photo diodes.
« Reply #2 on: March 21, 2020, 11:24:05 am »
I expect that you would have to send each detector output through an amplifier and calibrate each output to give the same result for a given intensity exposure.  Sounds tedious but, off hand, unless you ordered matched diodes from the manufacturer, I think you will have to "condition" each unit to get matched outputs.  JMO.
Still learning; good judgment comes from experience, which comes from bad judgment!!
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16306
  • Country: za
Re: Help with photo diodes.
« Reply #3 on: March 21, 2020, 12:15:46 pm »
You are using a microcontroller, so simply add some extra code in which takes the input value and scales it. That then only needs you to calibrate each sensor with a known light intensity, and calibration would be either to read out the value per sensor, enter into a table, and then calculate a value to multiply with to get a standardised value, or simply have a cal routine where the measured value is read, and scaled to a particular value internally, with the required scaling per sensor being stored for use in normal operation.
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Help with photo diodes.
« Reply #4 on: March 21, 2020, 02:02:25 pm »
Very small differences between the beam alignments of the IR emitter and photodiode will be 10X higher than any differences in sensitivities, very wide IR beam emitters might help.
Are they really photodiodes, from the reflected IR light they'll output only a few mV or a few uA, measuring their resistance doesn't mean much.
.  That took much longer than I thought it would.
 

Offline cvrivTopic starter

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: us
Re: Help with photo diodes.
« Reply #5 on: March 21, 2020, 02:49:04 pm »
Very good information. Thanks everyone.

@mikerj - Interesting. So when I use them to pull an input pin up to VDD, it's not the resistance of the diode that's changing to allow the flow of current? It's converting light to a current, which is a very small amount, so if I use it as a pull-up, that small current is amplified via VDD? Ill have to research how these work. So the way I coded this to work is that the blue diodes are off when the sensors are polled.

@GerryR - So the responsiveness is pretty weak with sensing an object, because your hand has to get pretty close to the sensors. I think it's because because Im polling the sensors too fast. I have the emitters being turned on with a constant current LED driver, via EUSART, that's sinking 100ma from them. I have to allocate more time for them before performing the ADC to see if that helps. The receivers are multiplexed. Each row of receivers is brought to 5V via port pins, one each row. The columns are connected to 4 input pins, one column each pin. The code associates the emitters, receivers, and blue LEDs into clusters. All blue LED are turned off, a TX diode is turned on and then the associated RX is polled.

@SeanB - So your saying that I need to set something up above each sensor at the same height and write code to adjust each sensor so that the ADC binaries are the same? I dont think I'll be able to do that until I have the TX and TX diodes permanently mounted to a circuit board etc, because right now they are just roughly in a protoboard.

@StillTrying - Interesting. So its more important that they are all as perfectly aligned than the responsiveness of each diode?

When I was swapping out the photo diodes, with the circuit running, some of the photo diodes would turn the blue LED on with no object above with only room light. Some of the photo diodes wouldn't. I find that to be vert frustrating. I attached an image of how the photo diodes are connected. The blue LEDs and emitters are connected to constant current LED drivers. The mircoprocessor uses EUSART to transmit data the the drivers.

I failed to mention that the processor varies the intensity of the blue diodes based on how close an object is to a sensor. I think I know what I have to do. I think I have to do what SeanB mentioned. I going to have to hard-code adjustment for each diode. That's going to suck because that's a hell of a lot more code. That seems very tedious and I want to make a few of these too!

There's has to be another way that I can do this, but for another time because I have to get this done now.
« Last Edit: March 21, 2020, 03:22:41 pm by cvriv »
 

Offline TimFox

  • Super Contributor
  • ***
  • Posts: 7987
  • Country: us
  • Retired, now restoring antique test equipment
Re: Help with photo diodes.
« Reply #6 on: March 21, 2020, 03:26:10 pm »
As stated above, a reverse-biased (normal connection) photodiode generates a current proportional to the light power stopped in the junction.   If I remember correctly, the factor is about 0.4 A/W for green light in silicon.  Ordinarily, at a given wavelength, the conversion factor should be constant from device to device, however the optical efficiency (due to reflections, effective aperture area, etc.) affects how much light power hits the junction.  Since the diode is biased, there is also a leakage current, which is a strong function of temperature.  How are you converting this current to a voltage for your circuit?
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8240
  • Country: fi
Re: Help with photo diodes.
« Reply #7 on: March 21, 2020, 04:13:37 pm »
Just a guess, you are likely connecting the photodiodes wrong. You need to reverse bias them, measure the current, and because the current is usually so damn small, you may need to amplify it locally before feeding to a microcontroller. Yes, a lot of components. You may want to look at integrated light sensors.
 

Offline cvrivTopic starter

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: us
Re: Help with photo diodes.
« Reply #8 on: March 22, 2020, 09:21:47 am »
Thanks for the replies. Imbpretty aire I have them forward biased; the anode connected to VDD and the cathode connected to the input pin. Reverse biasing it would be the other way around right?

How would I amplify that current? Could I use a transistor? I have some opamps as well.

This is more of a learning experience than just something to complete. I'd like to do everything from scratch as much as possible.

The current leakage is going to produce about 0.7v across the junction right? The more light on the junction, the more current that gets through? Just want to be clear.
« Last Edit: March 22, 2020, 09:28:51 am by cvriv »
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8240
  • Country: fi
Re: Help with photo diodes.
« Reply #9 on: March 22, 2020, 10:21:41 am »
The current leakage is going to produce about 0.7v across the junction right? The more light on the junction, the more current that gets through? Just want to be clear.

No, 0.7V-ish would be the upper limit in forward conduction (at significant current), you don't want to do that. Below that, the voltage over the diode is as much as you put over it, typically from around zero to negative. Then it acts like a normal diode: it won't conduct, except that light makes it "leak" more current.

For a typical circuit, see https://www.analog.com/en/technical-articles/optimizing-precision-photodiode-sensor-circuit-design.html
 

Offline cvrivTopic starter

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: us
Re: Help with photo diodes.
« Reply #10 on: March 22, 2020, 11:57:57 am »
Thanks for the link. I'm gonna read it. Thanks.
 

Offline TimFox

  • Super Contributor
  • ***
  • Posts: 7987
  • Country: us
  • Retired, now restoring antique test equipment
Re: Help with photo diodes.
« Reply #11 on: March 22, 2020, 02:26:24 pm »
The equivalent circuit for a photodiode is a current generator (proportional to light power) in parallel with a P-N diode.  The direction of current flow is that which would try to forward-bias the junction.  Therefore, a reverse bias voltage is usually supplied by the outside circuit to keep the diode reverse-biased so that the current flows out of the device.  If the current flow into the external circuit overcomes that reverse bias voltage, then the diode will turn on and steal current from the load. 
In "photovoltaic" mode, used for solar cells, there is no applied bias.  The current flowing into the load tries to forward-bias the  junction, so the maximum voltage available from one cell is approximately 0.6 V.  For higher voltage in practical use, cells are connected in series to produce higher voltage.
In some sensing applications, the photodiode is connected directly (no bias) between ground and a virtual ground at an operational amplifier input (with feedback resistor) to eliminate the "dark current" due to diode leakage when reverse biased.
« Last Edit: March 22, 2020, 10:50:16 pm by TimFox »
 

Offline cvrivTopic starter

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: us
Re: Help with photo diodes.
« Reply #12 on: March 23, 2020, 01:34:20 am »
The equivalent circuit for a photodiode is a current generator (proportional to light power) in parallel with a P-N diode.  The direction of current flow is that which would try to forward-bias the junction.  Therefore, a reverse bias voltage is usually supplied by the outside circuit to keep the diode reverse-biased so that the current flows out of the device.  If the current flow into the external circuit overcomes that reverse bias voltage, then the diode will turn on and steal current from the load. 
In "photovoltaic" mode, used for solar cells, there is no applied bias.  The current flowing into the load tries to forward-bias the  junction, so the maximum voltage available from one cell is approximately 0.6 V.  For higher voltage in practical use, cells are connected in series to produce higher voltage.
In some sensing applications, the photodiode is connected directly (no bias) between ground and a virtual ground at an operational amplifier input (with feedback resistor) to eliminate the "dark current" due to diode leakage when reverse biased.

Really great information. Thank you so much. I'm reading reading all about it via the link shared here. I actually did a small test with a photo diode reverse biased and sure enough it works. I couldnt believe it. I would have never though to do that. I checked my project, just to verify, and I do have all of them forward biased. So im going research this and do some experiments before making changes to my project. This is all very cool and I hope that once I make the changes that the sensors will operate similarly to one another. 
 

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3458
  • Country: nl
Re: Help with photo diodes.
« Reply #13 on: March 24, 2020, 12:43:58 am »
Type in "sharp distance sensor" somewhere on the 'net.
These things have an IR diode and an array of sensors and they measure distance by where the reflected light hits the sensor.

You can also get simple IR diodes and photo diodes/transistor together in a plastic housing, and screened from each other.

For example, moules like below cost about EUR2 on Ebay / Ali / China.
You should be able to get them cheaper without the PCB and such.
 

Offline cvrivTopic starter

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: us
Re: Help with photo diodes.
« Reply #14 on: March 24, 2020, 04:24:57 am »
Thanks for the info. I was actually going to design and 3D print a custom plate that would be used to mount the IR and photo diodes as well as isolate them from each other.

I have a question about multiplexing the photo diodes with the opamps to the inputs of the microprocessor because foresee a problem, but Im going to hold out until I have a schematic drawn first. Plus I have other homework I need to get done:)
 

Offline TheUnnamedNewbie

  • Super Contributor
  • ***
  • Posts: 1211
  • Country: 00
  • mmwave RFIC/antenna designer
Re: Help with photo diodes.
« Reply #15 on: March 24, 2020, 07:31:13 am »
Since a photodiode is a currentsource, you usually use something like a TIA to amplify and transform the signal into the voltage domain, which is what your ADC of the micro controller probably wants.
The best part about magic is when it stops being magic and becomes science instead

"There was no road, but the people walked on it, and the road came to be, and the people followed it, for the road took the path of least resistance"
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3273
  • Country: gb
Re: Help with photo diodes.
« Reply #16 on: March 24, 2020, 08:39:45 am »
Thanks for the info. I was actually going to design and 3D print a custom plate that would be used to mount the IR and photo diodes as well as isolate them from each other.

I have a question about multiplexing the photo diodes with the opamps to the inputs of the microprocessor because foresee a problem, but Im going to hold out until I have a schematic drawn first. Plus I have other homework I need to get done:)

Multiplexing photodiodes can be problematic since you are dealing with small currents and  high impedances so leakage and charge injection from a mux can become very significant, so you'd have to select a mux with this in mind and figure out suitable stabilisation times etc.

Since you only have 16 inputs, it wouldn't be too arduous to have a TIA per photodiode (i.e. four quad op-amps) and then mux the low impedance voltage outputs of the op-amps.  Unless you are planning to expand the number of photodiodes?

Something to note is that photodiodes tend to work better with a non-zero reverse bias
 

Offline cvrivTopic starter

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: us
Re: Help with photo diodes.
« Reply #17 on: March 25, 2020, 12:53:57 am »
I don't even know what a TIA is at the moment. I guess I'll have to research as well. I actually would like to have more photodiodes one day as Id like a nice large surface area, but for now 4 x 4 is good for learning purposes.

EDIT: I know what a TIA is now. One per diode?!?!?!?!?!? Is there another way?
« Last Edit: March 25, 2020, 12:55:53 am by cvriv »
 

Offline cvrivTopic starter

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: us
Re: Help with photo diodes.
« Reply #18 on: March 25, 2020, 02:56:05 am »
I'm checking out opamps and i'm paying attention to the important characteristics, input bias and voltage offset, but I'm wonder how much these characteristics will affect what I'm doing. I'm not doing anything to precise. I just want to diodes to operate similarly to one another and be able to have enough range that I can generate ADC binary that can be used to vary the intensity of the blue diodes in my project.

There are opamps with multiple inputs. I was eyeballing the 4 or 8 input versions. Could i use a couple of these to switch between the diodes and run the output of each opamp to the analog pins of the microprocessor?

Thisbis all very intriguing and id like to try and split hairs doing this one day.
 

Offline GerryR

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: us
Re: Help with photo diodes.
« Reply #19 on: March 25, 2020, 11:19:28 am »
TIA = TransImpedance Amplifier, as in the data sheet referenced above.
Still learning; good judgment comes from experience, which comes from bad judgment!!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf