

Relay module is seen as an automatic switch which controls large current via small one. In circuits, it plays the role of automatic regulator, safety protector and converter.


Driving voltage: DC 3.3 ~ 5V
Driving current: 75 mA(5V) ~ 125 mA(3.3V)
Contact capacity: 250 VAC/3A, 30 VDC/3A
Rated power dissipation: 0.15 W
Input signal: digital signal
Shock current: less than 3 A
Operating temperature: -10°C ~ +50°C
Control signal: digital signal
Dimensions: 24 x 48 x 18 mm (without housing)
Positioning hole: diameter of 4.8 mm
Interface: telephone socket


Internal structure:

The coil inside the relay is wound around the iron core to form an electromagnet, which generates electromagnetic force after powering on.
A relay usually contains a moving contact and two static contacts.

When there is no current in the coil, the electromagnet is not magnetic and is not attractive to the armature, so the moving contact B is in contact with the static contact A. Therefore, A now becomes the normally closed contact (NC). And the moving contact B is also called the common contact (COM).
NC (normally-close): The coil is closed without power.

When a current flows through the coil, the electromagnet is magnetic so that it will attract the armature. At this time, B and the static contact C will be connected. Static contact C is called normally open contact (NO).
NO (normal open): The coil is opened without power.

The 3V relay module is also a digital device so it need to be connected to digital io pins of the board.
In this experiment, we connect the module to port 2, which is pin D6. When we set the pin to high(1), the relay will work; if we set it to low(0), the relay will out of work.



Click
to connect to COM port and click
.

Code Blocks
|
Blocks |
Code block |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

Conceive:
Code framework in this section is same as the last one.
Initialization
Set pin mode.


Main Code
Loop: pin D6 outputs high for 1s to the relay module so then the module is conducted. Immediately, the pin outputs low for 1s to the relay and it turns off.



After uploading code, the relay will work and stop working with an interval of 1s.
When the relay is conducted, B and C is connected and you will hear a tick-tack, and the red LED on the module will light up. When the relay is opened, A and B is connected with also a tick-tack, and the on-board LED goes off.

