Home Code 5 Volt 4 Channel Arduino Relay Module example

5 Volt 4 Channel Arduino Relay Module example

by shedboy71

In this example we will take a look at another relay module, this time this one is called the 5 Volt 4 Channel Arduino Relay Module , here is a picture of the module

This relay module provides four relays that are rated for 7A at either 28VDC or 10A at 125VAC. Each relay has  a Normally Open (NO) and a Normally Closed (NC) contact. This module could be used in various automation projects such as switching lights and motors.

You can see that each relay is controlled by a corresponding input pin called In1 to IN4, there are also LEDs that show if the input is low or high. Another benefit is that each relay is optically isolated using an LTC-817.

 

Module Schematic

I found this schematic online for the module at Control4 home automatic experts.

 

Schematic

The following schematic shows how to connect the module to an Arduino, I have only shown one device (lightbulb) connected to one relay

 

Code

Here is some test code

[codesyntax lang=”cpp”]

int RelayControl1 = 4;    // Digital Arduino Pin used to control the motor
int RelayControl2 = 5;  
int RelayControl3 = 6;  
int RelayControl4 = 7;  


void setup()  
{   
  Serial.begin(9600);
  pinMode(RelayControl1, OUTPUT);
  pinMode(RelayControl2, OUTPUT);
  pinMode(RelayControl3, OUTPUT);
  pinMode(RelayControl4, OUTPUT);
}
 

void loop()  
{

  digitalWrite(RelayControl1,HIGH);// NO1 and COM1 Connected (LED on)  
  delay(1000);
  digitalWrite(RelayControl1,LOW);// NO1 and COM1 disconnected (LED off)  
  delay(1000);
  digitalWrite(RelayControl2,HIGH);
  delay(1000);
  digitalWrite(RelayControl2,LOW);
  delay(1000);
  digitalWrite(RelayControl3,HIGH);
  delay(1000);
  digitalWrite(RelayControl3,LOW); 
  delay(1000);     
  digitalWrite(RelayControl4,HIGH);  
  delay(1000);
  digitalWrite(RelayControl4,LOW); 
  delay(1000);
}

[/codesyntax]

 

Links
1PC/LOT 5V 4-Channel Relay Module Shield for Arduino ARM PIC AVR DSP Electronic 5V 4 Channel Relay Newest

Share

You may also like

Leave a Comment