How to Use 2 Channel Relay Module Using Arduino
by MrSottong in Circuits > Arduino
1592 Views, 3 Favorites, 0 Comments
How to Use 2 Channel Relay Module Using Arduino
In the previous article, I already discussed about the Relay Module. The Relay Module that I used in the article is the 1 Channel Relay Module.
In this article I will discuss the relay module again. The relay module that I used is different from the previous module. This time I will use the 2 channel relay module.
this is a feature of the relay module that I will use:
- 2 Channel Relay
- Optocoupler LOW Level Triger
- Led relay indicator
- Relay Maximum output : 10A/250 VAC, 10A/30 VDC.
- Optocoupler isolation
Required Component
Components needed for this tutorial:
Connect the Relay Modul to Arduino
See the instructions below to connect the Relay Module with Arduino
Relay Modul to Arduino
GND ==> GND
IN1 ==> D12
IN2 ==> D11
VCC ==> +5V
Programming
To control the Relay Module, we don't need to use "Library".
Take a look at the sketch I made for more clarity.
#define Relay1 12
#define Relay2 11void setup() { pinMode(Relay1, OUTPUT); pinMode(Relay2, OUTPUT);
}
void loop() { digitalWrite(Relay1, HIGH); digitalWrite(Relay2, LOW); delay(3000); digitalWrite(Relay2, HIGH); digitalWrite(Relay1, LOW); delay(3000); }
Result
What happens to the relay module after I enter the program?
The thing that happens is, the relay module will live alternately. When relay1 is off, relay2 is on, and vice versa.