场景图
In daily life, we generally use 220V AC to drive the electrical equipment. Sometimes we will use the switch to control the electrical appliance. If directly connect the switch to the 220V AC circuit, once electric leakage happened, people are in danger. Considered with safety, we particularly design this keyestudio single relay with terminal block of NO (normally open) and NC (normally closed), which is active at High.
In this project, you will learn how to use our relay module and micro:bit to control an LED module on and off. (note that for easy wiring, the circuit does not add 220V voltage, still use 5V.)
Component Required
器件组合图
Component Introduction
Single Relay Module:
This module uses a high-quality SONGLE 5V relay. The relay output is by a light-emitting diode, can be controlled through digital IO. It can be used to control lighting, electrical and other devices of high current or voltage.
When supply high voltage to S end, the relay is driven, that is, normally open (NO) connected, normally closed (NC) disconnected.
When supply low voltage to S end, the relay is turned off, that is, NO is disconnected, and NC connected.
In this way, we connect the 220V AC circuit to NO or NC terminal block, more safe and convenient through 5V voltage control.
Ready to start hooking everything up? Check out the wiring diagram and hookup table below to see how everything is connected.
接线实物图/表格
将继电器的白色端子用线接到扩展板上的P7端口
继电器蓝色端子的Com用杜邦线接到led模块的S口
继电器蓝色端子的NO用杜邦线接到口展板上的“+”电源排针
将led模块的gnd,VCC引脚分别接到扩展板排针上的”-“,”+”.
Insert micro:bit into the edge connector of the expansion board.
Note:micro:bit will always stay attached to the expansion board in the following sessions.
If you are not familiar to make code, don’t worry. Firstly, you can enter this link:https://makecode.microbit.org/reference to know more about microbit blocks.
Then you can directly enter the https://makecode.microbit.org/ to edit your project program. Below is an example code we have done for you.
Example Result
Done wiring and powered up, send the code to MICROBIT. When relay is connected, LED module lights up, and then relay is disconnected, LED module is off, with an interval of one second, repeatedly.
图片
DownLoad Url osoyoo.com