Relay Module
A relay is an electronic component used for controlling circuits. It works by sensing changes in input current to control the opening and closing of the circuit. Relays are commonly used in automation control circuits, where they play roles such as automatic adjustment, isolation, safety protection, and switching. A DC relay typically has five pins: two are coil control pins, and the other three are the normally open (NO) pin, normally closed (NC) pin, and common (COM) pin. When no power is applied, the coil is not energized, the NC pin is connected to the COM pin, and the NO pin is disconnected from the COM pin. When powered, the coil is energized, the NO pin is connected to the COM pin, and the NC pin is disconnected from the COM pin. Thus, a relay acts as a switch, enabling low voltage control of high voltage circuits.
Module Source
Purchase Link: https://item.taobao.com/item.htm?spm=a1z10.5-c-s.w4002-24706531925.33.886b4450Jc12tZ&id=546724904969
Baidu Netdisk Download Link:
http://pan.baidu.com/share/link?shareid=3950641169&uk=2302102993
Specifications
Operating Voltage: 5V
Controllable AC Voltage Range: Up to 250V, 10A
Controllable DC Voltage Range: Up to 30V, 10A
Control Method: GPIO
Number of Pins: 4 Pins (2.54mm pitch header)
Description: Uses optocoupler isolation to protect MCU pins; utilizes a transistor driver.
Hardware Connection
Relay Module Development board
VCC 5V
GND GND
IN1 2
2
3
4
Usage Method
/******************************************************************************
* Test Hardware: LCSC ColorEasyDuino Development Board
* Version Number: V1.0
* Modified By: www.lckfb.com
* Modification Date: April 11, 2024
* Function Overview:
*****************************************************************************
* Open-source development board hardware and software information and related projects hardware and software information on official website
* Development board official website: www.lckfb.com
* Technical support resident forum, any technical problems are welcome at any time to exchange learning
* LCSC Forum: club.szlcsc.com
* Follow our Bilibili account: [立创开发板], stay toned to our latest news!
* We focus on cultivating Chinese engineers rather than profiting from board sales.
******************************************************************************/
const int RelayPin = 2;
void setup()
{
pinMode(RelayPin, OUTPUT);
}
void loop()
{
// 打开继电器
digitalWrite(RelayPin, HIGH);
// 等待1000毫秒(1秒)
delay(1000);
// 关闭继电器
digitalWrite(RelayPin, LOW);
// 等待1000毫秒(1秒)
delay(1000);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33