Weird photodiode behaviour - Page 1
Forum section: electronics / projects

author: robzy
author_rank: Regular Contributor
timestamp: February 18, 2022, 03:01:00 am
content: Background:-So I have a TCS3472 board (Adafruit link) which is basically 4 photodiodes. There are coloured filters (red, green, blue) infront of 3 of the photodiodes.I am shining a lime LED at the TCS3472. The LED is phospher coated and outputs a pretty wide spectrum of wavelengths.The TCS3472 is set up to use a 1x gain and 614ms integration time.I am getting really weird behaviour/readings when the TCS3472 is held up close to the LED.Expected results:-I have experimented with placing the TCS3472 around 5cm away from the LED, and then I PWM the LED up for 1/255 to 255/255 and get this logical progression of TCS3472 results:When I hold the TCS3472 very close to the LED I expect to get roughly the same results, but of course on a much higher vertical axis.Actual results:-When I hold the TCS3472 very close to the LED I get this progression of readings as I ramp up the intensity of the LED from 1/255 to 255/255:This doesn't make any sense to me. Why do all of the channels seems to clip on a linearly-increasing value? Have I broken physics? Am I going to get a nobel prize?Excluding the 'obvious' issues:-At face value it seems like this could be caused by 2 issues, but I don't think that either of them could actually cause this issue:Maxing out ADC value:My first thought was that I'm hitting the maximum ADC value at the end of the integration time, but this doesn't make sense. At an intensity of 161/255 the channels are capped at around 11,750.... but at an intensity of 251/255 the channels are capped at 14,200.Maxing out photodiode current:Again, this doesn't make sense because if the photodiode currents were maxxed out then there'd be a single value they all reach at the end of the 640ms integration time.Any thoughts?

author: ANTALIFE
author_rank: Frequent Contributor
timestamp: February 18, 2022, 05:23:27 am
content: To me it looks like you are saturating each channel, beyond which the response becomes "non-linear"As for why this happens at different points, this is because each channel has a different sensitivity (see fig 2 in the datasheet). Like if you continue increasing the LED brightness then you will eventually saturate the BLU sensor as well

author: robzy
author_rank: Regular Contributor
timestamp: February 18, 2022, 05:43:42 am
content: Quote from: ANTALIFE on February 18, 2022, 05:23:27 amPerhaps, but how would you explain the fact that the green and the clear channels report theexact same valuefor all intensities above 100/255?Like I mean, I get that there'd be weirdness if you 'overload' the sensor, but what mechanism would lead to seperate channels/photodiodes returning the exact same values?

author: Dabbot
author_rank: Regular Contributor
timestamp: February 18, 2022, 06:43:47 am
content: Quote from: moffy on February 18, 2022, 06:42:41 amBetter yet, what happens when you modify the LED PWM frequency?

author: Berni
author_rank: Super Contributor
timestamp: February 18, 2022, 06:49:19 am
content: Yeah id say that is sensor overload.As for why they seam to clip at the same value it might be due to a single ADC inside the chip being used to sample all 4 channels, once the muxing, amplification or conversion circuitry gets overloaded it can go weird across all channels since measure all of them in sequence.It is also possible that you are putting so much light in there that you are screwing up the chips internal circuitry. All diodes and BJTs are actually photodiodes and phototransistors, just crappy ones. So if you get intense enough light on a silicon chip you can make it act up.For example one popular instance of this being a problem is that some RaspberryPi SBCs crash if you take a flash photo of them. This is because a power regulator chip uses a flip chip package, so the intense light can bounce into the transistors, make the chip act up, causing the supply voltage to jump and this crashes the CPU.

author: EEEnthusiast
author_rank: Frequent Contributor
timestamp: February 18, 2022, 07:07:54 am
content: The response looks like the ADC is having a very high dynamic range compared to the linear range of the analog circuits and the sensors. so you are able to see the non linear behaviour of the analog front end.If the ADC had clipped, then the response would have flattened off suddenly.

author: robzy
author_rank: Regular Contributor
timestamp: February 18, 2022, 09:18:24 am
content: Quote from: Dabbot on February 18, 2022, 06:43:47 amI think I had some issues with a PWM frequency of 122Hz causing some non-linearities, so I bumped it up to 488Hz. It's much more linear, although I suspect that the noise in the "touching LED" chart are caused by the PWM frequency.That being said, I can't think of any mechanism that even a 122Hz PWM frequency was cause this effect. Is there something I'm not considering?Quote from: Berni on February 18, 2022, 06:49:19 amThat's a good point. I considerd that, but the chips datasheet (pg16) suggests that it shouldn't be skipping a beat with this amount of light. Even with an integration time of only 101ms it should happily handle intensity that cause a count of 40k+Quote from: EEEnthusiast on February 18, 2022, 07:07:54 amI totally agree. But the response didn't flatten off suddenly, it just changed to a shallower gradient.

author: robzy
author_rank: Regular Contributor
timestamp: February 18, 2022, 10:14:02 am
content: Okay, a bit of a progress update...I ran a few tests with the sensor a fixed location (a few centimeters) away from the LED. The tests had different gain/integration time values.Some (most?) gain/integration time combinations gave these weird non-linear results as the intensity of the LED increased.But there were some gain/integration time combinations that gave linear results that were perfectly usable.I think this proves that it's not the intensity of the LED itself that's causing the sensor to glitch. It's seeming more and more likely that its just in the sensors nature to return non-linear results for some gain/integration values, and I need to do more investigation to come up with a reasonable guess about what's causing the issue.: Also, for must values, the "corner" radius between the two gradients wasn't so sudden. It was a softer transform. The the plots were reminiscient of capacitor charge curves. To my uneducated eyes, anyway.I'm going to run the test for a number of gain/integration combinations and see if I can see a pattern. That should give clues as to how I'm mis-using the sensor.

author: Kleinstein
author_rank: Super Contributor
timestamp: February 18, 2022, 10:43:24 am
content: It looks a bit like the integration is in 2 parts: an analog integration over 2.4 ms (and maybe shorter ?) and than an ADC. For longer time it looks they just sum up digital numbers. With slow PWM it can than happen that when the LED is on all the time over an 2.4 ms analog integration part the ADC there saturates. Those phases with partially on and partially off can still work OK. So the rather low PWM frequency can be part of the problem.

author: robzy
author_rank: Regular Contributor
timestamp: February 18, 2022, 12:20:34 pm
content: Quote from: Kleinstein on February 18, 2022, 10:43:24 amOhh!! Thanks. That's an interesting theory. I can't rule that out. I'll look into thay tomorrow.

author: robzy
author_rank: Regular Contributor
timestamp: February 18, 2022, 11:57:29 pm
content: For anyone curious, this shows the clear sensor value at a number of gain/integrationtime values.

author: robzy
author_rank: Regular Contributor
timestamp: February 19, 2022, 03:54:53 am
content: Quote from: Kleinstein on February 18, 2022, 10:43:24 amI think this is exactly what's going on. It makes perfect sense. Thank you!