From: MooseFET on
On Mar 1, 8:54 am, Charlie E. <edmond...(a)ieee.org> wrote:
> Hi Guys,
> Ok, going to put myself in harms way, and ask for a little design
> advice.  I have been working on this project for a while now, and it
> has gone through several iterations, and I keep having the same
> problem!
>
> First, the project:  I am designing a small color reader for the
> visually impaired.  Really simple operation - put it against the
> object you want to tell the color of, and it will say "RED" or
> whatever the color is.  Sensor is simply an RGB LED and a
> phototransistor, buffered by some amps, and then digitized by a PIC24.
> So, what's the problem?  I can't get a stable reading.  In normal
> operation, this thing will run for about two seconds, and then be
> turned off.  To test, however, I run it in debug mode for hours.  When
> I first turn it on, and calibrate it to a white sample, I will get one
> set of calibrations.  Let it sit for about two minutes, and it starts
> to drift.  In about half an hour, I will have readings totally off the
> scale.
>
> So, why am I baring my soul to ya'll?  I need your help identifying
> where the gain drift is coming from, and some ideas on how to control
> them.  I have the schematic here:
>
> http://edmondsonengineering.com/Documents/Rainbow%20color%20Reader%20...
>
> Basic description - MCU turns on an LED.  The phototransistor is first
> buffered by a non-inverting opamp with a gain of 2, and the signal is
> split.  Part goes directly to a PGA where it is first attenuated, and
> then the PGA boosts it up.  This gives me a calibration control to
> deal with difference in output of the LEDs.  The original and PGA
> signal are added, and this is then applied to another non-inverting
> opamp with a gain of 2.  I also have one feed before this opamp to an
> ADC input on the PIC.
>
> Problems I have already solved:
> First, each LED has a different output level.  Red needs a gain of
> around 2, BLUE a gain of around 5, and GREEN a gain of about 7.  The
> PGA was added to give me an adjustable gain from around 2 to 14, with
> the two different taps into the separate input channels of the PGA.
> This gives me 16 different gain levels to play with.  Using the tap to
> the second ADC channel, it actually gives me 32 different levels.
>
> Right now, RED uses this lower gain channel, and is steady as a rock.
> Part of this may be that my VCC is 3.3 volts, and only RED has a
> forward voltage below this.  Both GREEN and BLUE have forward voltages
> of 3.4 volts.
>
> So, potential problems?  could it be that repeated use warms up the
> GREEN and BLUE LEDs so that they become more efficient?  Could the
> power supply drift higher as it warms up?  Could the opamps drift with
> slight changes in temperature?  Any advice ya'll can give will be most
> appreciated.
>
> Thanks,
> Charlie

How about:

Schottky LED
Vcc ---->!--------+-----/\/\---->!----GND
!
===C
!
PIC port

When you pull the port pin low, the capacitor gets
charged. When you take it high again you get a pulse
of light from the LED.

From the shape of the pulse, you can get a reasonable
guess at the forward voltage of the LED. Thus you can
normalize for that drop.
From: news on
On Mon, 01 Mar 2010 10:55:36 -0800, Tim Wescott <tim(a)seemywebsite.now>
said:
> Charlie E. wrote:
> > On Mon, 01 Mar 2010 09:57:43 -0800, Joerg <invalid(a)invalid.invalid>
> > wrote:
> >
> >> Joerg wrote:
> >>> Charlie E. wrote:
> >>>> On Mon, 01 Mar 2010 09:32:56 -0800, Joerg <invalid(a)invalid.invalid>
> >>>> wrote:
> >>>>
> >>>>> Charlie E. wrote:
> >>>>>> Hi Guys,
> >>>>>> Ok, going to put myself in harms way, and ask for a little design
> >>>>>> advice. I have been working on this project for a while now, and it
> >>>>>> has gone through several iterations, and I keep having the same
> >>>>>> problem!
> >>>>>>
> >>>>>> First, the project: I am designing a small color reader for the
> >>>>>> visually impaired. Really simple operation - put it against the
> >>>>>> object you want to tell the color of, and it will say "RED" or
> >>>>>> whatever the color is. Sensor is simply an RGB LED and a
> >>>>>> phototransistor, buffered by some amps, and then digitized by a PIC24.
> >>>>>> So, what's the problem? I can't get a stable reading. In normal
> >>>>>> operation, this thing will run for about two seconds, and then be
> >>>>>> turned off. To test, however, I run it in debug mode for hours. When
> >>>>>> I first turn it on, and calibrate it to a white sample, I will get one
> >>>>>> set of calibrations. Let it sit for about two minutes, and it starts
> >>>>>> to drift. In about half an hour, I will have readings totally off the
> >>>>>> scale.
> >>>>>>
> >>>>>> So, why am I baring my soul to ya'll? I need your help identifying
> >>>>>> where the gain drift is coming from, and some ideas on how to control
> >>>>>> them. I have the schematic here:
> >>>>>>
> >>>>>> http://edmondsonengineering.com/Documents/Rainbow%20color%20Reader%20Schematic.pdf
> >>>>>>
> >>>>>>
> >>>>>> Basic description - MCU turns on an LED. The phototransistor is first
> >>>>>> buffered by a non-inverting opamp with a gain of 2, and the signal is
> >>>>>> split. Part goes directly to a PGA where it is first attenuated, and
> >>>>>> then the PGA boosts it up. This gives me a calibration control to
> >>>>>> deal with difference in output of the LEDs. The original and PGA
> >>>>>> signal are added, and this is then applied to another non-inverting
> >>>>>> opamp with a gain of 2. I also have one feed before this opamp to an
> >>>>>> ADC input on the PIC.
> >>>>>>
> >>>>>> Problems I have already solved:
> >>>>>> First, each LED has a different output level. Red needs a gain of
> >>>>>> around 2, BLUE a gain of around 5, and GREEN a gain of about 7. The
> >>>>>> PGA was added to give me an adjustable gain from around 2 to 14, with
> >>>>>> the two different taps into the separate input channels of the PGA.
> >>>>>> This gives me 16 different gain levels to play with. Using the tap to
> >>>>>> the second ADC channel, it actually gives me 32 different levels.
> >>>>>>
> >>>>>> Right now, RED uses this lower gain channel, and is steady as a rock.
> >>>>>> Part of this may be that my VCC is 3.3 volts, and only RED has a
> >>>>>> forward voltage below this. Both GREEN and BLUE have forward voltages
> >>>>>> of 3.4 volts.
> >>>>>>
> >>>>>> So, potential problems? could it be that repeated use warms up the
> >>>>>> GREEN and BLUE LEDs so that they become more efficient? Could the
> >>>>>> power supply drift higher as it warms up? Could the opamps drift with
> >>>>>> slight changes in temperature? Any advice ya'll can give will be most
> >>>>>> appreciated.
> >>>>>>
> >>>>> As Jim hinted, the first order of business would be to regulate the
> >>>>> current that goes through each LED. A resistor that drops only very
> >>>>> little voltage isn't going to cut it.
> >>>> So, my first stupid mistake was using a VCC of 3.3 volts with LEDs
> >>>> that required 3.4! Not an easy problem to fix.
> >>>>
> >>>> Makes me really wish that the PSOC1s had built in debug capability.
> >>>> They could run at 5 VDC...
> >>>>
> >>> It can be fixed. You'd need three step-up (boost) converters and a small
> >>> resistor in front to each and then regulate. If it has to be cheap you
> >>> could try to regulate with the uC. Alternatively one step-up and three
> >>> linear ones but LDOs are often rather buggy and if you boost to 6V or
> >>> more for a proper linear regulation you'll waste a lot of power.
> >>>
> >>> Yet another option: Supply the PIC with 3.3V or whetever it needs and
> >>> the LED with more. But even with several volts of headroom a resistor is
> >>> not a constant current source. However, you can make a uC-controllable
> >>> current source with two transistors and two resistors per LED, no big
> >>> deal. AoE figure 2.25, just flipped around using NPNs and R1 goes to a
> >>> PIC port pin.
> >>>
> >>> This will improve things massively. If that's still not low-drift enough
> >>> you can use an opamp current source.
> >>>
> >> P.S.: If the cathodes are tied together the last idea only works if you
> >> leave the current source up against positive, like in the AoE example.
> >> Then drive either with a 5V uC or a logic level FET and add a resistor
> >>from base to positive supply.
> >
> > Joerg,
> > Thanks for the advice. Yes, I had been concentrating so hard on the
> > amplifiers I never really considered the LEDs. In my mind, they would
> > just 'work' and I could then adjust accordingly. Didn't realize that
> > they would vary that much. Will have to look at maybe adding a higher
> > voltage, and go with the constant current drives for them. This does
> > need to be pretty accurate!
>
> Consider using a photodiode instead of a phototransistor -- it _should_
> be more linear and predictable.

Yep. Phototransistors are horrible for this sort of application.
Linearity, unit-to-unit repeatability, temperature drift will all ruin
your measurement.
A photodiode with transimpedance amplifier should do what you want. If
you have a large dynamic range to cover, consider an integrating amp -
this allows you to control the overall gain by varying the integration
time, which should save a few parts.

HTH

R.

From: Robert Baer on
Charlie E. wrote:
> Hi Guys,
> Ok, going to put myself in harms way, and ask for a little design
> advice. I have been working on this project for a while now, and it
> has gone through several iterations, and I keep having the same
> problem!
>
> First, the project: I am designing a small color reader for the
> visually impaired. Really simple operation - put it against the
> object you want to tell the color of, and it will say "RED" or
> whatever the color is. Sensor is simply an RGB LED and a
> phototransistor, buffered by some amps, and then digitized by a PIC24.
> So, what's the problem? I can't get a stable reading. In normal
> operation, this thing will run for about two seconds, and then be
> turned off. To test, however, I run it in debug mode for hours. When
> I first turn it on, and calibrate it to a white sample, I will get one
> set of calibrations. Let it sit for about two minutes, and it starts
> to drift. In about half an hour, I will have readings totally off the
> scale.
>
> So, why am I baring my soul to ya'll? I need your help identifying
> where the gain drift is coming from, and some ideas on how to control
> them. I have the schematic here:
>
> http://edmondsonengineering.com/Documents/Rainbow%20color%20Reader%20Schematic.pdf
>
> Basic description - MCU turns on an LED. The phototransistor is first
> buffered by a non-inverting opamp with a gain of 2, and the signal is
> split. Part goes directly to a PGA where it is first attenuated, and
> then the PGA boosts it up. This gives me a calibration control to
> deal with difference in output of the LEDs. The original and PGA
> signal are added, and this is then applied to another non-inverting
> opamp with a gain of 2. I also have one feed before this opamp to an
> ADC input on the PIC.
>
> Problems I have already solved:
> First, each LED has a different output level. Red needs a gain of
> around 2, BLUE a gain of around 5, and GREEN a gain of about 7. The
> PGA was added to give me an adjustable gain from around 2 to 14, with
> the two different taps into the separate input channels of the PGA.
> This gives me 16 different gain levels to play with. Using the tap to
> the second ADC channel, it actually gives me 32 different levels.
>
> Right now, RED uses this lower gain channel, and is steady as a rock.
> Part of this may be that my VCC is 3.3 volts, and only RED has a
> forward voltage below this. Both GREEN and BLUE have forward voltages
> of 3.4 volts.
>
> So, potential problems? could it be that repeated use warms up the
> GREEN and BLUE LEDs so that they become more efficient? Could the
> power supply drift higher as it warms up? Could the opamps drift with
> slight changes in temperature? Any advice ya'll can give will be most
> appreciated.
>
> Thanks,
> Charlie
Wild guesses: 1) the photodetector is temperature sensitive, #2:
ambient light is driving it (big variable).
Not guess: LED output color and intensity vary with temperature, and
at any reasonable drive for "bright" they warm up. Heatsink them as much
as possible - 1 to 10W heatsinking on each lead...
From: Jan Panteltje on
On a sunny day (Mon, 01 Mar 2010 16:28:59 -0800) it happened Charlie E.
<edmondson(a)ieee.org> wrote in <8rmoo5h0f7i9s6c07el0t5iqumslahu7g1(a)4ax.com>:

>Hi Jan,
>As you read the rest of the thread, everyone is pretty convinced the
>problem is improper LED drive. At present, the three different LEDs
>all have different outputs, making it necessary to have a variable
>input amp to get the voltages to the right levels.

I did some experiments some time ago with R, G, and B LEDs to make white:
ftp://panteltje.com/pub/rgb_leds_series_white_img_0837.jpg
Using the same current (here in series) gives too much blue.
If you look at the color TV system, and I dunno your background,
but let's do some math, they 2 make color-difference signals,
those signals chosen so they are zero in a BW picture.
Then those 2 signals are used to modulate 2 90 degrees shifted carriers.
The resulting vector has a amplitude corresponding to the color *saturation*,
and an angle corresponding to the color.
You have to use these 2 if you uniquely want to point to a color.
It goes something like this (and assume your LEDs have similar efficiency for a moment,
but of course they do not, but as a starting point:

For the human eye sensitivity 'white' 'Y' can be composed of:
y = (.3 * red) + (.59 * green) + (.11 * blue)

So for less blue is needed, a bit of red, and mostly green.
You can then make 2 signals,
'r - y' and 'b - y',
Those can be both positive and negative.

Now use them like this:
+
r - y
|
|/ v
- -- -- b - y +
|
|
-
Now calculate a vector v, its phase will be the color, and it's amplitude the saturation.

Now you can compare one number only, the angle, to a table of colors.
And that is independent of any saturation variations.
'Saturated yellow' versus 'yellow'.
It is called the color circle', what a TV vectorscope would show.
ftp://panteltje.com/pub/vectorscope.gif
In the circle you see some colors marked:
red, green, blue, manganese, cyan, yellow, each color has its own angle.
That is how I would probably go about it.
I would not use this idea with the LEDs emitting, as it cannot measure the color of *emitted* light.
One of of the things measuring the color of emitted light would be useful for is to adjust monitors.
This subject was discussed here a while ago, and somebody recommended a chip, IIRC the TCS230D,
and pointed to a project, lost the link, but googling for TCS230 finds many:
http://www.flickr.com/photos/arms22/3241371664/

Hope any of this helps :-)



From: dagmargoodboat on
On Mar 1, 10:03 pm, MooseFET <kensm...(a)rahul.net> wrote:
> On Mar 1, 8:54 am, Charlie E. <edmond...(a)ieee.org> wrote:
>
>
>
> > Hi Guys,
> > Ok, going to put myself in harms way, and ask for a little design
> > advice.  I have been working on this project for a while now, and it
> > has gone through several iterations, and I keep having the same
> > problem!
>
> > First, the project:  I am designing a small color reader for the
> > visually impaired.  Really simple operation - put it against the
> > object you want to tell the color of, and it will say "RED" or
> > whatever the color is.  Sensor is simply an RGB LED and a
> > phototransistor, buffered by some amps, and then digitized by a PIC24.
> > So, what's the problem?  I can't get a stable reading.  In normal
> > operation, this thing will run for about two seconds, and then be
> > turned off.  To test, however, I run it in debug mode for hours.  When
> > I first turn it on, and calibrate it to a white sample, I will get one
> > set of calibrations.  Let it sit for about two minutes, and it starts
> > to drift.  In about half an hour, I will have readings totally off the
> > scale.
>
> > So, why am I baring my soul to ya'll?  I need your help identifying
> > where the gain drift is coming from, and some ideas on how to control
> > them.  I have the schematic here:
>
> >http://edmondsonengineering.com/Documents/Rainbow%20color%20Reader%20...
>
> > Basic description - MCU turns on an LED.  The phototransistor is first
> > buffered by a non-inverting opamp with a gain of 2, and the signal is
> > split.  Part goes directly to a PGA where it is first attenuated, and
> > then the PGA boosts it up.  This gives me a calibration control to
> > deal with difference in output of the LEDs.  The original and PGA
> > signal are added, and this is then applied to another non-inverting
> > opamp with a gain of 2.  I also have one feed before this opamp to an
> > ADC input on the PIC.
>
> > Problems I have already solved:
> > First, each LED has a different output level.  Red needs a gain of
> > around 2, BLUE a gain of around 5, and GREEN a gain of about 7.  The
> > PGA was added to give me an adjustable gain from around 2 to 14, with
> > the two different taps into the separate input channels of the PGA.
> > This gives me 16 different gain levels to play with.  Using the tap to
> > the second ADC channel, it actually gives me 32 different levels.
>
> > Right now, RED uses this lower gain channel, and is steady as a rock.
> > Part of this may be that my VCC is 3.3 volts, and only RED has a
> > forward voltage below this.  Both GREEN and BLUE have forward voltages
> > of 3.4 volts.
>
> > So, potential problems?  could it be that repeated use warms up the
> > GREEN and BLUE LEDs so that they become more efficient?  Could the
> > power supply drift higher as it warms up?  Could the opamps drift with
> > slight changes in temperature?  Any advice ya'll can give will be most
> > appreciated.
>
> > Thanks,
> > Charlie
>
> How about:
>
>          Schottky               LED
>  Vcc ---->!--------+-----/\/\---->!----GND
>                    !
>                   ===C
>                    !
>                 PIC port
>
> When you pull the port pin low, the capacitor gets
> charged.  When you take it high again you get a pulse
> of light from the LED.

Absolutely. Instead of using a PIC port, he could tie the cap to his
DC-DC converter's switch node. That makes a common Vled supply, ...

Vcc
-+-
|
V D1
._. ---
_| |_ C1 | D2 Vled
>------||---o-->|--o-----.
| |
--- C2 |
--- |
| |
=== |
|
.--------+--------+
| | |
R1 R2 R3
| | |
| LED-R |LED-G | LED-B
V ~> V ~> V ~>
--- --- ---
----. | | |
| Q1 | | |
|-|>-' Q2 | |
PIC |------|>-----' Q3 |
|---------------|>-----'
|
----'


The phototransistor Hfe drifts a lot with temperature, but that's
common to all channels; software can remove it.

Seconded: Tim's suggestion for optical feedback on the LEDs' output.


--
Cheers,
James Arthur
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Prev: Magnetism is really -- WHAT?
Next: low-end scope