5% OFF Over $19, Code: Elephant5; 10% OFF Over $59, Code: Elephant10



ARDUBLOCK Project 14: 5V Relay Module

Posted by Fiona Su on

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.
Materials Required:

  • 1. KEYESTUDIO UNO Control Board *1
  • 2. V5 Sensor Shield*1
  • 3. 5V 1-channel Relay Module*1
  • 4. Female to Female Dupont Line*3

Connection Diagram:
Let’s start experiment, and connect ultrasonic waves to ARDUINO referring to the following figure.

thumb

thumb

After wiring, we can start programming.
The relay works in high level, and we use digital port 3 in the Arduino controller. Output high level for 0.5 seconds, and then output low level for 0.5 seconds. That is to say, turn on switch for 0.5 seconds and turn off for 0.5 seconds.

thumb

Click “download to Arduino” to see the following codes in ARDUINO programming interface:
Sample Code:

*****************************************************************************
void setup()
{
  pinMode( 3 , OUTPUT);
}

void loop()
{
  digitalWrite( 3 , HIGH );
  delay( 500 );
  digitalWrite( 3 , LOW );
  delay( 500 );
}
*******************************************************************************

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.

All Projects

Buy it >> ARDUBLOCK Graphical Programming Starter Kit for Arduino

 

0 comments

Leave a comment

Please note, comments must be approved before they are published