Long term stability and calibration issues

Nov 22, 2010 26 Replies

Hi All, Ok, it is color reader time again! This thing is startingto drive me crazy... or crazier, anyway!



Here is the problem. I take a unit. I test it in debug mode, taking multiple samples of various materials. I get a series of values and calibrations that will reliably read all the different color distinctions I need. I build it into a release version, and move the unit from my test enclosure to a permanent enclosure. All the calibrations are off, the color ranges are flakey, and it doesn't work well enough to give away, much less sell!



So, what could be causing such gross changes in my calibration? The cases are identical, except for the two holes to allow the programing/debug cable access. Even when I move the unit back into the original case, it is still off in calibration. Am I just trying to get more accuracy out of this sensor than it can provide?



A copy of the schematic is here:

formatting link
For a recap on the circuit:



I have three SM RA LEDs, red, green and blue on the top of the board powered off a 20mA supply and switched through a couple of compl. mosfets.



On the bottom of the board, I have an TEPT4400 ambient light sensor/photo transistor, collector to 3.3VDC emitter to 12.4K resistor feeding a buffer opamp with a 10K digital pot in series with 50K to provide an adjustible gain amplifier. This goes through a low pass filter of 1Kohm/.1uF to the ADC of my PIC24FJ128. It also feed to a second stage of the opamp with a fixed 3X gain to another ADC input.



Basic calibration is to place a known white sample (white felt) and turn on one of the LEDs. I adjust the digpot to get a reading of 2000 to 2020 out of a range of 2048. I then turn that LED off, turn on the next, and remeasure. After I have all three colors calibrated, I then put a known black sample, and measure my 'black' levels. I then scale the measured levels in color between these two levels.



My gain settings keep varying between 3-5 steps for the white levels, and the measured black level (typicall between 250 and 400) varies by almost 100 points! In any one session they stay pretty stable, but the next morning everything is way off.



So, any ideas what I am doing wrong? Any suggestions to improve things?


[...]

Debug and "release: aren't the same--either the case, software, optics (alignment, focus, filters), or environmental conditions are different.

Try to duplicate the failure in your test setup...

Nice cc LED driving, BTW.

-- Cheers, James Arthur

formatting link

Temperature variation?? If the LED o/p & photosensors have a large tempco then that could cause problems. Some enviromental sensors using leds/optics have temp sensors co-located with the LED & sensor to compensate.

Try a calibration, wave a heat lamp near it and see what happens (without moving or changing the housing).

HTH

formatting link

Temperature stability of the TEPT4400. My guess, if every thing else is soild. It doesn't look that stable from the data sheet. Have you seen this?

formatting link
It uses the TAOS sensors.

Cheers

ng

o
0
e
n
e

About +1.5%/=BAC. Ouch. That's probably it. LEDs can vary quite a bit with temperature too, so that's worth confirming as well.

Photodiodes--much better...

formatting link

...but he'll have to filter IR.

Some sort of closed-loop calibration might be an option, like a mechanical shutter with a reference swatch on it.

-- Cheers, James Arthur

formatting link

My money is on tempco of the sensor dark current and sensitivity. That sensor has a dark current at room temperature that varies by 10x for 20C or 4% / degree C and relative sensitivity varies by 1% / degree C.

formatting link

It might also need a "hot mirror" IR blocking filter to stop it being fooled when under IR rich incandescent lights. Sensitivity is still 50% at 800nm. Most alternative photodiodes will need a blocking filter.

Unless it is temperature compensated or maintained at constant temperature then I would expect pretty bad drift. A can of freezer spray or a hair dryer will quickly confirm this hypothesis.

It is likely the LEDs will also show some tempco in the opposite sense as cooling them typically increases efficiency slightly.

Regards, Martin Brown

Your enclosure looks fairly translucent.

The optics area should probably be constructed of a white-card light-blocking material.

RL

e

ing

e

to

.
00

he

en

le

tempco

tics

ut

Dark current's only 10nA at 50=BAC--not significant. The sensitivity tempco is slightly worse than I said before--1.0 @

25=BAC vs: ~1.6 @ 60=BAC works out to 1.7% per =BAC.

I don't know about the LEDs, but they bear watching too.

The sensor's so unpredictable that he really needs a new sensor.

A photodiode for sensing the target, plus one separate photodiode that intercepts a little direct light from each of the 3 LEDs would fix everything--that eliminates the phototransistor-as-sensor drift, and allows measuring and compensating for LED output drift.

The uC + an integrating capacitor per photodiode would make a fine single-slope converter.

An IR filter and an opaque case are almost certainly required. One alternative might be to use matching LEDs as photodiodes--they're wavelength-selective, sort of.

-- Cheers, James Arthur

[snip]

That's not a schematic. ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | If Nancy Pelosi gave Obama one of her balls, they'd both have two.

formatting link

\ I looked at teh Taos sensors, but they have three problems.

  1. They are difficult to get to work reliably, as there are calibration and setup values that are under specified.

  1. They can be quite expensive! I am trying to get this as low cost as possible.

  2. They are close to being obsoleted by the manufacturer! You can barely find them on their website. I don't think sales were what they had hope for.

Thanks!!!!

Charlie

Ok, one more detail. The sensor area is surrounded by black cardboard above and below the width of the case, with a half inch square hole directly in front of the sensors and providing the aperature through the front clear window.

Charlie

Darn, got the link above it!

formatting link

;-)

Charlie

[snip]

You're dealing in DC, plus tempco's, plus distance to colored object.

Perhaps "rotating" pulsing of LED's (from same _current_source_) and look at the relative outputs "simultaneously"? ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | If Nancy Pelosi gave Obama one of her balls, they'd both have two.

me

aking

nd

the

rk

he

into

ng

...

or

s
a
2000

the

then

cale

,
y
t

ge tempco

optics

hout

C

Alternative: modulate the LEDs, and make a synchronous detector in software. That eliminates background light, and you won't need as much filtering (just enough so the detector doesn't rail).

-- Cheers, James Arthur

leds/optics

Actually, in most of my test cases so far, outside light has not been a problem. The case, while an almond color, does a pretty good job of reducing the spill light. The cardboard insde does a good job of reducing that spill to very low levels. I do measure background illumination (one function is to test if a light is on, or not) and, even with the same gain levels as for the LEDs, I typically get levels of around 10-15 (out of 2048) and I compensate for that in software...

Charlie

Hmmm...

Object is designed to be pressed against the front window, so distance is always pretty much the same.

Are you thinking to PWM the LEDs? Or just turn on - measure- turn off- measure-turn on-measure?

Thanks, Charlie

Might be worth a try crudely compensating the gain with an NTC thermistor if thermal drift can be proven as the root cause.

That is probably the right solution and uses half as much power to the LEDs. This would eliminate all DC components. Setting the integration period to be 1/60s or a multiple would be a good idea.

Regards, Martin Brown

...

=A0 =A0 =A0...Jim Thompson

=A0 =A0...Jim Thompson

Just a series of "on, measure, off, measure, subtract" cycles eliminate ambient light, and isolate your signal from ambient and noise. Do you do that?

The phototransistor sensor is drifty--its gain changes rapidly with temperature. That affects all channels equally, so the ratios are not a necessarily a problem if you do the math right, but it just looks like that's not what's happening.

For example, if your ambient light level changes, and you adjust your digital pot as you described for a particular value, then using simple a a/d conversion that calibration value's *scale* factor is now heavily dependent on the ambient light level at the time of

*calibration*.

The *gain* for that channel is then set incorrectly.

Modulating the LEDs, synchronous detection, and using a photodiode are all still great ideas, but, on reflection, your immediate problem may be the calibration and the math (software).

-- Cheers, James Arthur

Yep. But rapidly enough to maintain the ratios.

Although, as I ponder, what kind of LED light output versus current and temperature?

Maybe a rotating color wheel ala old-style color TV ?:-) ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | If Nancy Pelosi gave Obama one of her balls, they'd both have two.

How fast does calibration run?

How are you sequencing supply/lamp signals? You should never have all lamps disabled, while the MCP boost converter is running, or you'll biuld a large charge on its output storage cap. I'd recommend some kind of 'outside the processor' glue logic to prevent this from happening.

When switching from one colour to another, their conduction should overlap.

RL

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required