For the first project when I put a finger on LDR as adviced I get a value between 300 to 500. Otherwise I am getting 1.02 as the constant value.
@aanchalachal can you please attach the code where you are getting 1.02. Its reading so because the highest value a LDR can read is 1024 which means the intensity is high, please look weather it is 1024 or 1.02 by looking in to the code
Generally in LDR when intensity of light increase it’s resistance decrease and in low light or darkness we get highest resistance…In my case I observed that when i put a flash on ldr the reading was 1.2k and in normal house lighting it was 150-200 and when I cover it with hand it give the intensity of 15. I think that should help you @aanchalachal and as @yeshwanthpatel99 has already said that it’s limit is near about 1024
it is actually 1.02k value …as for me i got 1.02 thousand it is because LDR offers high much of intensity … because resistance offered is low when light is on, they are inversely proportional.
Here in the project as the light intensity increases, the voltage on the analog input pin also increases .The module will convert this voltage into a 10 bit digital value that varies from 0-1023(2^10 minus 1) .So 1.02 is the maximum value you will get if the LDR is left in open daylight .Any change in the intensity of light will also result in the change of the analog voltage.
V(A0) = 3.3*(R1)/(R1+Rldr) by voltage division. If you want to have some useful data(not some constant value) after removing your finger from the LDR, you can do so by replacing R1=1k by a lower resistance like 330 ohm.
Also, for a 10 bit ADC only 1024 level are possible, so the output can only be within the dynamic range of 0-1023.
Hope that helps.