Author Topic: Weird photodiode behaviour  (Read 2840 times)

0 Members and 2 Guests are viewing this topic.

Offline robzyTopic starter

  • Regular Contributor
  • *
  • Posts: 171
  • Country: au
Weird photodiode behaviour
« on: February 18, 2022, 03:01:00 am »
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?
« Last Edit: February 18, 2022, 04:03:50 am by robzy »
 

Offline ANTALIFE

  • Frequent Contributor
  • **
  • Posts: 521
  • Country: au
  • ( ͡° ͜ʖ ͡°)
    • Muh Blog
Re: Weird photodiode behaviour
« Reply #1 on: February 18, 2022, 05:23:27 am »
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
 

Offline robzyTopic starter

  • Regular Contributor
  • *
  • Posts: 171
  • Country: au
Re: Weird photodiode behaviour
« Reply #2 on: February 18, 2022, 05:43:42 am »
To me it looks like you are saturating each channel, beyond which the response becomes "non-linear"
Perhaps, but how would you explain the fact that the green and the clear channels report the exact same value for 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?
 

Offline Dabbot

  • Regular Contributor
  • *
  • Posts: 198
  • Country: au
Re: Weird photodiode behaviour
« Reply #3 on: February 18, 2022, 06:43:47 am »
What is your PWM frequency?

Better yet, what happens when you modify the LED PWM frequency?
 

Online Berni

  • Super Contributor
  • ***
  • Posts: 5395
  • Country: si
Re: Weird photodiode behaviour
« Reply #4 on: February 18, 2022, 06:49:19 am »
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.
 

Offline EEEnthusiast

  • Frequent Contributor
  • **
  • Posts: 383
  • Country: in
  • RF boards, Precision Analog, Carpentry
    • https://www.zscircuits.in/
Re: Weird photodiode behaviour
« Reply #5 on: February 18, 2022, 07:07:54 am »
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.
Making products for IOT
https://www.zscircuits.in/
 

Offline robzyTopic starter

  • Regular Contributor
  • *
  • Posts: 171
  • Country: au
Re: Weird photodiode behaviour
« Reply #6 on: February 18, 2022, 09:18:24 am »
What is your PWM frequency?

Better yet, what happens when you modify the LED PWM frequency?
I 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?

Yeah id say that is sensor overload.

[...]

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.
That'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+



If the ADC had clipped, then the response would have flattened off suddenly.
I totally agree. But the response didn't flatten off suddenly, it just changed to a shallower gradient.
 

Offline robzyTopic starter

  • Regular Contributor
  • *
  • Posts: 171
  • Country: au
Re: Weird photodiode behaviour
« Reply #7 on: February 18, 2022, 10:14:02 am »
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.

[edit]: 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.
« Last Edit: February 18, 2022, 10:20:04 am by robzy »
 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 17264
  • Country: de
Re: Weird photodiode behaviour
« Reply #8 on: February 18, 2022, 10:43:24 am »
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.
 

Offline robzyTopic starter

  • Regular Contributor
  • *
  • Posts: 171
  • Country: au
Re: Weird photodiode behaviour
« Reply #9 on: February 18, 2022, 12:20:34 pm »
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.
Ohh!! Thanks. That's an interesting theory. I can't rule that out. I'll look into thay tomorrow.
 

Offline robzyTopic starter

  • Regular Contributor
  • *
  • Posts: 171
  • Country: au
Re: Weird photodiode behaviour
« Reply #10 on: February 18, 2022, 11:57:29 pm »
For anyone curious, this shows the clear sensor value at a number of gain/integrationtime values.

 
The following users thanked this post: ANTALIFE

Offline robzyTopic starter

  • Regular Contributor
  • *
  • Posts: 171
  • Country: au
Re: Weird photodiode behaviour
« Reply #11 on: February 19, 2022, 03:54:53 am »
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.
I think this is exactly what's going on. It makes perfect sense. Thank you!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->