1CH 5V Relay Board High/Low Level Trigger with Optocoupler Documentation
The 1CH 5V Relay Board High/Low Level Trigger with Optocoupler is a convenient and compact module designed to control high-power devices using a low-power signal. The relay board features an optocoupler that provides electrical isolation between the control signal and the relay, ensuring safe and reliable operation.
1-channel relay with high/low level trigger
5V operating voltage
Optocoupler for electrical isolation
Relay switching capacity: 10A/250VAC, 10A/30VDC
Module size: 45mm x 28mm
VCC: 5V power supply
GND: Ground
IN: Input signal (high/low level trigger)
COM: Relay common terminal
NC: Relay normally closed terminal
NO: Relay normally open terminal
### Example 1: Arduino Control with High-Level Trigger
In this example, we will use an Arduino Uno board to control the relay module. The relay will turn on when the input signal is HIGH (5V) and turn off when the input signal is LOW (0V).
```c++
const int relayPin = 2; // Choose a digital pin on the Arduino board
void setup() {
pinMode(relayPin, OUTPUT);
}
void loop() {
digitalWrite(relayPin, HIGH); // Turn on the relay
delay(1000);
digitalWrite(relayPin, LOW); // Turn off the relay
delay(1000);
}
```
### Example 2: Raspberry Pi Control with Low-Level Trigger
In this example, we will use a Raspberry Pi board to control the relay module. The relay will turn on when the input signal is LOW (0V) and turn off when the input signal is HIGH (5V).
```python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
relay_pin = 17 # Choose a GPIO pin on the Raspberry Pi board
GPIO.setup(relay_pin, GPIO.OUT)
while True:
GPIO.output(relay_pin, GPIO.LOW) # Turn on the relay
time.sleep(1)
GPIO.output(relay_pin, GPIO.HIGH) # Turn off the relay
time.sleep(1)
```
### Example 3: ESP32 Control with High-Level Trigger using MicroPython
In this example, we will use an ESP32 board running MicroPython to control the relay module. The relay will turn on when the input signal is HIGH (5V) and turn off when the input signal is LOW (0V).
```python
import machine
import time
relay_pin = machine.Pin(25, machine.Pin.OUT)
while True:
relay_pin.value(1) # Turn on the relay
time.sleep(1)
relay_pin.value(0) # Turn off the relay
time.sleep(1)
```
Note: Before using the relay board, ensure that the input signal is within the specified voltage range (5V) and the relay is properly connected to the load and power supply.