user11518: 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: 


user15022: 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

11518: <p>I want to control AC bulb with Arduino, 5v-relay.
My connections are</p>

<p><a href="https://i.stack.imgur.com/iiZRK.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iiZRK.jpg" alt="enter image description here"></a></p>

<p>My code is</p>

<pre class="lang-c prettyprint-override"><code>#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);
}
</code></pre>

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

<p>The issues are</p>

<ol>
<li><p>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?</p></li>
<li><p>On monitor also, only first 3 actions are getting printed after that no printing is observed.</p></li>
</ol>

<p>==>The relay I am using is: </p>

<p><a href="https://i.stack.imgur.com/KBLdr.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KBLdr.jpg" alt="enter image description here"></a></p>
 15022: <p>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.</p>

<p>now you should know what the problem is the arduino or the relay</p>
