• Home
  • IOT
  • Articles
  • IoT project of controlling home light using Bluetooth module, Arduino device, and 4 Channel relay module

IoT project of controlling home light using Bluetooth module, Arduino device, and 4 Channel relay module

Last updated on May 30 2022
Sankalp Agarwal

Table of Contents

IoT project of controlling home light using Bluetooth module, Arduino device, and 4 Channel relay module

In this project, we are getting to build a home light controlling system using the Bluetooth network. during this project, we use Bluetooth Module HC-05, Arduino Device, 4 Channel Relay module, etc.

Hardware Requirements

  1. Arduino UNO board
  2. USB cable for connecter Arduino UNO
  3. Bluetooth Module HC-05
  4. 4 Channel Relay module (5V)
  5. Jumper wires male to female
  6. Home Light (Bulb)
  7. Bulb holder
  8. Wire
  9. AC 220v/120v home appliances or 9v Hi-Walt Battery

Software requirements

  1. Arduino software

Working principle of Arduino-Bluetooth Module

In this project, there are four main components used: Android smartphone Bluetooth application, Bluetooth transceiver, Arduino device, and 4 Channel Relay module.

image001 2
4 Channel Relay module

The Android app sends the serial data to the connected Bluetooth Module HC-05 by clicking ON button. The Bluetooth device receives the info from the app and sends it through TX pin of Bluetooth module to RX pin of Arduino. The Arduino device read the input file and process it consistent with program uploaded inside it and generate the output to 4 Chanel Relay Module.

When the Bluetooth application’s button activates , it sets the house light ON, and when the Bluetooth application’s button turns OFF, it sets the house light OFF.

Write an Arduino program to regulate the house light using Bluetooth Module, 4 Chanel Relay Module with Android application.

  1. String inputs;
  2. #define relay1 2 //connect relay1 to pin 9
  3. #define relay2 3 //connect relay2 to pin 8
  4. #define relay3 4 //connect relay3 to pin 7
  5. #define relay4 5 //connect relay4 to pin 6
  6. #define relay5 6 //connect relay5 to pin 5
  7. #define relay6 7 //connect relay6 to pin 4
  8. #define relay7 8 //connect relay7 to pin 3
  9. #define relay8 9 //connect relay8 to pin 2
  10. void setup(){
  11. Serial.begin(9600); //set rate for communicating with phone
  12. pinMode(relay1, OUTPUT); //set relay1 as an output
  13. pinMode(relay2, OUTPUT); //set relay2 as an output
  14. pinMode(relay3, OUTPUT); //set relay1 as an output
  15. pinMode(relay4, OUTPUT); //set relay2 as an output
  16. pinMode(relay5, OUTPUT); //set relay1 as an output
  17. pinMode(relay6, OUTPUT); //set relay2 as an output
  18. pinMode(relay7, OUTPUT); //set relay1 as an output
  19. pinMode(relay8, OUTPUT); //set relay2 as an output
  20. digitalWrite(relay1, LOW); //switch relay1 off
  21. digitalWrite(relay2, LOW); //switch relay2 off
  22. digitalWrite(relay3, LOW); //switch relay1 off
  23. digitalWrite(relay4, LOW); //switch relay2 off
  24. digitalWrite(relay5, LOW); //switch relay1 off
  25. digitalWrite(relay6, LOW); //switch relay2 off
  26. digitalWrite(relay7, LOW); //switch relay1 off
  27. digitalWrite(relay8, LOW); //switch relay2 off
  28. }
  29. void loop(){
  30. while(Serial.available()){ //check if there are available bytes to read
  31. delay(10); //delay to form it stable
  32. char c = Serial.read(); //conduct a serial read
  33. if (c == ‘#’){
  34. break; //stop the loop once # is detected after a word
  35. }
  36. inputs += c; //means inputs = inputs + c
  37. }
  38. if (inputs.length() >0){
  39. Serial.println(inputs);
  40. if(inputs == “A”){
  41. digitalWrite(relay1, LOW);
  42. }
  43. else if(inputs == “a”){
  44. digitalWrite(relay1, HIGH);
  45. }
  46. else if(inputs == “B”){
  47. digitalWrite(relay2, LOW);
  48. }
  49. else if(inputs == “b”){
  50. digitalWrite(relay2, HIGH);
  51. }
  52. else if(inputs == “C”){
  53. digitalWrite(relay3, LOW);
  54. }
  55. else if(inputs == “c”){
  56. digitalWrite(relay3, HIGH);
  57. }
  58. else if(inputs == “D”){
  59. digitalWrite(relay4, LOW);
  60. }
  61. else if(inputs == “d”){
  62. digitalWrite(relay4, HIGH);
  63. }
  64. else if(inputs == “E”){
  65. digitalWrite(relay5, LOW);
  66. }
  67. else if(inputs == “e”){
  68. digitalWrite(relay5, HIGH);
  69. }
  70. else if(inputs == “F”){
  71. digitalWrite(relay6, LOW);
  72. }
  73. else if(inputs == “f”){
  74. digitalWrite(relay6, HIGH);
  75. }
  76. else if(inputs == “G”){
  77. digitalWrite(relay7, LOW);
  78. }
  79. else if(inputs == “g”){
  80. digitalWrite(relay7, HIGH);
  81. }
  82. else if(inputs == “H”){
  83. digitalWrite(relay8, LOW);
  84. }
  85. else if(inputs == “h”){
  86. digitalWrite(relay8, HIGH);
  87. }
  88. inputs=””;
  89. }
  90. }

Compile and upload your code into the Arduino device using Arduino USB cable. While uploading code doesn’t connect other devices with Arduino.

Digital circuit diagram

Bluetooth Module HC-05 Arduino UNO

RX ——————————–> TX

TX ——————————–> RX

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

5V ——————————–> 3.3V

4 Channel Relay Module Arduino UNO

GND ——————————> GND

IN1 ——————————–> Pin 9

IN2 ——————————–> Pin 8

IN3 ——————————–> Pin 7

IN4 ——————————–> Pin 6

VCC ——————————–> 5V

Connection between Relay Module, Bulb, and input power:

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

Download and install the Android application of Arduino Bluetooth Controller.apk file.

image003 1
Controller.apk file
image004
install

 

 

Output of project:

image005
Output
image006
Output

So, this brings us to the end of blog. This Tecklearn ‘IoT project of controlling home light using Bluetooth module , Arduino device , and 4 Channel 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 Bluetooth module, Arduino device, and 4 Channel relay module"

Leave a Message

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