• Home
  • IOT
  • Articles
  • IoT project of controlling home light using WiFi Node MCU, and Relay module

IoT project of controlling home light using WiFi Node MCU, and Relay module

Last updated on May 30 2022
Sankalp Agarwal

Table of Contents

IoT project of controlling home light using WiFi Node MCU, and Relay module

In this project, we are getting to build a home light controlling system using the Wi-Fi network or Internet (Mobile data). Using this project, we are ready to control our home light from anywhere within the world. during this project, we’ll use Wi-Fi Node MCU, 4 Channel Relay module, etc.

Hardware Requirements

  1. Wi-Fi Node MCU ESP8266
  2. Standard USB cable to attach Node MCU
  3. 4 Channel Relay module (5V)
  4. Jumper wires female to female
  5. Home Light (Bulb)
  6. Bulb holder
  7. Wire
  8. AC 220v/120v home appliances or 9v Hi-Walt Battery

Software requirements

  1. Arduino software
  2. Blynk app

Working principle of this project (Node MCU, Relay Module)

In this project, there are three main components used an Android Blynk app, Wi-Fi Node MCU and 4 Channel Relay module.

image001 3
Working

The Android Blynk app sends the serial data to the Wi-Fi Node MCU by clicking ON button. The Wi-Fi Node read the input file and process it consistent with program uploaded inside it and generate the output to 4 Chanel Relay Module.

When the Blynk app’s button activates , it activates the house light, and when the Blynk app’s buttons turns OFF, it turns OFF the house light.

A program written on Arduino IDE to regulate the house light using WiFi Node MCU, 4 Chanel Relay Module:

  1. #define BLYNK_PRINT Serial
  2. #include
  3. #include
  4. char auth[] = “f839fcfeaf4a47cfb5d0f20771e8xxxx”; // the auth code that you simply got on your gmail and Blynk app
  5. char ssid[] = “NETGEAR64”; // username or ssid of your WI-FI
  6. char pass[] = “password”; // password of your Wi-Fi
  7. void setup()
  8. {
  9. // Debug console
  10. Serial.begin(9600);
  11. pinMode(D1,OUTPUT); //extend these to D8 if you’re employing a 8 pin relay
  12. pinMode(D2,OUTPUT);
  13. pinMode(D3,OUTPUT);
  14. pinMode(D4,OUTPUT);
  15. digitalWrite(D1,HIGH); // Make it low if you would like everything to travel off
  16. digitalWrite(D2,HIGH); // just in case of an influence cut
  17. digitalWrite(D3,HIGH);
  18. digitalWrite(D4,HIGH);
  19. Blynk.begin(auth, ssid, pass);
  20. }
  21. void loop()
  22. {
  23. Blynk.run();
  24. }

Add the board type to your Arduino IDE

Add the board type to your Arduino IDE if not added earlier before compiling. attend File > Preferences > Settings and add http://arduino.esp8266.com/stable/package_esp8266com_index.json in Additional Boards Manager URLs and click on OK.

image003 2
Add board type

Include the esp8266 board community before compiling the above code otherwise, it generates a mistake .

To include library click Tools > Board > Board Manage…

image004 1
Board Manage

Search for esp8266 and install it.

image006
esp8266

Select your board type

Now, select your board type, attend Tools > Board: > NodeMCU 1.0.

image008
board type

Add Libraries

Download the newest Blynk library from https://github.com/blynkkk/blynk-library/releases/latest and add it to program

image010
Add Libraries

If the Blynk libraries aren’t ready to be added in your program then, extract it and paste all the directories in Arduino libraries C:\Program Files (x86)\Arduino\libraries.

Now, connect Node MCU device together with your pc using Standard USB cable to attach Node MCU and upload the program in it.

image011
connect

Digital circuit diagram

4 Channel Relay Module Node MCU

GND ——————————–> GND

IN1 ——————————–> D0

IN2 ——————————–> D1

IN3 ——————————–> D2

IN4 ——————————–> D3

VCC ——————————–> Vin

Connection between Relay Module, Bulb, and input power:

  1. Connect common-point (com) of Relay Module with home light.
  2. Connect normally-open (no) of Relay Module with power.
  3. Connect remaining one home light wire with the facility source.

This project has operated using both Wi-Fi also as Mobile data.

Output:

image013
Output
image014
Output

So, this brings us to the end of blog. This Tecklearn ‘IoT project of controlling home light using WiFi Node MCU, and Relay module’ blog helps you with commonly asked questions if you are looking out for a job in Internet of Things (IoT). If you wish to learn IoT and build a career in Internet of Things (IoT) domain, then check out our interactive, Internet of Things (IoT) Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

https://www.tecklearn.com/course/iot-internet-of-things-training/

Internet of Things (IoT) Training

About the Course

Internet of Things or IoT, as it is widely known, simply put, is a network of devices which can communicate with each other with regards to sending, receiving and analyzing data. Tecklearn’s IoT Training as an online training platform delivers you the best in the industry IoT knowledge by certified and experienced trainers to master IoT. Interactive sessions include two real-time projects to provide in-depth understanding of advanced IoT concepts that covers IoT methods and technologies, application deployment, network and communication protocols and integrations, security measures and real-time data management on the internet. You will learn IoT introduction, significance, building your own IoT devices, sensors, IoT communication and security. This training will help you be a part of the IoT revolution underway around the globe.

Why Should you take IoT (Internet of Things) Training?

  • The average salary for an IoT Engineer is $163,514 per year in the United States. (Indeed.com)
  • Many industries such as Eddie Stobart Transport and Logistics Company, the Amazon, Dell, Aviva, German Auto Manufacturer Daimler, the John Deere Company and Walt Disney Land are all utilizing the Internet of Things technology to monitor various activities and advance their existing systems.
  • Gartner Says 5.8 Billion Enterprise and Automotive IoT Endpoints Will Be in Use in 2020

What you will Learn in this Course?

Introduction to Internet of Things

  • What is IoT, how does it work
  • IoT vs IIoT
  • Business Cases of IIoT
  • Industry 4.0
  • Properties of IoT device
  • IoT Ecosystem
  • IoT Decision Framework
  • IoT Solution Architecture Models
  • How IoT is Transforming Businesses
  • Major IoT Boards in Market

IoT Communication Protocols

  • Types of wireless communication
  • Major wireless Short-range communication devices and properties
  • Comparison of these devices (Bluetooth, WIFI, ZigBee, 6LoWPAN)
  • Major wireless Long-range communication devices and properties, Comparison of these devices (Cellular IoT, LPWAN)

IoT Architecture

  • The IoT Stack Architecture and the various components and layers
  • The app, the data processing and platform
  • IoT OS like Contiki, FreeRTOS and mbe
  • The edge and the connected thing or device

IoT Sensors and Device Platforms

  • Introduction to IoT Sensors and the role they play in getting the IoT systems work efficiently
  • Micro-electromechanical systems revolutionizing IoT sensors
  • Use Case of Water Quality Monitoring
  • Use Case: Sericulture
  • Difference between microcontroller and microprocessor
  • IoT Device Platforms – Arduino, Raspberry Pi etc
  • Smartphone Centric Architecture
  • IoT Application Layer protocols
  • Hands On

Arduino Platform and Arduino Interfacing

  • Arduino physical board, libraries and the Integrated Development Environment
  • Arduino Shields various operations such as heat and light sensing, GPS, UI display
  • Programming Arduino using C language
  • Controlling external devices using pins on the Arduino board
  • The Arduino Interface
  • Reading inputs from various sources and providing an output
  • Working with sensors for sensing and controlling the physical world
  • Deploying various types of sensors and connecting it to the Arduino
  • Constant conversion between analog and digital signals for information exchange between the physical and digital domains
  • Hands On

Raspberry Pi Platform and Raspberry Pi Interfacing

  • Introduction to Raspberry Pi
  • Set up of Raspberry Pi environment
  • Coding for the Raspberry Pi using Python
  • Deploying Python-based Integrated Development Environment
  • Interfacing the Raspberry Pi with the physical world
  • Introducing the various input and output devices
  • Raspberry Pi expansion boards for building complex hardware setup
  • Real-time demo of Raspberry Pi interfacing
  • Hands On

Arduino Uno Wifi and IoTivity

  • Iotivity
  • Iotivity Architecture
  • Hands On

Netduino Platform and Netduino Interfacing

  • Introduction to Netduino Platform
  • Setting up the Netduino environment
  • Coding for the Netduino
  • Interfacing the Netduino with the physical world
  • Introducing the various input and output devices
  • Real-time demo of Netduino interfacing
  • Hands On

IoT for Arduino, NodeMCU and Netduino

  • Control LED light using Netduino board
  • NodeMCU
  • Blynk

Project: Building WSN with MQTT, Raspberry Pi & Arduino

Got a question for us? Please mention it in the comments section and we will get back to you.

0 responses on "IoT project of controlling home light using WiFi Node MCU, and Relay module"

Leave a Message

Your email address will not be published. Required fields are marked *