Light-dependent resistor (LDR) failing.

Hi,

I control my garden lights automatically depending on light levels inside and outside. (when its dark outside but lights are on inside the house, the garden lights go on).

I use 2 LDR voltage dividers with a 10KΩ resistance to measure the light, but the LDR for outside fails every couple of weeks/months.

It's resistance range will become something like 300-1000Ω (very bright to darkness). Only very bright light will make the resistance drop below 1000Ω - it seems the LDR is "leaking" current - no light doesn't increase the resistance anymore.

New LDRs have a range of somehing like 150-500,000Ω.

I'm wondering why is this happening... - Do they break due to the cold outside? - Do they break because of moisture (although they don't get wet but are exposed to outside air) - Will they break due to constant usage? (current is flowing through the LDR all the time?)

I have even tried another brand but it does the same.

Is this a known thing for LDRs? Thanks for any hints.

http://forum.arduino.cc/index.php?topic=349539.0

You don’t have to power the sensor constantly, only when you want to read it, every say 5 minutes.
Here’s a sketch I made for my back deck lights, you might get some ideas.

const byte ainPin = 0;// analog input pin 0
const byte powerPin = 2;
const byte exciterPin = 13;
unsigned long startTime;
const unsigned long endTime = 1000UL * 60 * 5; // 5 minutes
int liteLvl;
const int darkLvl = 100;
bool timing = false;

void setup() {
  pinMode(exciterPin,OUTPUT);
  startTime = millis();
}

void loop() {
  if(millis() - startTime > endTime){
    startTime = millis();// reset timing
    timing = false;
  }  
  if(timing == false){
    digitalWrite(exciterPin,HIGH);// apply voltage to sensor
    liteLvl = 0;
    for(int i = 0;i < 16;i++)
      liteLvl += analogRead(ainPin);
    liteLvl /= 16;
    if(liteLvl < darkLvl - 10)
      digitalWrite(powerPin,HIGH);// deck lites on
      else if(liteLvl > darkLvl + 10)
        digitalWrite(powerPin,LOW);// deck lites off
    delay(50);    
    digitalWrite(exciterPin,LOW);// remove voltage from sensor    
    timing = true;      
  }
}

Connect your sensor to a digital pin set as OUTPUT, 13 in this case, but you change it to suit, line 9 sets dark level, 100 in my case, I used a hysteresis of + and - 10 so clouds won’t false trigger it, you can change to suit. Pin 2 is output to light relay.
BTW, try to aim your sensor so it never gets direct sunlight, that will shorten its life.

Wawa: http://forum.arduino.cc/index.php?topic=349539.0

thanks, but my LDR is not in direct sunlight, and it deterorates very quickly to useless. So I either have very bad quality LDRs so far or something else is going on.

outsider:
You don’t have to power the sensor constantly, only when you want to read it, every say 5 minutes.
Here’s a sketch I made for my back deck lights, you might get some ideas.

Thanks - I was already thinking of this, hence my question about powering it constantly. But I need to have comfirmed first if powering the sensor constantly is actually shortening its life considerably.

Strangely, the indoor LDR is working for months already… And the outdoor LDR is not in direct sunlight.

Maybe I should switch to some other light sensor type.

When and if mine fails I'm going to try a small solar cell like a small one salvaged from a toy or similar.

outsider: When and if mine fails I'm going to try a small solar cell like a small one salvaged from a toy or similar.

Oh that's a great tip - Thanks.