Activation of two relays

Hi there!!!My first post in the forum!
I m sending cause I could use some help with a simp project that I m trying to make.
I want to use two relays to give light to an RGB strip light.
The relays work fine if I light them individual.The problem is when I want them both ON!
For example...I light the first one.Everything fine!When I light the second one,without turning o the first one,it doesn't give me the light I want.(e.g. purple)You know why this happens?

#define RELAY1 9
#define RELAY2 8

int red = 7;
int green = 6;
void setup()
{
Serial.begin(9600);
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
pinMode(green , OUTPUT);
pinMode (red , OUTPUT);

}

void loop()
{
digitalWrite (green,LOW);
digitalWrite(RELAY1,HIGH); // Turns ON Relay1
Serial.println("Light ON");
delay(2000); // Wait 2 seconds

digitalWrite(RELAY1,LOW); // Turns Relay1 Off
Serial.println("Light OFF");
delay(2000);

digitalWrite (red,LOW);
digitalWrite(RELAY2,HIGH); // Turns ON Relay2
Serial.println("Light ON");
delay(2000); // Wait 2 seconds

// Turns Relay Off
digitalWrite(RELAY2,LOW); // Turns OFF Relay2
Serial.println("Light");
delay(2000);
digitalWrite(RELAY2,HIGH); // Turns ON Relay2
Serial.println("Light ON");
delay(2000);
digitalWrite(RELAY1,HIGH); // Turns ON Relay1
Serial.println("Light ON");
delay(2000);
}

note:the led of the relay it turns ON but it doens do the "click" sound.

What do the debug prints say?

Please remember to use code tags when posting code.

Firs of all thank you for your fast reply!
What do you mean debug print?The Serial printing I make?Those are working fine.
I thought that the problem might be volts of arduino that comes out and go to the realy but I m not sure..
Sorry for the wrong posting of my code :-/

Hey man, just a thought make sure your arduino and the relays share the same 5v. If you're trying to run the relays with separate 5v And then trying to trigger with your digital pins it will light but not "click". Hope this helps I spent a lot of time with relays. :grin:

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png or pdf?

Tom..... :slight_smile:

Hey man, just a thought make sure your arduino and the relays share the same 5v.

I would advise that the relays are powered from an external source with a common GND connection. This will avoid any problem with a Arduino pin being expected to supply more than its rated current.

Are you quite sure that the relays are activated by taking their inputs to HIGH because it seems quite common for relay boards to use inverted logic.

How are the RGB strips powered ?

Please post part # of the relay used.
Or check the relay spec and compare it's operating current to how much current your processor can supply per pin and total.
Let' s keep the smoke inside of processor!

note:the led of the relay it turns ON but it doens do the "click" sound.

You really should use a multimeter to check the operation of the relay. Are the relays the ones typically sold on ebay for use with an arduino?