[](Product Link)

Introduction

This is a Omron relay module with quality transparent case that allows users to see how the contacts inside the relay work at a glance, and enables easy confirmation of relay contact state.

The relay adopts Gravity interface and supports switch quantity control, which is easy to use and conveient to control. Without complex wiring, I2C or serial port protocol, the relay can be controlled by setting the digital port to high or low.

There are two groups of contacts on the relay, one for general ON/OFF control, the other for controlling one VCC output. This allows users to directly connect a small device on the VCC output which can be powered by main-board, greatly simplifying wirings.

Features

  • Fully transparent relay, view contacts state at a glance
  • Quality Omron relay, contacts with longer lifespan
  • Output can be directly connected to VCC load, like water pump, or servo, etc., without externa power source, easy to use

Application

  • Auto watering system
  • Auto control
  • IoT controlling system

Specification

Electrical Parameter

  • Signal Interface: PH2.0-3P(Gravity)
  • Control Signal: Digital signal(high level to pull in, low level to release)
  • Signal Level: 3.3V, 5V
  • Power Supply: 3.3V~5V DC
  • Output Method 1: 1 NO, 1 COM, 1 NO
  • Output Method 2: control to output VCC voltage(OUT does not output by default, it outputs VCC voltage when pulling in)
  • OUT Voltage: VCC Voltage
  • OUT Load: Signal port VCC capacity
  • Output Interface: Screw-type KF128-5.08 Ternimal Block

Relay Parameter

  • Relay Brand: Omron
  • Model: G2R-2
  • Country of Origin: Indonesia
  • Number of Relay Contact: 2 NO, 2 NC
  • Contact Load Capacity: 5A 250VAC/5A 30VDC
  • Contact Material: Silver nickel alloy
  • Coil Voltage: 5VDC

Others

  • Soldering Material: Lead-free and environment-friendly
  • Size: 46.5×32×26.5mm/1.83×1.26×1.04”(L×W×H)
  • Mounting Hole Size: diameter 3.1mm, Pitch: 25mm
  • Weight: 20g(Package not included)

Dimension

Board Overview

Board Overview

Pin Function
D Control signal input
VCC Power+ (DC 3.3V~5V)
GND Power-
NO Normally-open
NC Normally-closed
COM Common contact
OUT+ Power output+ (VCC voltage)
OUT- Power output-

Note: OUT+ outputs VCC voltage from mainboard's power source, and please pay attention to the load capacity of mainboard when connecting a load to this port. Most mainboards have weak load capacity, so when a large power device is connected to the OUT+, the mainboard may work abnormally, reset repeatedly, or even be damaged.

Tutorial for Arduino UNO

Control the operation of the relay using Arduino UNO and Buttons.

Requirements

Connection 1

NO and COM ports will be used in this connection. An external DC power source is required and should be selected according to the load voltage to be connected.

Connection 1

Description:

Relay: D-----to Mainboard: 8

Relay: VCC---to Mainboard: 5V

Relay: GND-----to Mainboard: GND

Yellow Button: D--to---Mainboard: 2

Yellow Button: VCC--to---Mainboard: 5V

Yeloow Button: GND--to---Mainboard: GND

Red Button: D---to---Mainboard: 3

Red Button: VCC---to--Mainboard: 5V

Red Button:GND---to--Mainboard: GND

Relay Module: NO--to---Pump: positive(red wire)

Relay Module: COM--to--3V DC Power: positive

3V DC Power: Negative--to--Pump: negative(black wire)

Connection 2

This connection is simpler. The pump is directly connected to the OUT and power by VCC, no second power source required.

Connection 2

Description:

Relay: D-----to Mainboard: 8

Relay: VCC---to Mainboard: 5V

Relay: GND-----to Mainboard: GND

Yellow Button: D--to---Mainboard: 2

Yellow Button: VCC--to---Mainboard: 5V

Yeloow Button: GND--to---Mainboard: GND

Red Button: D---to---Mainboard: 3

Red Button: VCC---to--Mainboard: 5V

Red Button:GND---to--Mainboard: GND

Relay Module: OUT+ --to--Pump: Positive

Relay Module: OUT- --to--Pump: Negative

Sample Code

The sample code below is suitable for the two connections above. It realizes the function of controlling the relay's ON/PFF through two buttons. Yellow button for pulling in, red button for releasing.

int Relaypin = 8;     // Define relay pin 
int switchPin1 = 2;  // Define yellow button pin  
int switchPin2 = 3;  // Define red button pin 

void setup() { 
 pinMode(Relaypin, OUTPUT);
 pinMode(switchPin1, INPUT);  
 pinMode(switchPin2, INPUT);
}

void loop() {
  if (digitalRead(2)==1) //Determine if the yellow button is pressed 
  {
    delay(50);
    if(digitalRead(2)==1){
      digitalWrite(8, HIGH);//Set relay to high level 
    }
  }
  if (digitalRead(3)==1) //Determine if the red button is pressed 
  {
    delay(50);
    if(digitalRead(3)==1){
      digitalWrite(8, LOW);//Set relay to low level 
    }
  }
}

Result

When the yellow button is pressed, the relay is in pull-in state and the pump starts working; when the red button is pressed, the relay is in releasing state and the pump stops working.

Tutorial for micro:bit

Control the operation of the relay using micro:bit and its onboard buttons.

Connection 1

NO and COM ports will be used in this connection. An external DC power source is required and should be selected according to the load voltage to be connected.

Connection 3

Description:

  • Relay Module: D--to--Mainboard: P0
  • Relay Module: VCC--to--Mainboard: 3V3
  • Relay Module: GND--to--Mainboard: GND
  • Relay Module: NO--to--Pump: Positive(Red wire)
  • Relay Module: COM--to--3V DC power: Positive
  • 3V DC power: Negative--to--Pump: Negative(Black wire)

Connection 2

This connection is simpler. The pump is directly connected to the OUT and power by VCC, no second power source required.

Note: since the micro:bit itself has weak load capacity, here the Relay VCC needs to be connected to the 5V of the micro:bit IO Extender and the power source should be connected to the extender external power interface.

Connection 4

Description:

  • Relay Module: D--to--Mainboard: P0
  • Relay Module: VCC--to--Mainboard: 5V
  • Relay Module: GND--to--Mainboard: GND
  • Relay Module: OUT+ --to--Pump: Positive(Red wire)
  • Relay Module: OUT- --to--Pump: Negative(Black wire)

Mind+ Sample Code

The sample code below is suitable for the two connections above. It realizes the function of controlling the relay's ON/PFF through the button A and B on micro:bit. When button A pressed, P0 outputs high; Button B pressed, P0 outputs low.

Mind+

Result

When button A is pressed, the relay is in pull-in state and the pump starts working; when button B is pressed, the relay is in releasing state and the pump stops working.

MakeCode Sample Code

The sample code below is suitable for the two connections above. It realizes the function of controlling the relay's ON/PFF through the button A and B on micro:bit. When button A pressed, P0 outputs high; Button B pressed, P0 outputs low.

MakeCode

Result

When button A is pressed, the relay is in pull-in state and the pump starts working; when button B is pressed, the relay is in releasing state and the pump stops working.

Compatibility

This product supports 3.3V ~ 5V main control board. The following table lists the test of the product for different main control boards.

Mainboard Name Work well Work wrongly Untested
Arduino UNO
Arduino Mega2560
Arduino Leonardo
FireBeetle-ESP8266
FireBeetle 2 ESP32-E
FireBeetle 2 M0
Raspberry Pi 4 B
micro:bit

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents