Go Down

Topic: Problem whit Photoresistor (Read 456 times) previous topic - next topic

icp

Hi folks! I'm trying to make a solar tracker as project for high school, the sketch works fine but the problem are the photoresitors that every time give me back the max value (1023).. I shall put my finger on the photoresitor to recive a lower input and moving the servo.
How I can fix this? Thanks!

johnwasser

It sounds like the fixed resistor between the input pin and ground is not connected.

If you connect an input pin to +5 through a resistor, even a Light Dependent Resistor, it will read 1023 all the time.  To get a range of value you also need a resistor going to Ground for the LDR to fight against.  Pick a resistor about half-way between the dark resistance of the LDR and the resistance in sunlight.  That will put that mid-brightness point around 512 on the analog input.  Brighter lights will get you a higher reading and lower lights will get a lower reading.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

icp

You are right!  :D
Thank you so much!

Go Up