Professional Documents
Culture Documents
Lab 6 - Using Relay Module
Lab 6 - Using Relay Module
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:
- 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.
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.
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