Pages: [1]   Go Down
Author Topic: Problem whit Photoresistor  (Read 372 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 180
Posts: 8103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

0
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You are right!  smiley-grin
Thank you so much!
Logged

Pages: [1]   Go Up
Jump to: