Interfacing 5V 4-Channel Relay Module with Arduino

Interfacing 5V 4-Channel Relay Module with Arduino
One of the most useful things you can do with an Arduino is control higher voltage (120-240V) devices like fans, lights, heaters, and other household appliances. Since the Arduino operates at 5V it can’t control these higher voltage devices directly, but you can use a 5V relay to switch the 120-240V current and use the Arduino to control the relay.
The Arduino can be programmed to turn on the 4 channel relay module when a certain event occurs, for example when the temperature of a thermistor gets higher than 30° C. Or when the resistance of a photoresistor drops below 400 Ohms. Almost any sensor can be used to trigger the relay to turn on or off. The trigger doesn’t even need to be from a sensor. It can occur at set time intervals, it can be triggered from the press of a button, or even when you get an email.

How the 5V relay works.

The 4 channel  relay module has three high voltage terminals (NC, C, and NO) which connect to the device you want to control. The other side has three low voltage pins (Ground, Vcc, and Signal) which connect to the Arduino.
  • NC: Normally closed 120-240V terminal
  • NO: Normally open 120-240V terminal
  • C: Common terminal
  • Ground: Connects to the ground pin on the Arduino
  • 5V Vcc: Connects the Arduino’s 5V pin
  • Signal: Carries the trigger signal from the Arduino that activates the relay
  • Last update on 2021-04-14 / Affiliate links / Images from Amazon Product Advertising API

    Inside the relay is a 120-240V switch that’s connected to an electromagnet. When the relay receives a HIGH signal at the signal pin, the electromagnet becomes charged and moves the contacts of the switch open or closed.

    Normally open VS. Normally closed

    The 4 channel relay module has two different types of electrical contacts inside – normally open (NO) and normally closed (NC). The one you use will depend on whether you want the 5V signal to turn the switch on or turn the switch off. The 120-240V supply current enters the relay at the common (C) terminal in both configurations. To use the normally open contacts, use the NO terminal. To use the normally closed contacts, use the NC terminal.

    Normally open

    In the normally open configuration, when the relay receives a HIGH signal the 120-240V switch closes and allows current to flow from the C terminal to the NO terminal. A LOW signal deactivates the relay and stops the current. So if you want the HIGH signal to turn ON the relay, use the normally open terminal:

    Normally closed

    In the normally closed configuration, a HIGH signal opens the switch and interrupts the 120-240V current. A LOW signal closes the switch and allows current to flow from the C terminal to the NC terminal. Therefore, if you want the HIGH signal to turn OFF the 120-240V current, use the normally closed terminal:
    A good recommendation where you can buy this relay is the link below:
  • 5V DC AC 4-channel Relay Module:………  Amazon
  • Disclosure: This is an affiliate link. I earn a commission as an Amazon Associate
    for qualifying purchases. I would appreciate your support in this way.

    Connecting the relay module with Arduino.

    4 channel relay module schematic
    4 channel relay module setup

    Code for controlling 4 channel relay module.

    int ch=4; // number of relaysint 
    relay[]={2,3,4,5}; // pin number of relays
    int wait=2000;int i=0;
    void setup() {
    for(int i=0; i<ch; i++){
    pinMode(relay[i],OUTPUT); // set relay pins as output
    digitalWrite(relay[i],HIGH); // turn relay off
    }
    }
    void loop() {
    for(int i=0; i<ch; i++){
    digitalWrite(relay[i],LOW); // turn relay ON
    delay(wait);
    }
    for(int i=0; i<ch; i++){
    digitalWrite(relay[i],HIGH); // turn relay OFF
    delay(wait);
    }
    }
        
    

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Back to top