0% found this document useful (0 votes)
25 views6 pages

Lab 6 - Using Relay Module

This document describes a lab experiment on using relay modules to control devices like LEDs and lamps from a Wemos board. The lab has students connect a relay module to control an LED and write code to turn it on and off from serial monitor input. Then it has them connect a relay module to control a 220V lamp and design a web interface or TCP socket program to control the lamp remotely.

Uploaded by

Hồ Vinh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views6 pages

Lab 6 - Using Relay Module

This document describes a lab experiment on using relay modules to control devices like LEDs and lamps from a Wemos board. The lab has students connect a relay module to control an LED and write code to turn it on and off from serial monitor input. Then it has them connect a relay module to control a 220V lamp and design a web interface or TCP socket program to control the lamp remotely.

Uploaded by

Hồ Vinh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

School of CIT, EIU. Lecturer – Phan Van Vinh, Ph.D.

Course: CSE479 – IoT


Lab 6 – Working with Relay Module
Duration: 4 hours

Group ID Write group number here


Students’ name Write students’ name in the group here
Final Score

Lab Exercise Submission

Students are responsible for submitting the final report by the stated deadline for full
marks. Late submissions will NOT be accepted.

Learning Objective: At the end of this Lab, students will be able to:

- Use RELAY module and Wemos

Content Lab Description


- Control LED and Lamp via Relay module
Lab 4. Using Relay Module and - Write a program to control device
DC Motor  Equipment: Computer, Wemos, LED module,
lamp, relay
NOTE: The final report should be written in English and submitted with the
programming source files (if any).

 - Good luck - 

1
School of CIT, EIU. Lecturer – Phan Van Vinh, Ph.D.

Hardware Requirement

# Device Quantity
1 Wemos Board 1
2 BreadBoard 1
3 LED 1
4 Resistor 220Ω 1
5 Relay Module (5V) 1
6 Lamp (220V) 1

Software Requirement

# Software Quantity
1 Arduino IDE 1
2 Fritzing tool 1
3 Visual Studio 1

Report Requirement
1. Submit the Arduino source code
2. Final report (word): include the circuit diagram (by Fritzing tool) and the photo
taken when the circuit is running

2
School of CIT, EIU. Lecturer – Phan Van Vinh, Ph.D.

Lab Experiment Procedure:

Task 1 – Using Relay Module to control LED

Hardware requirements

# Device Quantity
1 Wemos Board 1
2 BreadBoard 1
3 LED 1
4 Resistor 220Ω 1
5 Relay Module 5V 1

Reference:

http://www.explainthatstuff.com/howrelayswork.html

http://electronicshobbyists.com/relay-module-interfacing-with-arduino-arduino-
relay-module/

Question 1:

3
School of CIT, EIU. Lecturer – Phan Van Vinh, Ph.D.

Explain how relay works in details.

Answer:

Experiment Procedure

1. Connect Relay module to your Wemos Board and LED to the BreadBoard
2. Write the code with Arduino IDE with the following requirements:
- When you type “Led ON” in Serial Monitor, Relay is active and LED is
turn ON, print “Led ON” message to Serial Monitor
- When you type “Led OFF” in Serial Monitor, Relay is inactive and LED is
turn OFF, print “Led OFF” message to Serial Monitor

Task 2 – Control LAMP with Wemos and Relay module using a Web interface

Hardware requirements

# Device Quantity
1 Wemos Board 1
2 BreadBoard 1
3 Lamp (220V AC) 1
4 Relay Module 5V 1
5 Power Supply 220V 1

4
School of CIT, EIU. Lecturer – Phan Van Vinh, Ph.D.

Figure 1. Circuit diagram for using Relay module to control Lamp (220V)

Experiment Procedure

1. Connect Relay module to your Arduino Board and Lamp 220V to Relay
module as shown in the figure 1.
NOTE: Before providing the electric source, make sure you have made the
right connection for your electric circuit. Ask Lecturer to check it before going
to next step.
2. Enable web service on Wemos.
3. Design a simple web interface with button to control LAMP 220V.
4. Allow user to connect to Web interface on Wemos to control LAMP and
display how many times the LAMP is turned ON.

5
School of CIT, EIU. Lecturer – Phan Van Vinh, Ph.D.

Task 3 – Control LAMP with Wemos and Relay module using TCP socket

Hardware requirements

# Device Quantity
1 Wemos Board 1
2 BreadBoard 1
3 Lamp (220V AC) 1
4 Relay Module 5V 1
5 Power Supply 220V 1

Experiment Procedure

1. Connect Relay module to your Arduino Board and Lamp 220V to Relay
module as shown in the figure 1.
NOTE: Before providing the electric source, make sure you have made the
right connection for your electric circuit. Ask Lecturer to check it before going
to next step.
2. Create a TCP socket between Wemos (server) and C# program (client)
3. Allow user to use the program on computer to control LAMP and display how
many times the LAMP is ON

You might also like