Go Down

Topic: how to connect external power to an 8 channel relay (Read 5158 times) previous topic - next topic

Jordy2610

I am doing this home automation project for school, and before I start I just can't totally figure out how to connect an external power supply to an 8 channel relay board.

I am planning on using this relay board:
http://www.sainsmart.com/8-channel-dc-5v-relay-module-for-arduino-pic-arm-dsp-avr-msp430-ttl-logic.html

I found this image on another topic but i don't quite understand it:


this code was included:
Code: [Select]
/* 8 Relay Module configured for Opto-isolation
   Arduino UNO pins 3 to 10 connected to IN1 to IN8
   Connections: http://i.imgur.com/MDNQGeC.png */

void setup() {
  for (int i = 3; i <= 10; i++) {
    pinMode(i, INPUT_PULLUP);
    pinMode(i, OUTPUT); // defaults HIGH (relays off)
  }
}

void loop() {
  for (int i = 3; i <= 10; i++) {
    digitalWrite(i, LOW); // energize relays until all on
    delay(1000);
  }
  for (int i = 3; i <= 10; i++) {
    digitalWrite(i, HIGH); // de-energize relays until all off
    delay(1000);
  }
}


I didn't really understand why the vcc pin was connected to 5V because it is allready powered through the JD-VCC.

Also is there someone who can recommend a power supply to use which is easy to connect and is not to expensive and also works with my relay.

Thank you...

BTW this is the link to that other topic:
https://forum.arduino.cc/index.php?topic=185234.0

manor_royal

Quote
I didn't really understand why the vcc pin was connected to 5V because it is allready powered through the JD-VCC.
Not with the jumper removed, it's not.

If this was a Civil Engineering forum would there be posts like "I need to build a bridge. Someone send me drawings."

Chagrin

The jumper between VCC and JD-VCC means that your Arduino will be providing power to energize the relays. And having that jumper present also means you lose your isolation, but the benefit is that you don't need a second power supply.

Your diagram is correct. Think of it as the relay board having two separate circuits and each side needs to have its own power and GND. On the Arduino side your IO pins sink current so they take the place of GND.

Go Up