Powering multiple 5V relays simultaneously

Hi,

Sorry if this is a trivial question, but I'm very new to electronics. I'm working on a project where I'll need to have multiple appliances powered at the same time using 5V relays. Can I power all the relays (let's say 5 of them) from the one 5V pin? Does it depend on the amperage?
If I have the relays in pins 4, 5, 6, 7 and 8 and I run digitalWrite(4, HIGH); digitalWrite(5, HIGH); digitalWrite(6, HIGH); digitalWrite(7, HIGH); digitalWrite(8, HIGH);, will all stay activated? Thanks for any advice!

Peter

EDIT: It's a Nano, if that makes any difference.

Can I power all the relays (let's say 5 of them) from the one 5V pin?

No.
You should only draw between 20 and 30mA from a pin. That is not enough to drive even one relay that could switch mains. You need a transistor to boost the current to drive most relays.

Oh so that’s what’s important :frowning: Thanks, I’ll need to look more into relays and transistors.

Are you talking individual relays or a relay module? A module might be the easiest for you to implement, and they are fairly inexpensive. Just keep in mind opto-isolation. The board should have a jumper on it to isolate the logic side from the control voltages. You also need to know you will probably need another 5V power supply to run the coils with smaller uControllers or if you have other hardware running off the 5V rail.

Three things:

  • Being new to electronics, probably not a good idea to be working with mains voltages [i.e. High Voltage].
    Get some electronic experience under your belt, first. Or, at least, read up on High Voltage safety precautions and techniques.
  • Assuming you plan to go ahead with this, another possibility is the Solid State Relay. And, assuming you're using an Arduino Uno, the one SS Relay I have experience with requires around 3mA of current to trigger it at 5V. That means you could wire 5 of these relays to one output.
  • When you do a digital write (on an Arduino pin configured as an Output], it stays at that state until changed by another write, to the opposite state. So, after a digitalWrite(MyPinNumber, HIGH), the pin will stay HIGH until a digitalWrite(MyPinNumber, LOW) call is made. In which case the output will stay LOW.

A link to the SS Relay referred to, above: Solid State Relay - 40A (3-32V DC Input) - COM-13015 - SparkFun Electronics

Update: The Nano uses the same MCU as the UNO, so the same output spec's apply [i.e. everything I said about an UNO also applies to a NANO]. Caveat: I've never used, or researched a NANO, so not sure if it uses the same Voltage Regulator or if other things might make the NANO different than the UNO in terms of Maximum's, BUT, within the scope of my, above, discussion, the NANO is the same as the UNO.

I am using 5v 4Channel Relay(REES52)… I am not able switch on two 60w bulb simultaneously. It is getting tripped. I have given separate 12v2A input via JDVCC. Please clarify

Why are you giving a 5v relay 12v ?

I have tried 5v2a in JDVCC also. but i am not able to switch on both relay simultaneously. So i have tried with 12v2a in JDVCC. i want to switch on two 60w bulb simultaneously.

(deleted)

IN LEFT SIDE JUMBER REMOVED
AND JDVCC = +5V 2A SEPARATE ADAPTER
VCC = NO CONNECTION

IN FRONT SIDE

GND = -5V 2A SEPARATE ADAPTER
IN1 = DP7 IN ARDUINO UNO R3
IN2 = DP8
IN3 = DP9
IN4 = DP10

VCC = +5V WITH ARDUINO UNO R3

AND

RELAY ONE = CONNECTED TO 60W BULB
TWO=CONNECTED TO 60W BULB

I AM NOT ABLE TO SWITCH ON TWO BULB SIMULTANEOUSLY.

#include <LiquidCrystal.h>
#include <DHT.h>
#define LCDCONTRASTPIN 6
#define DHTPIN 13
#define LIGHTPIN40W 8
#define LIGHTPIN60W 7
//#define FANPIN 9

#define LCDCONTRASTLEVEL 70

DHT dht(DHTPIN, DHT22);

float hum;
float temp;
float humhigh;
int pos = 0;
int sec = 0;
int Min = 0;
int day = 0;
int hrs = 0;
bool humidityflag = true;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()
{
//Serial.begin(9600);
// pinMode(FANPIN, OUTPUT);
pinMode(LIGHTPIN40W, OUTPUT);
pinMode(LIGHTPIN60W, OUTPUT);
analogWrite(LCDCONTRASTPIN,LCDCONTRASTLEVEL);
lcd.begin(16, 2);
dht.begin();
lcd.setCursor(0, 0);
lcd.print(" Welcome !!!");
lcd.setCursor(0, 1);
lcd.print(“MRM-Brintha Cons”);
delay(5000);
lcd.clear();
}

void loop()
{
if (humidityflag == true)
{
hum = dht.readHumidity();
temp= dht.readTemperature();
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“H:”);
lcd.print(String(hum)+"%");
lcd.setCursor(8,0);
lcd.print(“F:”);
lcd.println(String((temp9/5)+32)+" “);
//lcd.println(String(temp)+“C”);
lcd.setCursor(0,1);
lcd.print(“M:” + String(Min));
lcd.setCursor(6,1);
lcd.print(“H:” + String(hrs));
lcd.setCursor(11,1);
lcd.print(“D:” + String(day)+” ");
if (((temp
9/5)+32) <= 100)
{
digitalWrite(LIGHTPIN60W,HIGH);
digitalWrite(LIGHTPIN40W,HIGH);
}
if (((temp9/5)+32) > 100 && ((temp9/5)+32) < 102)
{
digitalWrite(LIGHTPIN60W,LOW);
//digitalWrite(LIGHTPIN40W,HIGH);
}
if (((temp*9/5)+32) >= 102)
{
delay(50);
digitalWrite(LIGHTPIN40W, LOW);
}

when i excute the above code, first both lights are on, Then its getting switched off both bulbs.

If i run single code as below

if (((temp*9/5)+32) <= 100)
{
digitalWrite(LIGHTPIN60W,HIGH);
// digitalWrite(LIGHTPIN40W,HIGH);
}

a single bulb is on …

(deleted)

Please read this:-
How to use this forum
Because your post is breaking the rules about posting code.

Also it will tell you how to ask a question.

Can you provide a diagram to show how you have connected everything?

So the answer is no is it? Very friendly.
Sadly your words do not convey the information required. When you do that we have to make a diagram in our heads or draw on out. We will tend to fill in the missing information with what is right and so miss what you are doing wrong. It's your project, I feel you should draw the diagram, pen an paper is just fine. If you can't draw a diagram however can you make it? I know I can't do that, you shouldn't even try.

Sorry for the trouble. I am new to this subject.

I have attached the diagram

diagram_new.doc (72 KB)

(deleted)

Please find attached Pls

diagram_new.doc (72 KB)

(deleted)

please find attached word document. pls

diagram_new.doc (72 KB)

i not able to switch on both bulbs simultaneously. I have disconnected the connection from 5v-relay output to the bulb. i have tried again, the leds in the relay board are glowing continuously for that channel. Please clarify

You have no common ground between the Arduino and the relay board, that is why it is not working correctly.

There is no need to connect the 5V line from the relay board to the Arduino unless you are using the relay board to power the Arduino.