Issues in interfacing relay with Arduino I want to control AC bulb with Arduino, 5v-relay.
My connections are



My code is

#define RELAY1  7

void setup() 
{
  pinMode(RELAY1, OUTPUT);
  Serial.begin(9600);
}

void loop() 
{
  digitalWrite(RELAY1,LOW); // Turns ON Relays 1
  Serial.println("Light OFF");
  delay(15000); // Wait 5 seconds
  digitalWrite(RELAY1,HIGH); // Turns Relay Off
  Serial.println("Light ON");
  delay(20000);
}



Red LED is on according to AC bulb.
Power LED (Green colored one) is also on as I have given 5v supply from Arduino.


The issues are


Bulb is not following the delay given in the code. The output for the above code is 20sec ON - 15sec OFF -20sec ON - 15sec OFF- 20sec ON -15sec OFF -  1sec ON - 20sec ON - 15sec OFF etc. means apart from 20,15 sec duration there is a duration of 1sec is coming in between as noise. What might be the reason?
On monitor also, only first 3 actions are getting printed after that no printing is observed.


==>The relay I am using is:
what i would do is test the parts one by one.
so first look if you're signal is good by attaching a led to it.
then test you're relay with 5v.

now you should know what the problem is the arduino or the relay