1
\$\begingroup\$

enter image description here

http://cactus.io/hookups/sensors/light/ldr/hookup-arduino-to-ldr-sensor

I have the following circuit which was running for a long time but at one point something broke and it started producing high values such as 4133 or 30412.

I used the recommended 10K pulldown resistor, although some other guides recommend 100k this setup was working for me for a long time.

What I use LDR is an unknown brand, something cheap chinese what you can pickup for arduino kits so I checked a generic data sheet:

Cell resistance 
1000 LUX     400 Ω      
  10 LUX       9 kΩ 
Dark           1 MΩ    

My measurements show something similar. If I put my finger on the LDR the dark resistance is around 0.3 Mohm and when I point a strong flashlight to the LDR the resistance goes down to about 800 ohm which seems to be normal for me.

While the circuit was working properly it always produced values from 0-1023 and dark usually meant under 200.

What can cause this?

\$\endgroup\$
  • 1
    \$\begingroup\$ These values have nothing to do with the LDR. If it was totally shorted or open the min/max values that you can properly "read" with "analogRead" are between 0 and 1023. So my bet is that there is something wrong in your code. (unless these numbers are after some sort of mapping function..) \$\endgroup\$ – Wesley Lee May 6 at 7:46
  • \$\begingroup\$ I don't know what to make of the thing you copied from the datasheet, use the preview to make sure the information is presented as intended. \$\endgroup\$ – pipe May 6 at 7:52
  • \$\begingroup\$ @John: I tidied up your table as best I could. Please check that it now shows what you intended. \$\endgroup\$ – Transistor May 6 at 8:02
  • \$\begingroup\$ My code is as simple as analogRead(A0) and it worked for years so I just don't understand how this broke. The sensor was outdoor so I found some other post that these might break from outdoor use over time but the readings looked fine with a meter so I don't think the LDR is faulty. \$\endgroup\$ – user213858 May 6 at 8:13
  • \$\begingroup\$ "My code is as simple as analogRead(A0) ..." So how are you reading the values of 4133 or 30412? You must have code for that. \$\endgroup\$ – Transistor May 6 at 9:21
3
\$\begingroup\$

I have the following circuit which was running for a long time but at one point something broke and it started producing high values such as 4133 or 30412.

The ATMEGA328 chip used in your device has a 10-bit ADC which can only give output readings of 0 to 210-1 = 0 to 1023. Your errors suggest a code or display error.

Please edit your question to include the essential parts of your code to show the configuration, the analog read and how you are displaying the ADC value. (Use the {} code button to format the code properly and use the preview below the editor to make sure it is indented correctly before submitting.)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy