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:
I found this image on another topic but i don't quite understand it:
this code was included:
/* 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