Skip to main content

Dual-Channel Relay To Switch Via WiFi

A dual-channel relay is an electromagnetic switch module with two independent relays, allowing control of two electrical devices separately using a microcontroller like GLYPH boards. How Relay Works: You can check this link to see how the GMOD-2-CH-Relay Works! Unlike other relay module GMOD 2-ch-Relay is HIGH level logic module, i.e :
  • LOW (0V) → Relay OFF (bulb turns OFF)
  • HIGH (3.3V) → Relay ON (bulb turns ON)
How relay works with on/off bulbs
  1. The glyph board sets up a WiFi Access Point (AP) or connects to an existing WiFi network.
  2. A web server runs on the glyphc3, providing buttons to toggle the relay.
  3. When a user clicks a button, the glyphc3 activates or deactivates the relays, switching the bulbs ON or OFF.
pcbcupid_wifiaccess_relay_bulb The GLYPH-C3 board is configured as a WiFi server, allowing users to access a web-based interface from any connected device. The 2-channel relay acts as an electrically isolated switch to turn the bulbs on and off according to user inputs received over WiFi.

Step 1: Hardware Required

  • GLYPH-C3 board (other glyph development boards too)
  • GMOD Double Channel Relay Module
  • 2 AC Bulbs
  • Jumper Wires

Step 2: Circuit Diagram

GMOD Wiring: pcbcupid_2chanrel
  • Relay 1 IN → A2 (GLYPH)
  • Relay 2 IN → A1 (GLYPH)
  • VCC → 5V (GLYPH)
  • GND → GND (GLYPH)
  • Bulbs: Connected to relay outputs with an AC power source.

Step 3: Code Setup

  1. Open Arduino IDE.
  2. Copy and paste the following code into the Arduino IDE:

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
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
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 on the Serial

After uploading, open the Serial Monitor:
  • See WiFi setting up for communication
  • Find the IP Address.
  • Enter the IP Address in a web browser.
  • A Web interface with Graphical Buttons for controlling bulbs will appear
  • Click the buttons to turn bulbs ON/OFF.These buttons work by handling HTTP requests to toggle relays, thus controlling the bulbs in the process.
You can see along with the serial monitor, the AC light bulb turn on and turn off accordingly pcbcupid_wifiaccess_relay pcbcupid_wifiaccess_relay
  • Ensure WiFi credentials are correct.
  • Some relay modules are active LOW (LOW = ON, HIGH = OFF).
  • Ensure the relay power rating matches your bulb requirements.