Getting only 1 as the output in ldr project

hi i am trying to do the first project which is plant monitor at first time I was getting a naN error and I resolved it but then after i am getting a value of only 1 not 1.02 thousand not any other only 1 I am trying to fix this around 2 hrs i read all the forum, tried both combination 330 and 10k ohm reguster but didn’t got the required solution please guide me thankyou

hello@saimnakhwa.02 I think u should recheck ur connections and also code for better results and also be in good connectivity of network

Hi @samikshasonawane35 mam i tried and i also checked my connection and the code but same thing is happening Thankyou for the suggestions have you done this project and on which module are you right now ? Just asking

Hi @saimnakhwa.02,
The LDR’s resistance is inversely proportional to the light intensity, and so is the reading of the analog pin, the lower the resistance, the higher the voltage on the pin.

So if you want to see 1.02 thousand, you have to expose the LDR to a lot of light, it also depends on the LDR itself and the chosen resistor for the voltage divider. Try flashing a flashlight directly on the LDR.

1.ReCheck your connections
2.Use 330 ohm resistor
3. make sure the inserted pins in Gnd and 3v3 or not touching

hello@saimnakhwa.02 yes i have successfully completed my 1st project and i think u should also check the warning given in hardware connections and troubleshoot section .And currently i have completed 50% of lectures.All the best for further!!

hi @raghav.srivastava sir thank you for your kind reply i tried that way also i used flash light but i got the same result also in lecture they said v=ir means the voltage is directly proportional to it and you said lower the resistance higher the voltage that means inversely proportion tell now before the ldr lecture i though its inversion one is correct can we connect on linkdin ?www.linkedin.com/in/saim-nakhwa-9a5b381a5
if you are ok

yes @pallerlapranavdec27 sir i tried this too but didn’t got result
can we get connected on the linkdin if possible www.linkedin.com/in/saim-nakhwa-9a5b381a5

yes mam I have gone through all the warnings but still didn;t got the solution i want
can we get connected on Linkedin if possible? www.linkedin.com/in/saim-nakhwa-9a5b381a5

can you send photos of your connections.

yes sure sir
Google Photos
i tried it too hide the ldr with my finger and flash a light on it also but in both the case i am getting output as 1
the pic is might be zoomed so click it too view

@saimnakhwa.02 You see,

Here the voltage is inversely proportional to the resistance of LDR because we are using a voltage divider circuit.

You see V=IR. And if LDR’s resistance is higher, more voltage across it and hence lesser voltage across the other resistor and ground and vice-versa,

Remember, we are measuring the voltage across the other resistor and ground.

Remember here we are dealing with series resistance. Let me explain you in a simpler way.
Answer this if there’s a battery,a Led and a wire connecting them . What will increase the Voltage across the LED, a wire with less resistance or more? Obviously, the wire with the lower resistance. The LDR is like that wire only in this case.

@saimnakhwa.02 As requested by you,I will send you a request to connect on LinkedIn you shortly

Sir what you was telling about the resistor problem

@saimnakhwa.02 Even I faced the same problem where i was getting 1.02 thoushand
replace your resistor with 330ohm will solve the issue
or check ldr connections if the problem goes on

@saimnakhwa.02 YOU are using the 10ohm resistor from the image i have seen that
use 330 ohm that will definetely solve the issue.

@virajent12 sir i tried with both resistor and you are getting 1.02 thousand and i am getting only 1 it’s different i have tried the solution which you are talking about
Well thankyou for guidance
Do you have any other suggestions ?

@saimnakhwa.02 Can you please share the code you are using?


i think its correct

@saimnakhwa.02 I got the error. Instead of pin A0, you have configured pin 0. Pin 0 is a digital pin and can either read 0(negligible voltage/0V) or 1(Significant Voltage Present like around 3.3V or maybe a little lesser or higher).

Analog pins can read multiple voltage levels(1024 levels) between 0V and 1V.