Project 14 5V Relay Module
1.Introduction
Relay is a automatic control device, the output of which can produce saltatory changes when the input(electricity, magnetism, sound, light and heat) arrives at a certain value. We usually need to use weak current to control strong current in life, namely, the low current controls large current. It looks like when Arduino controller control high power electric appliances like fan, we have to use relay.
In this project, we use graphical programming to control the on and off of 1-channel relay easily. The relay is on for 0.5S and off for 0.5S with an interval of 0.5S, circulating like this.
2.Materials Required
KEYESTUDIO UNO Control Board *1
V5 Sensor Shield*1
5V 1-channel Relay Module*1
Female to Female Dupont Line*3
3.Connection Diagram
Let’s start experiment, and connect ultrasonic waves to ARDUINO referring to the following figure.


4.Sample Code
void setup()
{
pinMode( 3 , OUTPUT);
}
void loop()
{
digitalWrite( 3 , HIGH );
delay( 500 );
digitalWrite( 3 , LOW );
delay( 500 );
}
5.Result
Next, we can see the indicator light of the relay blinking when switch-on and off. Turn on switch for 0.5 seconds,and the led is on; turn off for 0.5 seconds and the led is off ; meanwhile, the relay is ticking.