Pebble (Arduino shield): LDR potential divider resistor choice and calibration

35 views
Skip to first unread message

andyg (@geekscape)

unread,
Nov 3, 2009, 7:20:43 PM11/3/09
to Connected Community HackerSpace
hi All,

In Luke's schematic,the fixed resistor (R9) that provides the other
half of the LDR potential divider has a specified value of 100
Kohm ...

http://github.com/lukeweston/Pebble/blob/master/pebble-sch.png

Up until now, in the prototypes, we've been using a JayCar sourced
LDR, which has a stated range of 48 Kohm to 140 Kohm ...

http://jaycar.com.au/productView.asp?ID=RD3480

Some quick testing shows ...
- Bright sunlight outside: 300 ohm
- Bright room: 2.5 Kohm
- Moderate room or fluorescent: 6 Kohm
- Not so bright room: 13 Kohm
- Very, very dark: 10 Mohm

I found that the best range of analog input on the Arduino (ADC value
ranging between 10 and 1010), with moderate room lighting appearing
somewhere in the middle ... was achieved with R9 being a 10 Kohm
resistor. When using a 100 Kohm resistor for R9, I found that the
input range just wasn't as good for normal circumstances, e.g. ambient
room light.

Looking at Thomas' and Mitch's Pebble parts spreadsheet, I can see
that the LDR being ordered from Farnell has a stated range of 10 Kohm
to 27 Kohm. Which is different from the JayCar LDR ... so, I don't
think that we know yet, what the best choice for R9 is, until we do
some testing. But, I'd suggest that it is not likely to be 100 Kohm.

http://au.farnell.com/jsp/search/productdetail.jsp?sku=1652638

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I have a light meter that measures Lux. And, once we get our hands on
a working prototype, I'd like to start the process of calibration, so
that our light sensing produces a consistent result (in Lux). This
probably means having a calibration table in the software, with some
sensible default values, that will have to be tweaked for each
device. Especially depending upon the ultimate choices for the LDR
and R9.

Will probably also have to calibrate the DS18B20 1-wire temperature
sensor as well ... I've been seeing more variation between devices
than I expected :(

I'm going through the Aiko-Node code, improving it to handle the
various hardware configurations we have (Pebble, Gateway, etc) and
aiming to have configurable pin-outs for LDR, Temperature, LCD (with
and without 4094 8-bit shift register ... also 2 rows versus 4 rows),
and calibration tables ... in EEPROM as required. For the Aiko-
Gateway, there is also a Nintendo TouchPanel to calibrate for a given
"background control image".

It would be good to have a common, modular code base, as much as
possible, to avoid fragmentation of the various efforts.

cheers andyg (@geekscape)

Luke Weston

unread,
Nov 3, 2009, 9:24:19 PM11/3/09
to Connected Community HackerSpace

Thanks, Andy.

I agree that some fiddling around with that resistor value is good to
find the value that is optimal to get the best response over a wide
range, for some particular model of LDR.

It is worth experimenting to find that resistor value for (a) Jaycar
LDR and (b) Farnell LDR.

This is something we should investigate - simply using an LDR, an
Arduino, and one of those handy resistor selector wheels.

If you build a device that uses an LDR using some common resistor
value, such as 10 k or 100 k, it will still work of course, it just
doesn't have the optimal responsiveness over a wide range of light
levels.

andyg (@geekscape)

unread,
Nov 4, 2009, 1:11:20 AM11/4/09
to Connected Community HackerSpace
hi Luke,

On Nov 4, 1:24 pm, Luke Weston <reindeerfloti...@gmail.com> wrote:
> It is worth experimenting to find that resistor value for (a) Jaycar
> LDR and (b) Farnell LDR.

After experimentation, I believe that 10 Kohm (rather than 100 Kohm)
is a reasonable choice for the JayCar LDR.

> This is something we should investigate - simply using an LDR, an
> Arduino, and one of those handy resistor selector wheels.

This is exactly what I did for the JayCar LDR (running into dark
cupboards, into the bright sunlight and everywhere in-between).

And, will also do for the Farnell LDR (or happy for someone else to
run around too :)

> If you build a device that uses an LDR using some common resistor
> value, such as 10 k or 100 k, it will still work of course, it just
> doesn't have the optimal responsiveness over a wide range of light
> levels.

I'm keen to get some consistency between all our devices and
preferably perform some calibration (using the light meter in the
CCHS) so that everyone is using S.I units, such as Lux.

It's nice to be able to write an application that says ... turn on the
light at 50 Lux ... knowing that this will work in a similar fashion
for everyone. Rather than having to individually configure for random
uncalibrated analog input values.

cheers andyg (@geekscape)

Luke Weston

unread,
Nov 4, 2009, 9:14:10 AM11/4/09
to Connected Community HackerSpace

> I have a light meter that measures Lux. And, once we get our hands on
> a working prototype, I'd like to start the process of calibration, so
> that our light sensing produces a consistent result (in Lux). This
> probably means having a calibration table in the software, with some
> sensible default values, that will have to be tweaked for each
> device. Especially depending upon the ultimate choices for the LDR
> and R9.
>

I wonder (a) how linear a typical LDR's response is, and (b) how
consistent different devices (of a particular kind) are.

If they're quite linear, I wonder how good it would be to just have a
linear function mapping the ADC's value into Lux in software, instead
of a lookup table, with the gradient (and maybe the offset too) set by
a "fudge factor" in software that can be tweaked if need be by
calibration against the light meter?
Reply all
Reply to author
Forward
0 new messages