LDR

if we connect ldr to one of analog input pin.does the change in resistance converted to digital value or the voltage which changes by potential divider circuit converted to digital value or niether.

if we connect ldr to one of analog input pin

Still have not gotten that search 'thing' worked out, ugh? (Rhetorical - do not answer!)

Ray

The circuit diagram in that website seems to be correct. You might need to take into account, that the resistance of different LDR's varies, a lot. In order to observe meaningful changes at the analog input, the resistance of the other resistor needs to be in the same ballpark as the resistance of your LDR.

For example, some LDR have a high resistance of 10 Mohm when "dark" and only fall to 100 kOhm when "light". If you connected that with a 1kOhm resistor as shown in that diagram, then the analog input is always going to read 1022 or 1023 regardless of the light level. But if you used a 1 MOhm resistor, then the analog voltage would vary from 4.5 Volts when dark, to 0.5 volts when light, and you would easily see the difference.

So if you are still having trouble, try measuring the resistance of your LDR device.

There used to be a really good LDR tut at adafruit, but I've not been able to find it since they re-arranged the learning part. Maybe someone else will have more luck? It showed the effect of the resistor's value on the LDR sensitivity.

Have a look for it and if you find it, post the addy back here.

used to be a really good LDR tut at adafruit

The first 2 seem to be linked through the page-forward button.

Ray

Last time I tried it all just hung up- might have been a newtork temp problem, thanks.

Last time I tried it all just hung up- might have been a newtork temp problem, thanks.

Probably the U.S. Homeland security, FBI, CIA, and numerous organizations too secret to even have a name are looking over the links even as I type…

See overview attached. May help.

Ray

1-Overview _ Photocells _ Adafruit Learning System.pdf (416 KB)

2-Using a Photocell _ Photocells _ Adafruit Learning System.pdf (1.13 MB)

3-Basic Photocell Reading _ Basic Resistor Sensor Reading on Raspberry Pi _ Adafruit Learning System.pdf (1.41 MB)

michinyon:
resistance of the other resistor needs to be in the same ballpark as the resistance of your LDR.

imo more important is considering ambient light level. ive never found it necessary to use anything but built-in pullups. at a dime ea it dont hurt to buy more than one sensitivity type. in my case having a few GL5516 and GL5539 on hand cover just about every possible light level w/o need for an external resistor.