I've followed alot of tutorials on google for this very simple project. After switching from a 10k to 4.7k resistor commonly used I am now getting 66 under complete luminosity (this value sometimes fluctuates between 65 - 67 ??) and around 390 in darkness on A0. However I am expecting to get 0-1023. I have made sure all the connections are going to the right place could someone please explain how it's possible to get the full range of 0-1023?

``````int LDR_Pin = 1; //analog pin 0

void setup(){
Serial.begin(9600);

}

void loop(){

delay(250); //just here to slow down the output for easier reading
}
``````

It depends on the LDR.
Most LDRs have a resistance of hundreds of kilo ohms or Mega ohms in darkness.
That would result in a value of about 1023 (or close to it).

Are you sure you have a LDR ?
Could you try another LDR ?
Do you use a breadboard ? Try other connections, they have sometimes bad contacts.
Do you have a multimeter to read the actual voltage over the LDR ?
Do you have the pull-up resistor connected to +5V ? Could you measure that with a multimeter ?

thanks for the response Erdin, I understand there are many factors that can cause problems with such elemental issues.

After switching back to a 10k Ohm pull resistor in the circuit and using

``````float voltage= sensorValue * (5.0 / 1023.0);
``````

voltage = 0.35 (full brightness) voltage = 1.40 (in darkness) voltage = 5.00 (LDR removed from circuit)

I have tired 4 different LDRs which I got shipped with the Arduino starter kit on the different analog ports and get near enough the same kind of readings. so I suppose it has something to do with the LDR itself?

I don't know what is going on. The LDR in the starter kit seems to be the VT90N2 which is 500k in darkness.

Your LDR seems to be 3.9k in darkness. That can't be right. 1.4/((5-1.4)/10000) = 3.9k

Do you have a multimeter or do you know someone who does and can help. You should measure the resistor, the ldr, and the voltages.

Could you upload a photo of it, so we can see that it is the 10k resistor and not the 10M.

LDRs are not very accurate (they are very sensitive to temperature, being semiconductors).

Yes, picture would be nice of the circuit..