2-Channel Relay Module 5V for Arduino, ESP32, ESP8266, Raspberry Pi – Optocoupler Isolation, High/Low Level Trigger

kr.34,00

In stock (can be backordered)

SKU: 011438 Category:

Description

Description:

1. The module uses genuine quality relay normally open interface maximum load: AC 250V / 10A, DC 30V / 10A;
2. Using SMD optocoupler isolation, strong driving ability, stable performance; trigger current 5mA;
3. The module voltage is 5V, 9, 12, 24V available;
4. The module can be set to high or low to trigger through jumpers;
5. Fault-tolerant design, even if the control line is broken, the relay will not operate;
6.The power indicator light (green), relay status indicator light (red)
7. The interface design is user-friendly, all interfaces can be directly connected to the wires through the terminal block, which is very convenient
8. Module size: 50 * 41 mm * 18.5 mm (L * W * H)
9. With four assembly bolt holes, 3.1mm holes, 44.5mm*35.5mm spacing

Interface aspect:
1. DC +: Positive power supply (the voltage required by the relay, there are 5V.9V.12V and 24V options)
2. DC-: negative power connection
3. IN1: the end of 1 signal trigger, you can set a high or low level control relay
4. IN2: 2-channel signal, when the trigger is over, you can set a high or low level control relay

Output:
1. NO1: Pass the relay normally open interface, float, short circuit and COM1 pull relay
2. COM1: 1 relay universal interface
3. NC1: 1 relay normally closed port, COM1 relay before and after the pull-up short empty
4. NO2: 2-way relay normally open interface, the relay before floating, pull back and COM2 short
5. COM2: 2 general interface relay
6. NC2: 2-way relay’s normally closed interface relay short front and COM2, pull vacant positions

High and low trigger options:
1.S1 is the high and low relay trigger selection;
2. S2 high and low two-way relay trigger selection;
3. Com low short circuit, trigger the corresponding relay low, and short COM high trigger high end

Package includes:
1PC 2 Channel Relay Module

ESP32C6 Install to Arduino IDE

Installation
    Install the Arduino IDE from arduino.cc
    Add ESP32 board support to Arduino IDE:
        Open Arduino IDE
        Go to File > Preferences
        Add the following URL to “Additional Boards Manager URLs”: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

Se picture.

Arduino IDE

        Go to Tools > Board > Boards Manager
        Search for “esp32” and install the latest version
    Install the Adafruit NeoPixel library:
        Go to Sketch > Include Library > Manage Libraries
        Search for “Adafruit NeoPixel”
        Install the latest version
    Usage
    To Run this sketch.
    Tools->Port e.g. COM6 or /dev/ttyUSB…
    Tools->Board:”ESP32C6 Dev Module”
    Sketch->Upload
    If you have difficulty with getting ESP32C6 running…
    1) When I initially powered it up, it was in some kind of “boot loop” that wouldn’t stop cycling?.
    a) Just hold the boot button before plugging the usb cable. Sometimes it takes a few tries. Reconnect the USB cable. Often this solve the problem.
    b) ESP32C6 is very sensitive. Often it is sensitive to USB port, cable. Change USB cable or connect it completely alone, no hub or anything in between.

Sketch for 2-Relay

Here we also exercise the built-in LED on the ESP32-C6 too. It lives on PIN 8.
 
Open Arduino IDE
Go
File->New Sketh
Copy && Paste the Code.
Then..
Tools->Port e.g. COM6 or /dev/ttyUSB…
Tools->Board:”ESP32C6 Dev Module”
Sketch->Upload
 
Do you want to see the output in the console?
Go to:
Tools->Serial Monitor.
Is there no output in the console?. Enable CDC.
Go to:
Arduino IDE’s Tools > USB CDC On Boot: “Enabled”.
This only takes effect after you upload a new sketch to the board. Else No print.
Some times just restarted the Arduino IDE after enabled USB CDC On Boot.
The Code hurray.
 
#include <Adafruit_NeoPixel.h>
 
// Assign each GPIO to a Relay
int relayGPIO_0 = 20;
int relayGPIO_1 = 19;
//  The built-in RGB LED on the ESP32-C6 is connected to GPIO 8.
constexpr uint8_t LED_PIN = 8;
constexpr uint8_t NUM_LEDS = 1;
Adafruit_NeoPixel rgbLed(NUM_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800);
struct RGB {
    uint8_t r, g, b;
};
//Set som constand colors
constexpr RGB COLOR_OFF   = {0, 0, 0};
// …Feel free to add more colors here…
constexpr RGB CUSTOM_COLOR = {255, 0, 255};
//  Brightness control (0-100%) 0:OFF
void setColor(const RGB& color, uint8_t brightness = 100) {
    uint16_t scale = (uint16_t)brightness * 255 / 100;
    uint8_t r = (uint8_t)(((uint16_t)color.r * scale) / 255);
    uint8_t g = (uint8_t)(((uint16_t)color.g * scale) / 255);
    uint8_t b = (uint8_t)(((uint16_t)color.b * scale) / 255);
    rgbLed.setPixelColor(0, rgbLed.Color(r, g, b));
    rgbLed.show();
}
void setup() {
    Serial.begin(115200);
    delay(1000); //Serial. Allways give it some time
 
    Serial.println(“ntest relay0”);  //Arduino IDE’s Tools > USB CDC On Boot: “Enabled” only takes effect after you upload a new sketch to the board. Else No print.
                                      // Some times just restarted the Arduino IDE after enabled USB CDC On Boot.
    pinMode(relayGPIO_0, OUTPUT);
    pinMode(relayGPIO_1, OUTPUT);
    digitalWrite(relayGPIO_0, HIGH);
    digitalWrite(relayGPIO_1, LOW);
    Serial.println(“Relay0 ON “);
    delay(5000);
    digitalWrite(relayGPIO_0, LOW);
    digitalWrite(relayGPIO_1, HIGH);
    Serial.println(“Relay0 OFF “);
    rgbLed.begin();
    rgbLed.show();
    setColor(CUSTOM_COLOR, 50); // 50% brightness
}
void loop() {
  // put your main code here, to run repeatedly:
    delay(5000);
    digitalWrite(relayGPIO_0, HIGH);
    digitalWrite(relayGPIO_1, LOW);
    setColor(COLOR_OFF);
    Serial.println(“Relay0 ON “);
    delay(5000);
    digitalWrite(relayGPIO_0, LOW);
    digitalWrite(relayGPIO_1, HIGH);
    setColor(CUSTOM_COLOR, 50); // 50% brightness
    Serial.println(“Relay0 OFF “);
}