In this tutorial we will going to wire the 8 channel Relay Module driven by our own very owned microcontroller, the below illustration illustrate 8 device on external power source triggered by the relay. The 8 channel relay module has its own optocoupler also called opto-isolator, photocoupler or optical isolator. Optocoupler is a component that transfers electrical signals between two state of isolation circuits by using light, and prevent high voltage from affecting the system receiving the signal.
This 8 Channel Relay module can adopt most common range of microcontrollers, such as Arduino, Raspberry Pi, AVR, PIC, ARM with digital outputs to control larger loads devices like AC or DC Motors, Electromagnets, Soleniod, Incandescent light bulbs, Actuators and any another devices that you want to drive with in the relay. This relay can handle 7A / 240 VAC, 10A / 125VAC, 10A / 28DV.
Required Components
- Arduino UNO/MEGA/MINI/NANO
- 8 Channel Relay Module with Optocoupler Isolator
- Devices , you can use any device or appliance as your output.
Wiring Diagram
Arduino Sketch
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
/* 14CORE.com 8 Channel Relay Module Code Guide */ int Relay1 = 6; //Defined Pin 6 as the Variable int Relay2 = 7; //Defined Pin 7 as the Variable int Relay3 = 8; //Defined Pin 8 as the Variable int Relay4 = 9; //Defined Pin 9 as the Variable int Relay5 = 10; //Defined Pin 10 as the Variable int Relay6 = 11; //Defined Pin 11 as the Variable int Relay7 = 12; //Defined Pin 12 as the Variable int Relay8 = 13; //Defined Pin 13 as the Variable void setup() { pinMode(Relay1, OUTPUT); //Set Pin6 as output pinMode(Relay2, OUTPUT); //Set Pin7 as output pinMode(Relay3, OUTPUT); //Set Pin8 as output pinMode(Relay4, OUTPUT); //Set Pin9 as output pinMode(Relay5, OUTPUT); //Set Pin10 as output pinMode(Relay6, OUTPUT); //Set Pin11 as output pinMode(Relay7, OUTPUT); //Set Pin12 as output pinMode(Relay8, OUTPUT); //Set Pin13 as output } void loop() { // Channel 1 digitalWrite(Relay1, HIGH); //Turn off relay delay(1000); digitalWrite(Relay1, LOW); //Turn on relay delay(1000); // Channel 2 digitalWrite(Relay2, HIGH); //Turn off relay delay(2000); digitalWrite(Relay2, LOW); //Turn on relay delay(2000); // Channel 3 digitalWrite(Relay3, HIGH); //Turn off relay delay(3000); digitalWrite(Relay3, LOW); //Turn on relay delay(3000); // Channel 4 digitalWrite(Relay4, HIGH); //Turn off relay delay(4000); digitalWrite(Relay4, LOW); //Turn on relay delay(4000); // Channel 5 digitalWrite(Relay5, HIGH); //Turn off relay delay(5000); digitalWrite(Relay5, LOW); //Turn on relay delay(5000); // Channel 6 digitalWrite(Relay6, HIGH); //Turn off relay delay(6000); digitalWrite(Relay6, LOW); //Turn on relay delay(6000); // Channel 7 digitalWrite(Relay7, HIGH); //Turn off relay delay(7000); digitalWrite(Relay7, LOW); //Turn on relay delay(7000); // Channel 8 digitalWrite(Relay8, HIGH); //Turn off relay delay(7000); digitalWrite(Relay8, LOW); //Turn on relay delay(7000); } |