Skip to main content

Using Single-Channel Relay with GLYPH-C3

Single_channel Relay

A 1-channel relay module provides control for a single independent relay. This makes it ideal for controlling high-power loads using low-power control signals from microcontrollers like Arduino, GLYPH, or even Raspberry Pi. Here's how it works:

Components

  • Relays: Relay can independently control a high-power (Both AC / DC) device.
  • Control Pins: There are one input pins (IN) for controlling the relay.
  • Power Supply: A single power source is used for the relays 5V
  • Protection : Has Optocoupler to electrical isolation between the control and relay circuits.

Pin Configuration

  • VCC: Power supply for the module (5V).
  • GND: Ground connection.
  • IN: Control signal for Relay 1.
  • COM, NO, NC: Relay 1 switching terminals.

Relay Contacts

  • COM (Common): The input terminal.
  • NO (Normally Open): Open by default, closes when the relay is activated.
  • NC (Normally Closed): Closed by default, opens when the relay is activated.

Working

pcbcupid-2-ch-relay

  • Relay :
    • When Control Signal is LOW (0V):

      The associated transistor remains off. The corresponding relay coil is de-energized. The relay's Normally Open (NO) contact stays open

    • When Control Signal is HIGH (3.3V/5V):

      The associated transistor turns on, allowing current to flow through the relay coil. The coil energizes, creating a magnetic field that pulls the armature. The relay's NO contact closes, completing the circuit for the connected load.

    • Operation Sequence for Two Relays

      • IN HIGH: Activates Relay to control the Load.
      • IN LOW: Deactivates the relay, disconnecting the load.

Applications

  • Home Automation: Controlling lights and fans independently.
  • Industrial Automation: Managing two separate devices or motors.
  • DIY Projects: Operating appliances remotely with microcontroller-based projects.

This guide will help you interface a 2 Channel Relay assuming you are using GLYPH-C3(but any GLYPH development board from the ESP32 Series should work)

Step 1: Hardware Required

  1. GLYPH-C3
  2. GMOD-Single Channel Relay Module
  3. Jumper Wires
  4. Power Supply
  5. AC Bulb

Step 2: Circuit Diagram

Connect the relay module as follows:

Relay IN → GPIO8 (Control Pin) Relay VCC → 3.3V or 5V (Check relay voltage requirement) Relay GND → GND

pcbcupid_1chanrelay

Step 3: Code Setup

#define RELAY_PIN 8 // GPIO pin connected to the relay's IN pin

void setup() {
pinMode(RELAY_PIN, OUTPUT); // Set the relay pin as an output
digitalWrite(RELAY_PIN, LOW); // Ensure relay is off initially
}

void loop() {
digitalWrite(RELAY_PIN, HIGH); // Turn relay ON (activate)
delay(2500); // Wait for 1 second
digitalWrite(RELAY_PIN, LOW); // Turn relay OFF (deactivate)
delay(2500); // Wait for 1 second
}

Step 4: Upload the Code

  1. Connect the Board
  • Connect your GLYPH board to your computer
  1. Select the Board and Port

    Do the following settings in your Arduino IDE, Do the following settings in your Arduino IDE,

    • Tools > Board > esp32 > Pcbcupid GLYPH C3
warning

For the Pcbcupid GLYPH C3 to appear under Tools > Board > esp32, the esp32 board version installed in the Arduino IDE should be greater than or equal to 3.1.0.

  • Tools > Port and select the port connected to your GLYPH.
  • Tools > USB CDC on Boot > Enabled
warning

If USB CDC on BOOT not enabled, you won't be seeing any serial data on Arduino IDE.

  1. Upload the Code
  • Click the upload button (➡️ icon) or use the shortcut CTRL + U in Arduino IDE to upload the code to the board.

Step 5: Observe the Output

Single_channel Relay

The relay will turn ON for 2.5 seconds, then OFF for 2.5 seconds, and this cycle will repeat.

info
  • Some relay modules are active LOW, meaning they turn ON when LOW and OFF when HIGH. If your relay behaves unexpectedly, try inverting the digitalWrite() logic.

  • Ensure the relay's power rating matches the device you want to control.

  • You may hear a clicking sound as the relay switches states.

Single_channel Relay_Bulb_On_Off