Ambient light sensing via LED response

C. Scott Ananian cscott at laptop.org
Tue May 5 01:07:26 EDT 2009


On Fri, May 1, 2009 at 11:59 PM, John Watlington <wad at laptop.org> wrote:
>> Oh, yeah, you should be able to wire the top side of the LED directly to
>> the LED and measure the photovoltaic current directly; that's not patented:
>>                  battery voltage
>>              Q1  |
>> ---from EC------|< _____ to A/D
>>                  |
>>             LED  V
>>                  |
>>                 GND
>>
>> The only question is whether the LED can put out enough photovoltaic
>> current to be reliably measured by the A/D.
>
> Ahh, therein lies the challenge!
>
>> Depends on what the input to the A/D looks like, how much capacitance it
>> sees, etc.
>
> Thought the KB3700 (EC) A/D datasheet frustratingly doesn't list any such
> exotic parameter
> as input impedance, I asked ENE and they said that the input was high
> impedance CMOS
> (think a MOSFET gate, in the wee, wee microamps).   The impedance also does
> not vary
> (even though the A/D is muxed).

Hm.. What's the input voltage range -- ie, how small can it be?  Even
in full brightness, you're not going to see more than the LED's
forward voltage drop -- which admittedly can be up in the 2 volt
range, depending on your color, but you really want to be working well
below the forward voltage drop, so that the self-discharge current
through the LED isn't significant.  See

http://en.wikipedia.org/wiki/Solar_cell#Equivalent_circuit_of_a_solar_cell

At low voltage, I_D will be small, and assuming infinite input
impedance, I will be zero, so your sensitivity is set by R_SH, the
equivalent shunt resistance of the LED (where you want R_SH as high as
possible).

> Sorry, no parts count increases allowed except for one LED, resistors,
> capacitors (basically free), and maybe
> one transistor, diode, or NMOS MOSFET (about a penny).   I will throw in a
> couple of EC digital outputs, and
> a day of Richard's time in EC code.

Really, the easiest way to do this is just to run a wire from the
positive side of the LED to the A/D, set the A/D reference voltage as
low as possible, and then take it out into the sun and measure what
you've got.  If you generate measurable voltage at too dim a light
level, it's easy to add a shunt resistor (although you'll probably
want to switch the shunt resistor in only when the LED is off), but to
get more voltage...

I think you could probably add a capacitor in parallel to the LED to
integrate the photocurrent over time to generate higher voltage, but
bottom-line your A/D has to be comfortable with voltages around the
voltage drop of the LED, since you'll never generate more than that.
Your maximum voltage even with the paralleled capacitor will be
limited by the self-discharge through the diode; again, it should be
straightforward to put a low ESR cap of a few nF in parallel, take it
outside, and see what voltage you generate.

A last resort would be hooking up a MOSFET as a simple amplifier --
again, you're not worried about linearity or any such niceties, but
you'd still need a good match for your MOSFET's threshold voltage...
some real measurements to replace the WAGes would go a long way.
  --scott

-- 
                         ( http://cscott.net/ )



More information about the Devel mailing list