[Fwd: Re: Ambient light sensing via LED response]

C. Scott Ananian cscott at cscott.net
Sun May 10 16:42:17 EDT 2009

On Wed, May 6, 2009 at 6:14 PM, Reinder de Haan <rs at mveas.com> wrote:
>>     Absolutely not.  The A/D is eight bits, with an input range spanning
>>     0 - 3.3V, so the best you
>>     can hope for is about 13 mV per LSB.  I would guess actual accuracy
>>     to be closer to 26 mV.

I think the actual A/D reference voltage is probably *maximum* 3.3V.
What's the *minimum* A/D reference voltage?  And can the A/D measure
all the way down to ground?  (Sometimes there's a Vmin for the A/D
input, often around a diode drop above ground.)

> i did some more experiments and at ~20 cm from the halogen lamp i doest
> matter is i turn the backlight full on of off .. i dont have color
> anymore....
> at that distance the bare led gave about 250mv (maybe a bit more into a
> very high R fet gate...)

250mv should be a count of about 20 from the A/D.  That's plenty for
this purpose.  Heck, a count of 1 would be sufficient, as long as it
was repeatable. ;-)

So, it seems like all that's required is one wire from the top of the
LED to the A/D input, and wiring Vref directly to +3.3.  Adding a
zener and a resistor for a lower Vref would probably improve precision
and accuracy.

Everything else is software & tweaking some constants.

                         ( http://cscott.net/ )

More information about the Devel mailing list