Relay life time, number of cycles to failure?

Hi,

I was curious about how long my cheap SONGLE SDR-05VDC-SL-C relay would take being switched on and off before failing. I created an arduino program that switches my relay and measures the time it takes for the relay to switch. Then from my PC I ran a small python script that switches the relay continuously and records the switching times in a file. I could achieve a switching frequency of about 30 Hz, that is the relay was switched on and off 30 times in a second.

I was expecting to kill my relay in an hour after about 100k cycles, but to my great surprise it was running for a whole day and did about 3 million cycles after which it was still fine and I only had to stop the test because I needed to get some work done on my PC. Switching the relay on takes about 5.3 milliseconds and switching it off takes about 2.3 milliseconds and these times are still the same after 3 million cycles.

Does anyone know how long these relays can run before giving up?

Thanks

Peter

Here is my arduino code:

// connect pin 7 to relay digital input
// connect gnd to relay middle
// connect pins 0 and 1 to relay left and right (order doesnt matter)

#define RELAY_IN 7
#define RELAY_OUT1 2
#define RELAY_OUT2 4
#define TIMEOUT 100000

int testRelay() {
  // this function checks if initial state is consistent, that is pin 0 and 1 are in opposite state, otherwise returns -1
  // then changes the value on pin 7 to switch the relay and waits until the states of both pins 0 and 1 change
  // if it takes longer than TIMEOUT microsecs, then returns 0
  // otherwise returns the time it takes to reach the opposite consistent state in microsecs
  unsigned long time0 = micros();
  int state1 = digitalRead(RELAY_OUT1);
  int state2 = digitalRead(RELAY_OUT2);
  if(state1==state2) return -1; // return -1 if state is inconsistent
  digitalWrite(RELAY_IN,(digitalRead(RELAY_IN)==HIGH?LOW:HIGH)); // initiate change state
  while(digitalRead(RELAY_OUT1)==state1 || digitalRead(RELAY_OUT2)==state2)  // wait for state to change
    if((micros()-time0)>=TIMEOUT) return 0; // return 0 if timeout
  return micros() - time0; // return time it took to change state
}

void setup()
{
  Serial.begin(9600);
  pinMode(RELAY_OUT1, INPUT_PULLUP);
  pinMode(RELAY_OUT2, INPUT_PULLUP);
  pinMode(RELAY_IN, OUTPUT);
}

void loop() {
  if(Serial.available()) {
    if (Serial.read()=='1')
      Serial.println(testRelay());
  }
}

Here is my python script:

import serial
import time
s = serial.Serial(
    port='COM26',\
    baudrate=9600,\
    parity=serial.PARITY_NONE,\
    stopbits=serial.STOPBITS_ONE,\
    bytesize=serial.EIGHTBITS,\
    timeout=0)
    
f=open('relay_test.txt','a')
def readLine(s, timeout):
  ss = ''
  t0= time.clock()
  while True:
    ss += s.read()
    if (time.clock() - t0) > timeout or '\n' in ss:
      return ss
  
while True:
  s.write('1\n')
  ss = readLine(s, 1)
  sss = '%f,%s\n' % (time.clock(), ss.replace('\r\n',''))
  print sss
  f.write(sss)
  f.flush()
f.close()
s.close()

Chart on the datasheet - interpret it with your current/voltage information.

Does anyone know how long these relays can run before giving up?

The main failure mode for a relay is it's output contacts (due to wear/corrosion/arcing/burning) and it's contact lifetime depends on how much voltage and current you are asking the relay to control. If you are only passing some small milliamps of current then the relay will operate at many millions of operations.

It's got cadmium in it, so don't suck it.