Description
This project is about how one can connect an electric bulb (any device) with Arduino Uno, using the relay module. It also covers connecting Arduino with Android devices and then switching off/on the bulb on a remote basis from anywhere.
Things used in this project are shown below.
Hardware Component
- Arduino Uno
- Relay Module (HL-52S)
- Jumper Wires (Male to Female)
- A bulb holder with connected wires
Software apps and Online Services
- Arduino IDE
- Blynk Mobile App Installed in Android Phone
Overview
One can control high voltage electronic devices, using relays. A relay is actually a switch that is electrically operated by an electromagnet. The electromagnet is activated with low voltage. For example, 5 volts from a microcontroller and it pulls a contact to make or break a high voltage circuit.
HL-52S Relay Module
This project uses the HL-52S 2 channel relay module, which has 2 relays with a rating of 10A @ 250 and 125 V AC and 10A @ 30 and 28 V DC. The high voltage output connector has 3 pins, the middle one is the common pin and from the markings; one of the two other pins is to normally open the connection and the other one for a normally closed connection.
On the other side of the module, we have 2 sets of pins. The first one has 6 pins, a Ground, a VCC pin for powering the module and 4 input pins In1, ln2, ln3, and In4. The second set of pins has 3 pins with a jumper between the JDVcc and the VCC pin. With a configuration like this, the electromagnet of the relay is directly powered from Arduino Board and if something goes wrong with the relay, the microcontroller can damage.
Steps to follow
Step 1
Connect Arduino with the USB with your system.
Step 2
Connect the ground pin of Arduino with the ground pin of relay module, VCC pin on relay module with 5V on Arduino and finally pin 7 in Arduino with ln1 on relay module.
Step 3
Upload the code given below to Arduino and switch on the current supply of the bulb through the circuit board.
Code
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #include <SoftwareSerial.h>
- SoftwareSerial DebugSerial(2, 3);
-
- #define BLYNK_PRINT DebugSerial
- #include <BlynkSimpleStream.h>
-
-
-
- char auth[] = "Your Auth Token";
-
- void setup()
- {
-
- DebugSerial.begin(9600);
-
-
- Serial.begin(9600);
- Blynk.begin(auth, Serial);
- }
-
- void loop()
- {
- Blynk.run();
- }
Steps to be followed on Android Phone
Step 1
Install the “Blynk” app from the Google Play store and click Create New Project in the app.
Step 2
Add a button on the screen and long press to configure it.
Step 3
Name your project and select your IoT board (Arduino). Subsequently, click Email and finally on create.
Step 4
Name the button to “Bulb”, change the color & select the output as D7 i.e. digital pin 7.
Step 5
Click the play button on the top left of the screen.
The project is all set and now one can control the electrical bulb with the help of an Android phone.