0% found this document useful (0 votes)
292 views

Final Project

This document discusses an IoT-based home automation project using a Telegram app. It provides an abstract that defines IoT and describes how organizations are using IoT. It then discusses the objectives of the project, which is to develop a home automation system controlled remotely by an Android smartphone using a Node MCU board connected over the internet. Finally, it outlines the contents of the document, which will cover hardware and software requirements, project description, analysis, implementation, testing and future enhancements.

Uploaded by

Keertana R
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
292 views

Final Project

This document discusses an IoT-based home automation project using a Telegram app. It provides an abstract that defines IoT and describes how organizations are using IoT. It then discusses the objectives of the project, which is to develop a home automation system controlled remotely by an Android smartphone using a Node MCU board connected over the internet. Finally, it outlines the contents of the document, which will cover hardware and software requirements, project description, analysis, implementation, testing and future enhancements.

Uploaded by

Keertana R
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 78

IoT Based Home Automation Using Telegram App

Abstract
The internet of things, or IoT, is a network of interrelated devices that connect and exchange data
with other IoT devices and the cloud. IoT devices are typically embedded with technology such
as sensors and software and can include mechanical and digital machines and consumer objects.
Increasingly, organizations in a variety of industries are using IoT to operate more efficiently,
deliver enhanced customer service, improve decision-making and increase the value of the
business. With IoT, data is transferable over a network without requiring human-to-human or
human-to-computer interactions.

An IoT ecosystem consists of web-enabled smart devices that use embedded systems such as
processors, sensors and communication hardware to collect, send and act on data they acquire
from their environments. IoT devices share the sensor data they collect by connecting to an IoT
gateway, which acts as a central hub where IoT devices can send data. Before the data is shared,
it can also be sent to an edge device where that data is analyzed locally. Analyzing data locally
reduces the volume of data sent to the cloud, which minimizes bandwidth consumption.
Sometimes, these devices communicate with other related devices and act on the information they
get from one another. The devices do most of the work without human intervention,although
people can interact with the devices -- for example, to set them up, give them instructions or access
the data. The connectivity, networking and communication protocolsused with these web-enabled
devices largely depend on the specific IoT applications deployed. IoT can also use artificial
intelligence and machine learning to aid in making data collection processes easier and more
dynamic.

The main objective of this project is to develop a home automation system using an node MCU
board with internet being remotely controlled by any android OS smart phone. As technology is
advancing so houses are also getting smarter. Modern houses are gradually shifting from
conventional switches to centralized control system, involving remote controlled switches.
Presently, conventional wall switches located in different parts of the house makes it difficult for
the user to go near them to operate. Even more it becomes more difficult for the elderly or
physically handicapped people to do so. Remote controlled home automation system provides a
most modern solution with smart phones.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


1
2022-2023
IoT Based Home Automation Using Telegram App

DEPARTMENT OF COMPUTER APPLICATION(MCA)


2
2022-2023
IoT Based Home Automation Using Telegram App

CONTENTS

Abstract

Declaration

Acknowledgement

Contents

List of figures

List of Tables

Chapter No Chapter Name Page no

1 Introduction 4

1.1 Introduction to IoT 6

1.2 Characteristics of IoT 7

1.3 Applications of IoT 10

1.4 Project overview 10

1.5 Technical features 11

1.6 Preamble 12

1.7 Problem Statement and Scope 13


of the problem
1.8 Methodology 13
2 Hardware and Software requirements 14

2.1 Introduction 14

2.2 Hardware requirements 12

DEPARTMENT OF COMPUTER APPLICATION(MCA)


3
2022-2023
IoT Based Home Automation Using Telegram App

2.3 Software requirements 20

3 Project Description 28

4 Requirement Analysis 30
5 Analysis and design specification 32
5.1 Architectural design 32
5.2 Module Specification 33
5.3 Flowchart for proposed solution 34
6 Implementation 35
6.1 Structure of Arduino Software 35
6.2 Components Selection for implementation 39
6.3 Execution 40
7 System Testing 45
7.1 Unit testing 45
7.2 Integration testing 46
7.3 Acceptance testing 46
8 Conclusion 49
9 Future Enhancement 50
References
Appendix A Acronyms 52
Appendix B Snapshots 53

DEPARTMENT OF COMPUTER APPLICATION(MCA)


4
2022-2023
IoT Based Home Automation Using Telegram App

DEPARTMENT OF COMPUTER APPLICATION(MCA)


5
2022-2023
IoT Based Home Automation Using Telegram App

Chapter 1

Introduction

1.1 Introduction to Internet of Things(IoT)

Internet of Things(IoT) is an ecosystem of connected devices that exchanges data over a wired or
wireless network. These devices could be smartphones, laptops, smart electric appliances, smart
office equipment or any device tagged with sensors. Data generated by these devices is then shared
with servers located in cloud or on-premise, where it is processed to gain insights that help in
taking decisions. The IoT ecosystem can be established not only within small areas like our homes
or office but over larger areas like gated communities, university campus and cities.Smart devices
that connect with each other are ubiquitous part of our lives. As an individual user or business
owner providing IoT related products and services, it makes sense to understand evolution of IoT.
Knowledge of past equips us to foresee the future and use any technology to our advantage.

A child grows every day and amazes their parents every moment, but still there are some moments that
become milestones in their life history. Let us attempt to chronicle such milestone moments in the evolution
of IoT:ARPANET was the first connected network – granddad of the Internet as we know it today. The
history of IoT starts with ARPANET.In 1982, a graduate student in Carnegie Mellon University’s computer
science department, David Nichols, wanted to know if the department’s coke vending machine had cold
soda bottles. He was tired of going to the machine only to find there was no cold bottle available; the
vending machine was quite some distance from his classrooms. So, he wanted to have information
beforehand.He was helped in this endeavor by Mike Kazar and Ivor Durham, two fellow students, and
John Zsarnay, a research engineer at the university. The code they wrote could checkif coke was available
in the vending machine, and if yes, whether it was cold or not. Anyone on the university ARPANET could
monitor the status of the coke vending machine.In 1989 Tim Berners Lee proposed the framework of world
wide web, which laid the foundation of the Internet.In 1990 John Romkey developed a toaster that could
be turned on and off over the Internet. It was a toaster wired to the computer as there was no Wi-Fi then!!
This toaster is considered to be the first IoT device – the first
“thing” that began Internet of Things.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


6
2022-2023
IoT Based Home Automation Using Telegram App

DEPARTMENT OF COMPUTER APPLICATION(MCA)


7
2022-2023
IoT Based Home Automation Using Telegram App

In 1993, the Trojan Room Coffee Pot was built in the computer laboratory of the University of Cambridge
by Quentin Stafford-Fraser and Paul Jardetzky in 1993. An image of the interior of the pot was uploaded
to the building server thrice every minute. Later on, when browsers began displaying images, these images
could be viewed online.The next milestone in development of IoT came in 1999 when Kevin Ashton,
current Executive Director of the Auto-ID Labs, coined the term Internet of Things.It was the title of a
presentation he made at Procter and Gamble (where he was working at that point of time) about linking
RFID in P&G’s supply chain to the Internet.The term IoT began to be used in mainstream publications like
The Guardian and Scientific American by 2003-2004. In the same period RFID deployed by the US
department of Defence and by Walmart in its stores.The United Nations International Telecommunications
Union acknowledged the impact of IoT in its report in 2005. It predicted that IoT will help create an entirely
new dynamic network of networks.In March 2008, the first IoT conference was held in Zurich. It brought
together researchers and practitioners from both academia and industry to facilitate sharing of knowledge.

Figure 1.1: Internet of Things

Interconnecting the physical world with the virtual world and applying this concept to all things
opens up new possibilities in the sense of being able to at any time access anything from any
place. Providing new possibilities will also generate new threats, security risks and expose
vulnerabilities in the unexplored world of interconnected everything. “Things” in the physical

DEPARTMENT OF COMPUTER APPLICATION(MCA)


8
2022-2023
IoT Based Home Automation Using Telegram App

DEPARTMENT OF COMPUTER APPLICATION(MCA)


9
2022-2023
IoT Based Home Automation Using Telegram App

world are objects that physically exists and from the perspective of IoT we are able to sense,
operate, and connect to these things, while in the virtual world “things” are objects that can be
stored, accessed, and processed. IoT involves sensors in order to collect information. Sensors are
already being used in daily life, however most people may not realise it. Smartphones contain
different kind of sensors, such as accelerometers, cameras, and GPS receivers. Built-in sensors
are nothing new in today’s society. Kevin Ashton said that IoT is already happening, but we might
not see it compared to Smartphones which can both be seen and touched. RFID is such anIoT-
technology that exists but is not necessarily seen; so the development of IoT might progressa long
way before it is visible for everyone.

1.2 Characteristics of IoT

The Internet of Things (IoT) is characterized by the interconnection of various physical objects,
devices, and systems through the internet. Key characteristics include:

1. Connectivity: IoT devices are connected to the internet, enabling them to exchange data and
communicate with each other and centralized systems.

2. Sensors and Actuators: IoT devices often have sensors to collect data from the environment
and actuators to perform actions based on that data.

3. Data Collection: IoT devices gather and transmit data, often in real-time, allowing for the
monitoring and analysis of various parameters.

4. Interoperability: IoT devices are designed to work together and share information seamlessly
across different platforms and technologies.

5. Remote Control: IoT devices can be remotely monitored and controlled, enabling users to
manage them from a distance.

6. Automation: IoT systems can operate autonomously based on predefined rules or data inputs,
reducing the need for human intervention.

7. Data Analytics: IoT generates massive amounts of data, which can be analyzed to derive

DEPARTMENT OF COMPUTER APPLICATION(MCA)


10
2022-2023
IoT Based Home Automation Using Telegram App

insights and make informed decisions.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


11
2022-2023
IoT Based Home Automation Using Telegram App

8. Scalability: IoT systems can be scaled up or down easily to accommodate a growing number
of connected devices.

9. Security and Privacy: Ensuring the security and privacy of IoT devices and the data they
transmit is a critical consideration due to the potential vulnerabilities.

10. Real-time Communication: IoT devices enable real-time communication and response,
making them suitable for applications requiring quick actions.

11. Diverse Applications: IoT is used in various sectors, such as healthcare, smart homes,
agriculture, manufacturing, transportation, and more.

12. Energy Efficiency: Many IoT devices are designed to be energy-efficient to prolong battery
life and reduce power consumption.

1.3 Applications of IoT

Figure 1.2 : Application of IoT

1. Smart Home:

One of the most common applications of IoT at home is the integration of smart devices such as

DEPARTMENT OF COMPUTER APPLICATION(MCA)


12
2022-2023
IoT Based Home Automation Using Telegram App

surveillance cameras, smart doorbells, and alarms for security improvement and safety. All IoT

DEPARTMENT OF COMPUTER APPLICATION(MCA)


13
2022-2023
IoT Based Home Automation Using Telegram App

home automation can be accessed on your smartphone even if you're not home, as long as you're
connected to the internet.

2. Wearables:

Wearable IoT devices like fitness trackers and smartwatches monitor users' physical activity,
heart rate, sleep patterns, and more. These devices sync with smartphone apps, allowing
individuals to track their health and fitness goals. The data collected assists users in making
informed decisions about their well-being and lifestyle.

3. Smart City:

In a smart city application of the Internet of Things (IoT), various technologies and sensors are
integrated throughout urban infrastructure to gather and analyze data. This enables city planners
and administrators to make informed decisions that improve efficiency, sustainability, and the
quality of life for residents. Smart city IoT applications involve real-time data collection from
sources like traffic lights, waste management systems, energy grids, and public transportation,
leading to enhanced urban management and services.

4. Smart Grid:

IoT devices are integrated into the energy grid to monitor electricity generation, distribution, and
consumption. Smart meters installed in homes and businesses provide real-time data on energy
usage. Utilities can use this data to balance supply and demand, detect faults, and implement
demand-response programs. This leads to efficient energy distribution, reduced energy waste, and
cost savings for consumers.

5. Industrial IoT:

IoT sensors are attached to industrial machinery to monitor performance, temperature, vibration,
and other parameters. The data is transmitted to a central system, allowing engineers to monitor
and diagnose equipment health remotely. This enables predictive maintenance, minimizes
unplanned downtime, and improves overall production efficiency.

6. Connected Car:

DEPARTMENT OF COMPUTER APPLICATION(MCA)


14
2022-2023
IoT Based Home Automation Using Telegram App

DEPARTMENT OF COMPUTER APPLICATION(MCA)


15
2022-2023
IoT Based Home Automation Using Telegram App

In the context of connected cars, IoT technology is used to link vehicles to the internet and other
vehicles, enabling real-time data exchange. This allows cars to communicate with each other,
traffic infrastructure, and central systems, leading to improved navigation, safety features, and
vehicle diagnostics. Connected car applications use data such as GPS, sensors, and vehicle status
to enhance driver experience and road safety.

7. Connected Healthcare:

Connected healthcare uses IoT technology to integrate medical devices, wearable sensors, and
patient data with digital platforms. This enables remote patient monitoring, personalized
treatment, and efficient healthcare management. By collecting and analyzing real-time health
data, connected healthcare improves patient outcomes, enables timely interventions, and
empowers individuals to take control of their well-being.

8. Smart Retail:

In smart retail, IoT technology is employed to create a more efficient and personalized shopping
experience. By connecting devices like smart shelves, beacons, and POS systems, retailers can
gather data on inventory levels, customer preferences, and store traffic. This data-driven approach
enables optimized stock management, targeted promotions, and smoother checkout processes,
enhancing customer satisfaction and streamlining operations.

9. Smart Supply Chain:

In a smart supply chain, IoT is used to enhance visibility and efficiency across the entire logistics
process. By integrating sensors and data analytics, companies can monitor the movement,
condition, and ___location of goods in real time. This enables accurate tracking, timely alerts for
potential issues, and optimized route planning, leading to improved inventory management,
reduced delays, and more responsive supply chain operations.

10. Smart Farming:

Smart farming leverages IoT technology to enhance agricultural practices. By connecting


sensors, drones, and data analytics, farmers can monitor soil conditions, weather patterns, and

DEPARTMENT OF COMPUTER APPLICATION(MCA)


16
2022-2023
IoT Based Home Automation Using Telegram App

crop health in real time. This data-driven approach enables precision agriculture, allowing

DEPARTMENT OF COMPUTER APPLICATION(MCA)


17
2022-2023
IoT Based Home Automation Using Telegram App

farmers to optimize irrigation, fertilization, and pest control, leading to increased yields, resource
efficiency, and sustainable farming practices.

1.4 Project Overview:

This project demonstrates how to control an electrical appliance, such as a light, remotely using a
Telegram app. The NodeMCU (ESP8266) microcontroller is used to receive commands from the
Telegram bot and control a relay module, which in turn controls the power to the light.

1.5 Technical Features

NodeMCU (ESP8266):

The NodeMCU is a low-cost microcontroller with built-in Wi-Fi capabilities, making it ideal for
IoT projects. It connects to the internet, receives commands from the Telegram bot, and controls
the relay module accordingly.

Telegram Bot:

A Telegram bot is created using the Telegram Bot API. Users interact with the bot by sending
commands (such as "/turnon") through the Telegram app. The bot processes these commands and
sends them to the NodeMCU.

MQTT Protocol:

MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol used for
communication between devices in IoT projects. The NodeMCU subscribes to an MQTT topic,
and the Telegram bot publishes messages to this topic when a user sends a command.

Relay Module:A relay module is connected to the NodeMCU. The relay acts as an electronic
switch, allowing the NodeMCU to control the power supply to the connected light. When the
NodeMCU receives a command from the Telegram bot, it triggers the relay module to turn the
light on or off.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


18
2022-2023
IoT Based Home Automation Using Telegram App

DEPARTMENT OF COMPUTER APPLICATION(MCA)


19
2022-2023
IoT Based Home Automation Using Telegram App

Wi-Fi Connectivity:

The NodeMCU connects to a Wi-Fi network, allowing it to communicate with the internet and
the Telegram bot. It uses the Wi-FiManager library to configure Wi-Fi credentials, making the
setup process user-friendly.

Arduino IDE Programming:

The NodeMCU is programmed using the Arduino IDE. Libraries such as "PubSubClient" for
MQTT communication and "UniversalTelegramBot" for Telegram bot interaction are used. The
code listens for messages from the MQTT topic and responds to commands from the Telegram
bot by toggling the relay module.

Security Considerations:

Security measures should be implemented to prevent unauthorized access to the system. For
example, using token-based authentication for the Telegram bot and secure MQTT
communication.

Feedback and Status Updates:

The system can provide feedback to the user by sending messages back to the Telegram app. For
instance, the bot can confirm that the light has been turned on or off.

By combining these technical features, the project demonstrates how IoT devices can be
controlled remotely through popular messaging platforms like Telegram, providing users with a
convenient and interactive way to manage connected devices such as lights

1.6 Preamble

The process of controlling various operating equipment, machinery, factory operations, etc.,
automatically(sometimes remotely) using control systems can be termed as automation.
Automation is an efficient method to use in every field such that to reduce manpower, energyusage
and also for improving the quality and efficiency of any system. There are various

DEPARTMENT OF COMPUTER APPLICATION(MCA)


20
2022-2023
IoT Based Home Automation Using Telegram App

DEPARTMENT OF COMPUTER APPLICATION(MCA)


21
2022-2023
IoT Based Home Automation Using Telegram App

emerging automation application and a few can be listed as home automation system, industrial
automation system, automated mining system, automated waste management system and so on.

1.7 Problem Statement and Scope of the Project

Problem Statement:

The problem statement for the project "Home Automation Using Telegram App UsingNodeMCU
and Relay" can be framed as follows:

In today's era of home automation and smart technologies, there is a growing need for convenient
and remote control of household appliances. Users seek an efficient and user-friendlysolution to
remotely control lighting fixtures, such as turning lights on and off, using their smartphones. This
project aims to address this need by developing a system that allows users to control a light source
using the popular messaging app Telegram. The project will involve integrating the NodeMCU
(ESP8266) microcontroller with a relay module to establish a seamless connection between the
Telegram app and the physical light source.

Scope of the Project:

The scope of the project "Turning On Light Using Telegram App Using NodeMCU and Relay"
encompasses the following aspects:

Hardware Setup:

The project will involve setting up the NodeMCU microcontroller and relay module, connecting
them to a physical light source. The relay will act as a switch to control the power supply to the
light.

Telegram Bot Integration:

A Telegram bot will be created using the Telegram Bot API. Users will be able to interact with
the bot by sending commands to turn the light on or off.

Remote Control:

DEPARTMENT OF COMPUTER APPLICATION(MCA)


22
2022-2023
IoT Based Home Automation Using Telegram App

DEPARTMENT OF COMPUTER APPLICATION(MCA)


23
2022-2023
IoT Based Home Automation Using Telegram App

The system will enable users to control the light remotely using commands sent via the Telegram
app. When the user sends a command to the bot, the NodeMCU will receive the command and
toggle the relay module accordingly.

Real-time Feedback:

The system will provide real-time feedback to users. For instance, the bot may send a
confirmation message when the light is successfully turned on or off.

Testing and Verification:

The functionality of the system will be thoroughly tested to ensure that the light can be reliably
controlled using Telegram commands. Both normal and edge cases will be considered.

Potential for Expansion:

The project's scope will include a discussion of potential future enhancements, such as
integrating more appliances, implementing voice commands, or incorporating scheduling
features.

The project's scope focuses on creating a functional prototype that demonstrates the core concept
of turning a light on and off using a Telegram app. It aims to provide users with a tangible solution
for convenient home automation and IoT control.

1.8 Methodology

The heart of automatic home automation is consisting of NodeMCU hardware, sensors and
Telegram application. NodeMCU has been chosen as the processing unit for the system because
of its user-friendly features and economic benefits.

Further, python coded algorithm has been fed into the NodeMCU and is connected to the internet
through Modem interface to access and send data to web. The devices to be controlled have been
interfaced with NodeMCU using relay driver circuit due to different power ratings of devices and
NodeMCU. The sensor data are fed into app via integrated Telegram app on NodeMCU.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


24
2022-2023
IoT Based Home Automation Using Telegram App

DEPARTMENT OF COMPUTER APPLICATION(MCA)


25
2022-2023
IoT Based Home Automation Using Telegram App

Chapter 2

Hardware and Software Requirement Specification


2.1 Introduction

The design consists more on actual planning of software and hardware part than the code to
be created. A number of software and hardware implementation techniques were used to design
and develop the system.

2.2 Hardware Requirements

2.2.1 NodeMCU ESP8266

ESP8266 NodeMCU is an open source IoT platform. It includes firmware which runs
on the low cost Wi-Fi enabled ESP8266 Wi-Fi SoC from Espressif Systems, and hardware
which is based on the ESP-12 module. It has GPIO, SPI, I2C, ADC, PWM AND UART pins
for communication and controlling other peripherals attached to it. On board NodeMCU has
CP2102 IC which provides USB to TTL functionality. In this project we are going to use D0
GPIO pin to change the state of the relay.

Figure 2.1 NodeMCU ESP8266 model

Components of NodeMCU

• ESP-8266 32-bit microcontroller

DEPARTMENT OF COMPUTER APPLICATION(MCA)


26
2022-2023
IoT Based Home Automation Using Telegram App

• CP2102 USB to Serial

DEPARTMENT OF COMPUTER APPLICATION(MCA)


27
2022-2023
IoT Based Home Automation Using Telegram App

• Micro USB Connector


• ESP8266-12E Wi-Fi Chip
• 2.4GHz Antenna
• 3.3V Operating Voltage
• 11 Digital I/O Pins
• 1 Analog In Pins

NodeMCU Pinout and Functions Explained

Figure 2.2 Pinout of NodeMCU


• Power Pins There are four power pins. VIN pin and three 3.3V pins.
--> VIN can be used to directly supply the NodeMCU/ESP8266 and itsperipherals.
Power delivered on VIN is regulated through the onboard regulator
on the NodeMCU module – you can also supply 5V regulated to the VIN pin.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


28
2022-2023
IoT Based Home Automation Using Telegram App

--> 3.3V pins are the output of the onboard voltage regulator and can be used to
supply power to external components.
• GND are the ground pins of NodeMCU/ESP8266.
• I2C Pins are used to connect I2C sensors and peripherals. Both I2C Master and I2C
Slave are supported. I2C interface functionality can be realized programmatically, and
the clock frequency is 100 kHz at a maximum. It should be noted that I2C clock
frequency should be higher than the slowest clock frequency of the slave device.
• GPIO Pins NodeMCU/ESP8266 has 17 GPIO pins which can be assigned to functions
such as I2C, I2S, UART, PWM, IR Remote Control, LED Light and Button
programmatically. Each digital enabled GPIO can be configured to internal pull-up or
pull-down, or set to high impedance. When configured as an input, it can also be set
to edge-trigger or level-trigger to generate CPU interrupts.
• ADC Channel The NodeMCU is embedded with a 10-bit precision SAR ADC. The
two functions can be implemented using ADC. Testing power supply voltage of
VDD3P3 pin and testing input voltage of TOUT pin. However, they cannot be
implemented at the same time.
• UART Pins NodeMCU/ESP8266 has 2 UART interfaces (UART0 and UART1) which
provide asynchronous communication (RS232 and RS485), and can communicate at up
to 4.5 Mbps. UART0 (TXD0, RXD0, RST0 & CTS0 pins) can be used for
communication. However, UART1 (TXD1 pin) features only data transmit signal so, it
is usually used for printing log.
• SPI Pins NodeMCU/ESP8266 features two SPIs (SPI and HSPI) in slave and master
modes. These SPIs also support the following general-purpose SPI features:
--> 4 timing modes of the SPI format transfer
--> Up to 80 MHz and the divided clocks of 80 MHz
--> Up to 64-Byte FIFO
• SDIO Pins NodeMCU/ESP8266 features Secure Digital Input/Output Interface (SDIO)
which is used to directly interface SD cards. 4-bit 25 MHz SDIO v1.1 and 4- bit 50
MHz SDIO v2.0 are supported.
• PWM Pins The board has 4 channels of Pulse Width Modulation (PWM). The PWM
output can be implemented programmatically and used for driving digital motors and
LEDs. PWM frequency range is adjustable from 1000 μs to 10000 μs (100 Hz and 1
kHz).
• Control Pins are used to control the NodeMCU/ESP8266. These pins include Chip
Enable pin (EN), Reset pin (RST) and WAKE pin.
--> EN: The ESP8266 chip is enabled when EN pin is pulled HIGH.
When pulled LOW the chip works at minimum power.
--> RST: RST pin is used to reset the ESP8266 chip.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


29
2022-2023
IoT Based Home Automation Using Telegram App

--> WAKE: Wake pin is used to wake the chip from deep-sleep.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


30
2022-2023
IoT Based Home Automation Using Telegram App

USB to Serial Converter – CP2102 or CH340G


Incorporated into each NodeMCU is a USB to Serial Converter. The official design is based
on the CP2102 chipset and offers the best compatibility. Genuine boards use the CP2102
chipset including the officially licensed Amica NodeMCU modules.
Depending on the Operating System you are using with the NodeMCU, the appropriate driver
must be installed. Generally, Windows 10 immediately recognizes the CP2102 chipset, if not
may require separate installation.

CP2102 Serial Converter from Silicon LabsDrivers for the CP2102 are available
for download from the Silicon Labs support site. Drivers constantly evolve and ensuring and
installing the most recent version in your development environment minimum issues. Drivers
are available for Windows, Mac, Linux, and Android. We also have a local copy of the CP2102
drivers (v10.1.8) available locally for download. You are always best to visit the original
manufacturer to ensure you are receiving the most recent versions of the driver.

2.2.2 Relay
Relay is one kind of electro-mechanical component that functions as a switch. The relay coil is
energized by DC so that contact switches can be opened or closed. A single channel 5V relay
module generally includes a coil, and two contacts like normally open (NO) and normally
closed (NC). This article discusses an overview of the 5V relay module & its working but
before going to discuss what is relay module is, first we have to know what is relay and its pin
configuration.
5V One-Channel Relay
A 5v relay is an automatic switch that is commonly used in an automatic control circuit and
to control a high-current using a low-current signal. The input voltage of the relay signal ranges
from 0 to 5V.

5V Relay Pin Configuration


The pin configuration of the 5V relay is shown below. This relay includes 5-pins where each
pin and its functionality are shown below.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


31
2022-2023
IoT Based Home Automation Using Telegram App

Figure 2.3 5V Relay Configuration

• Pin1 (End 1): It is used to activate the relay; usually this pin one end is connected to
5Volts whereas another end is connected to the ground.
• Pin2 (End 2): This pin is used to activate the Relay.
• Pin3 (Common (COM)): This pin is connected to the main terminal of the Load to
make it active.
• Pin4 (Normally Closed (NC)): This second terminal of the load is connected to either
NC/ NO pins. If this pin is connected to the load then it will be ON before the switch.
• Pin5 (Normally Open (NO)): If the second terminal of the load is allied to the NO pin,
then the load will be turned off before the switch.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


32
2022-2023
IoT Based Home Automation Using Telegram App

Figure 2.4 Relay Pin-out Diagram

• Normally Open (NO): This pin is normally open unless we provide a signal to the relay
modules signal pin. So, the common contact pin smashes its link through the NCpin to
make a connection through the NO pin
• Common Contact: This pin is used to connect through the load that we desire to
switch by using the module.
• Normally Closed (NC): This NC pin is connected through the COM pin to form a closed
circuit. However, this NC connection will break once the relay is switched through
providing an active high/low signal toward the signal pin from amicrocontroller.
• Signal Pin: The signal pin is mainly used for controlling the relay. This pin works in
two cases like active low otherwise active high. So, in active low case, the relay
activates once we provide an active low signal toward the signal pin, whereas, in an
active high case, the relay will trigger once we provide a high signal toward the signal
pin.
• However, these modules generally work on an active high signal which will strengthen
the relay coil to make contact with the common terminal with the normally open
terminal.
• 5V VCC: This pin needs 5V DC to work. So 5V DC power supply is provided to this
pin.
• Ground: This pin connects the GND terminal of the power supply.

2.2.3 Jumper Wires


Jumper wires are electrical wires with connector pins at each end. They are used to connect
two points in a circuit without soldering.
Types of Jumper Wires
Jumper wires come in three versions:
• Male-to-male jumper
• Male-to-female jumper
• Female-to-female jumper

DEPARTMENT OF COMPUTER APPLICATION(MCA)


33
2022-2023
IoT Based Home Automation Using Telegram App

Figure 2.5 Jumper Wires

2.3 Software Requirements

2.3.1 Arduino IDE


The Arduino Integrated Development Environment - or Arduino Software (IDE) - contains a
text editor for writing code, a message area, a text console, a toolbar with buttons for common
functions and a series of menus. It connects to the Arduino hardware to upload programs and
communicate with them.

2.3.2 Telegram Application:


Telegram is a messaging app with a focus on speed and security, it’s super-fast, simple and
free. You can use Telegram on all your devices at the same time your messages sync seamlessly

DEPARTMENT OF COMPUTER APPLICATION(MCA)


34
2022-2023
IoT Based Home Automation Using Telegram App

across any number of your phones, tablets or computers. With Telegram, you can

DEPARTMENT OF COMPUTER APPLICATION(MCA)


35
2022-2023
IoT Based Home Automation Using Telegram App

send messages, photos, videos and files of any type (doc, zip, mp3, etc), as well as create groups
for up to 200,000 people or channels for broadcasting to unlimited audiences. You canwrite to
your phone contacts and find people by their usernames. As a result, Telegram is likeSMS and
email combined and can take care of all your personal or business messaging needs. In addition
to this, we support end-to-end encrypted voice calls.
Telegram bot
Bots are third-party applications that run inside Telegram. Users can interact with bots by
sending them messages, commands and inline requests. You control your bots using HTTPS
requests to our bot API
• Get customized notifications and news. A bot can act as a smart newspaper, sending you
relevant content as soon as it's published.
• Integrate with other services. A bot can enrich Telegram chats with content from external
services. Gmail Bot, Image Bot, GIF bot, IMDB bot, Wiki bot, Music bot, Youtube bot, GitHub
bot
• Accept payments from Telegram users. A bot can offer paid services or work as a virtual
storefront.
• Create custom tools. A bot may provide you with alerts, weather forecasts, translations,
formatting or other services. Markdown bot, Sticker bot, Vote bot, Like bot
• Build single- and multiplayer games. A bot can offer rich HTML5 experiences, from simple
arcades and puzzles to 3D-shooters and real-time strategy games.
• Build social services. A bot could connect people looking for conversation partners based
on common interests or proximity.
• Do virtually anything else. Except for dishes bots are terrible at doing the dishes.

Working Principals of Telegram Bot


At the core, Telegram Bots are special accounts that do not require an additional phone number
to set up. Users can interact with bots in two ways:
• Send messages and commands to bots by opening a chat with them or by adding them
to groups. This is useful for chat bots or news bots like the official TechCrunch bot.
• Send requests directly from the input field by typing the bot's @username and a
query. This allows sending content from inline bots directly into any chat, group or
channel.
Messages, commands and requests sent by users are passed to the software running on your

DEPARTMENT OF COMPUTER APPLICATION(MCA)


36
2022-2023
IoT Based Home Automation Using Telegram App

servers. The intermediary server handles all encryption and communication with the

DEPARTMENT OF COMPUTER APPLICATION(MCA)


37
2022-2023
IoT Based Home Automation Using Telegram App

Telegram API for you. You communicate with this server via a simple HTTPS-interface that
offers a simplified version of the Telegram API. The following steps shows the creation of
telegram bot and obtaining chat id

Steps for creating Telegram Bot

Step1: Search for the “botfather” telegram bot as show in following figure

Figure 2.6 Botfather Search

Step2. Type /help to see all possible commands the botfather can handle as show in following
figure

DEPARTMENT OF COMPUTER APPLICATION(MCA)


38
2022-2023
IoT Based Home Automation Using Telegram App

Figure 2.7 /help command

Step3. Click on or type /newbot to create a new bot as show in following figure

DEPARTMENT OF COMPUTER APPLICATION(MCA)


39
2022-2023
IoT Based Home Automation Using Telegram App

Figure 2.8 Newbot Creation

Step 4. You have created your first bot. You should see a new API token generated for it (for
example, in the previous picture, you can see my newly generated token is
6179682899:AAHOjYx0wR1jaEUvE6Kh9nf1bhLWI2QBo0Y). Now you can search for your
newly created bot on telegram as show in following figure and start sending and
receiving the message

DEPARTMENT OF COMPUTER APPLICATION(MCA)


40
2022-2023
IoT Based Home Automation Using Telegram App

Figure 2.9 Token Generation

Step5: Type userinfobot in the search bar as shown in the following figure

Figure 2.10 Userinfobot Search

Step 6. Open the Userinfobot as shown in the figure

DEPARTMENT OF COMPUTER APPLICATION(MCA)


41
2022-2023
IoT Based Home Automation Using Telegram App

Figure 2.11 Userinfobot Start

Step 7. Click Start and you will see your UserID as the userinfobot sent to you as shown in
following figure. (The Number ID)

DEPARTMENT OF COMPUTER APPLICATION(MCA)


42
2022-2023
IoT Based Home Automation Using Telegram App

Figure 2.12 Chat ID

DEPARTMENT OF COMPUTER APPLICATION(MCA)


43
2022-2023
IoT Based Home Automation Using Telegram App

Chapter 3
Project Description

3.1 Introduction

Traditionally, homes have been wired for four systems; power, telephones, cable TV outlets,
and a doorbell. Typically, components and wiring for these are kept within a closet or a patch
panel. Home automation has been around since World War I. A television remote was first
patented in 1950, and a remote-control device was first used by the Germans in World War I
to control motorboats. From there, the evolution of controllers and automation has been
growing and still continue to grow to this day. In advanced installations, rooms can sense not
only the presence of a person but know who that person is and perhaps set appropriate lighting,
temperature, music or television levels taking into account the day of the week, the time of day,
and other factors.

Other automated tasks may include setting the air conditioning to an energy saving setting
when the house is unoccupied, and restoring the normal setting when an occupant is about to
return. More sophisticated systems can maintain an inventory of products, recording their usage
through an RFID tag, and prepare a shopping list or even automatically order replacements.
automation of household appliances and features in residential dwellings, particularly through
electronic means that allow for things impracticable, overly expensive or simply not possible
in recent past decades. The term may be used in contrast to the more mainstream "building
automation," which refers to industrial settings and the automatic or semi-automatic control
of lighting, climate doors and windows, and security and surveillance systems. The techniques
employed in home automation include those in building automation as well as the control of
home entertainment systems, houseplant watering, pet feeding, "scenes" for different events
(such as dinners or parties), and the use of domestic robots.
Typically, it is easier to more fully outfit a house during construction due to the accessibility
of the walls, outlets, and storage rooms, and the ability to make design changes specifically to
accommodate certain technologies. Wireless systems are commonly installed when outfitting
a pre-existing house, as they obviate the need to make major structural changes. These
communicate via radio or infrared signals with a central controller. Home automation now
becomes an essential part of IoT applications and people use their smartphone to control
home appliances from anywhere over internet. There are various ways to control AC

DEPARTMENT OF COMPUTER APPLICATION(MCA)


44
2022-2023
IoT Based Home Automation Using Telegram App

appliances with smartphone.In this IoT project we will control an AC lamp with a text
message from Telegram application using NodeMCU.

Figure 3.1 Remote control of Light

DEPARTMENT OF COMPUTER APPLICATION(MCA)


45
2022-2023
IoT Based Home Automation Using Telegram App

Chapter 4
Requirement Analysis
4.1 Introduction

Internet of things is a technology of the future that has already started to touch our homes.
The IOT based home automation system using raspberry pi that automates home appliances
and allows user to control them easily through internet from anywhere over the world or within
the home. It uses a combination of hardware and software to enable control and management
over appliances and devices within a home. Home automation not only refers to reduce human
efforts but also energy efficiency and time saving. As home automation apps become more
intelligent, their capabilities become almost endless from controlling lights.Not only can
you control your home, but you can also set commands that help your devices learn and then
automatically react to your schedule. Your devices can even work together to create a more
cohesive experience. For example, you can have your thermostat adjust and your lights turn off
at a certain time, say when you’re leaving the house in the morning. You can also combine
hubs to increase connectivity across your home. The benefits of home automation typically fall
into a few categories, including savings, safety, convenience, and control. Additionally, some
consumers purchase home automation for comfort and peace of mind.

The main objective of this project is to develop a home automation system using a Node MCU
board with Internet being remotely controlled by any Android /OS smart phone. As technology
is advancing so houses are also getting smarter. Modern houses are gradually shifting from
conventional switches to centralized control system, involving remote controlled switches.
Presently, conventional wall switches located in different parts of the house makes it difficult
for the user to go near them to operate. Even more it becomes more difficult for the elderly or
physically handicapped people to do so. Remote controlled home automation system provides
a most modern solution with smart phones. The figure 1 shows the home automation using
blynk mobile application.

Hardware Requirement

• NodeMCU

DEPARTMENT OF COMPUTER APPLICATION(MCA)


46
2022-2023
IoT Based Home Automation Using Telegram App

• Relay

DEPARTMENT OF COMPUTER APPLICATION(MCA)


47
2022-2023
IoT Based Home Automation Using Telegram App

• Jumper Wires

• Light

Software Requirement
• Arduino IDE

• Telegram Application

Objective of the proposed Work

• To Provides best prototype for Smart home.

• To provides an easy way to control the electronic devices remotely such as fan, lights,
AC and other electronic devices from smart phones

• To helps the elderly or physically handicapped people to do control and monitor the
home remotely.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


48
2022-2023
IoT Based Home Automation Using Telegram App

Chapter 5

Analysis and Design Specification

5.1 Architectural Deign

It is the process where the architecture of the complete project is designed and how
the data is flowing in complete project.

Figure 5.1 Circuit Diagram

DEPARTMENT OF COMPUTER APPLICATION(MCA)


49
2022-2023
IoT Based Home Automation Using Telegram App

Figure 5.2: Block Diagram of Home Automation System

5.2 Module Specification

Arduino IDE
The Arduino Integrated Development Environment - or Arduino Software (IDE) -
contains a text editor for writing code, a message area, a text console, a toolbar with buttons
for common functions and a series of menus. It connects to the Arduino hardware to upload
programs and communicate with them.

Relay Module

A relay is an electrically operated switch that can be turned on or off, letting the current
go through or not, and can be controlled with low voltages, like the 5V provided by the
Raspberry Pi pins

Telegram Application
Telegram is a messaging app with a focus on speed and security, it’s super-fast, simple
and free. You can use Telegram on all your devices at the same time your messages sync
seamlessly across any number of your phones, tablets or computers. With Telegram, you can

DEPARTMENT OF COMPUTER APPLICATION(MCA)


50
2022-2023
IoT Based Home Automation Using Telegram App

send messages, photos, videos and files of any type (doc, zip, mp3, etc), as well as create

DEPARTMENT OF COMPUTER APPLICATION(MCA)


51
2022-2023
IoT Based Home Automation Using Telegram App

groups for up to 200,000 people or channels for broadcasting to unlimited audiences. You can
write to your phone contacts and find people by their usernames. As a result, Telegram is like
SMS and email combined and can take care of all your personal or business messaging needs.
In addition to this, we support end-to-end encrypted voice calls.

5.3 Flow Chart For Proposed Solution


A flowchart is a kind of accept that addresses a work procedure, strategy or count, showing the
movements of various sorts of boxes, and their demand by interfacing them with jolts.

Figure 5.2 Flow Chart

DEPARTMENT OF COMPUTER APPLICATION(MCA)


52
2022-2023
IoT Based Home Automation Using Telegram App

Chapter 6
Implementation
Implementation is a period of the wander when a theoretical all design arrangement is changed
into present working system. Thusly it will be believed to be the most fundamental stage with
the fulfilling a productive present new system and giving the customer, conviction that a new
structure will work to be convincing. An execution organize incorporates orchestrating,
examination with in present structure and its prerequisites on use,lying out of systems to
done with all the change and evaluation a changeovermethodologies.Once system has
been arranged, the accompanying stage is to change overthe created one into honest to
goodness code, with a specific end goal to satisfy the customeressentials as anyone might
expect.

6.1 STRUCTURE OF ARDUINO SOFTWARE

The Arduino board Joined Change Condition - Arduino Programming contains a contraption
for confinement with a development of structure. It accomplices microcontroller board like
Arduino equipment to trade projects of chat with the as appeared in figure 6.1

DEPARTMENT OF COMPUTER APPLICATION(MCA)


53
2022-2023
IoT Based Home Automation Using Telegram App

Figure 6.1 Elements of arduino IDE

DEPARTMENT OF COMPUTER APPLICATION(MCA)


54
2022-2023
IoT Based Home Automation Using Telegram App

Arduino IDE is a text editor for coding the arduino program. It acts as a interface between the
arduino and the hardware to upload the program into the arduino board and communicate with
the board.

6.1.1 File

It is a graphical control to the files handling in the computer programs. It having options like

save, open, close, new etc. as appear figure 6.2

• New, open, close, save are options to handle the file like to create a new file, to open
any existing file, close the file and to save the file.

• Sketchbook: It shows the all sketches in the sketchbook folder. And upon clicking it
opens the corresponding sketch.

• Examples: it provides the all examples provided by the arduino IDE and otherarduino
library.

• Save as, page setup, quit are used to save the current file with the different file name,
to adjust the page for printing and to leave the editor respectively.

• Preferences: here we can customize the arduino IDE and languages.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


55
2022-2023
IoT Based Home Automation Using Telegram App

Figure 6.2 File handling in arduino software

DEPARTMENT OF COMPUTER APPLICATION(MCA)


56
2022-2023
IoT Based Home Automation Using Telegram App

6.1.2 Edit

It handles the command related to the manipulation of the text file etc. as shown figure below
6.3

• Undo/Redo these are used to go back to the one or more steps back.

• Cut: this is used to remove the selected area of text and place it on clipboard.

• Copy: it generates another copy of the selected area of text and place it on the
clipboard.

• Paste: to put the text on the clipboard on the editor.

• Copy for forum: generates a suitable form to post it on the arduino forum.

• Copy as HTML: copies the sketch on the clipboard as HTML and embedding it on the
webpage.

• Comment/Uncomment: adds or removes from the selected text.

• Increase/Decrease indent: adds or removes the space at the selected text area by
moving the text one space.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


57
2022-2023
IoT Based Home Automation Using Telegram App

Figure 6.3 File editing in arduino software

DEPARTMENT OF COMPUTER APPLICATION(MCA)


58
2022-2023
IoT Based Home Automation Using Telegram App

6.1.3 Sketch

This provides the commands for control the program and its flow as shown figure 6.4
• Verify/Compile: to check the correctness of the program and to locate the errors in
the program.
• Upload: it loads the compiled binary code into the configured arduino board.
• Upload using programmer: it is used to overwrite the boot loader on the arduino
board.
• Export compiled binary: it saves the sketch with .hex extension so it can be treated as
archive or it can be send to board via other tools.
• Show sketch folder: opens the current folder where sketch is saved.
• Include library: it display the list of libraries which are loaded in the IDE. And we
can add the libraries from them.
• Add file: it adds the source code to the sketch folder.

Figure 6.4 File sketching in Universal Telegram Bot

6.1.4 Tools
I provide other options to deal with the arduino and to configure the arduino board as appear
figure below 6.5.
• Auto format: it formats the sketch neatly, it align the code according to the curly
braces and looping codes.
• Archive sketch: it archive the current sketch into .zip format and stores in the current
folder.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


59
2022-2023
IoT Based Home Automation Using Telegram App

• Fix encoding and reload: it fixes the discrepancies between editor char to the OS char.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


60
2022-2023
IoT Based Home Automation Using Telegram App

• Serial Monitor: it displays the data transaction in the arduino.


• Board: we should select the arduino board which we are currently using for our
project.
• Port: select the port for which arduino is connected via USB.
• Programmer: it is used to select the hardware programmer when programming board
or chip.
• Burn Boot loader: the options on this will allow programmer to Burn the boot loader
into
• microcontroller on arduino board.

Figure 6.5 Tools adding in NodeMCU software

6.2 Components Selection for Implementation


The implementation is a period of assignment where the practical design of changed into
view
working structure. At this stage the standard workload and the critical impact on the present
system developments in e-Campus. If the utilization is not meticulously masterminded and

DEPARTMENT OF COMPUTER APPLICATION(MCA)


61
2022-2023
IoT Based Home Automation Using Telegram App

controlled it can realize anarchy and confuse.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


62
2022-2023
IoT Based Home Automation Using Telegram App

6.2.1 NodeMCU ESP8266


NodeMCU ESP8266 operates at 5V & 3.3V. It has an onboard LDO voltage regulator tokeep
the voltage steady at 3.3V. We can power NodeMCU using a Micro USB jack as well asa VIN
pin (External Power Supply Pin). The NodeMCU requires 600mA power, as ESP8266 pulls
around 80mA during RF transmission.

Figure 6.6 NodeMCU Board with Cable


For boot and Wi-Fi operation, it draws up to 200mA peak current. Thus supply power from
Micro-USB Cable is not enough for NodeMCU Board when we are adding multiple sensors
or modules to the Board. Basically, a Computer USB port can provide around 500mA of
current. You can check more about NodeMCU Power requirements in these Datasheets.

6.3 Execution
In the implement stage we make utilization of certain predefined libraries and a specific
arrangement of classes which incorporates:
1. WiFi Client Secure
2. ESP8266WiFi

DEPARTMENT OF COMPUTER APPLICATION(MCA)


63
2022-2023
IoT Based Home Automation Using Telegram App

6.3.1 Pseudo code for Smart home automation system using Telegram App
Import the libraries which are to be included in this program
relayInput1=D0;
relayInput2=D1;
ssid[]=" "; //your network SSID(name)
password[]=" ";//your networ kpassword
// define telegram bot token and chat id
void setup()
{
Serial.begin(9600);

pinMode(relayInput1,OUTPUT);//initialize pin as OUTPUT


pinMode(relayInput2,OUTPUT);
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
pinMode(2,OUTPUT);
digitalWrite(2,LOW);
Serial.print("ConnectingWifi:");
Serial.println(ssid);
WiFi.begin(ssid,password);
while(WiFi.status()!=WL_CONNECTED)
{
Serial.print(".");
delay(500);
}
Serial.println("");
Serial.println("WiFiconnected");
Serial.print("IPaddress:");

DEPARTMENT OF COMPUTER APPLICATION(MCA)


64
2022-2023
IoT Based Home Automation Using Telegram App

Serial.println(WiFi.localIP());
//Onlyrequiredon2.5Beta
client.setInsecure();
bot.longPoll=60;
bot.sendMessage(CHAT_ID,"IamReadyForHomeAutomationusingTelegram","");
}
void dhandleNewMessages(intnumNewMessages)
{
for(inti=0;i<numNewMessages;i++)
{
if(bot.messages[i].type== F("callback_query"))
{
Stringtext=bot.messages[i].text;
Serial.print("Callbackbuttonpressedwithtext:");
Serial.println(text);
}
else
{
Stringchat_id=String(bot.messages[i].chat_id);
Stringtext=bot.messages[i].text;
if(text==F("Menu"))
{
//bot.sendMessage(chat_id,"/start","");
bot.sendMessage(chat_id,"1-LightOn\n2-LightOFF","");
}
elseif(text==F("Start"))
{
bot.sendMessage(chat_id,"Ok,LetsGetStart\n","");
}

DEPARTMENT OF COMPUTER APPLICATION(MCA)


65
2022-2023
IoT Based Home Automation Using Telegram App

elseif(text==F("1"))
{
digitalWrite(relayInput1,HIGH) ; //turn relay on
Serial.println("LightOn!");
bot.sendMessage(chat_id,"LightOn","");
}
elseif(text==F("2"))
{

digitalWrite(relayInput1,LOW); //turn relay on


Serial.println("LightOFF!")
bot.sendMessage(chat_id,"LightOFF","");

}
else
{
bot.sendMessage(chat_id,"Sorry,iamnotabletounderstand","");
}
}
}
}

voidloop()
{
if(millis()>lastTimeChecked+delayBetweenChecks)
{
intnumNewMessages=bot.getUpdates(bot.last_message_received+1);
if(numNewMessages)
{

Serial.println("gotresponse");
Serial.println("ReplyedtoTelegram");

DEPARTMENT OF COMPUTER APPLICATION(MCA)


66
2022-2023
IoT Based Home Automation Using Telegram App

handleNewMessages(numNewMessages);

DEPARTMENT OF COMPUTER APPLICATION(MCA)


67
2022-2023
IoT Based Home Automation Using Telegram App

}
lastTimeChecked=millis();
if(lightTimerActive&&millis()>lightTimerExpires)
{
lightTimerActive=false;
}
}
}

In this chapter we discuss about the Implementation of IoT based home automation system. It

includes all the hardware components and module’s full description.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


68
2022-2023
IoT Based Home Automation Using Telegram App

CHAPTER 7

SYSTEM TESTING
Testing is a procedure of assessing a framework code or its components with the plan to
discover whether it fulfils the predetermined necessities or not. Testing is executing a
frameworkwith a specific end goal to recognize any holes, blunders, or missing necessities in
opposition to the real prerequisites

They are no fewer than three choices for Organizing Wander Engineer into the test
arranges:
➢ Testers don't present Amplify Producer, use Stretch out Designer handiness to amass
source-control the modules to b attempted and hand them off to the analysers, whose
strategy remains unaltered.
➢ The analyser imports a comparative wander or assignments that the originators use.
➢ Create a wander in perspective of the change amplify yet altered for the analysers, who
import it.
There are a couple concludes that can fill in as testing targets:
➢ It is a method of running a program with an objective of finding all mix-ups.
➢ An incredible testing is a one that has a high probability of finder a new oversight.
➢ A compelling test is one that uncovers a new slip-up.
If testing is coordinated successfully as shown by the objectives communicated to the
goals communicated above, it will uncover botches in the item. Furthermore testing displays
that
item limits appear to have been met.

Types of Tests
There are distinctive sorts of test. Each test sort addresses a specific testing essential.
➢ Unit testing.
➢ Integration testing.
➢ System testing.
➢ Acceptance testing.

7.1 Unit testing


➢ Unit testing incorporates the arrangement of trials that favour that the inside program

DEPARTMENT OF COMPUTER APPLICATION(MCA)


69
2022-2023
IoT Based Home Automation Using Telegram App

method of reasoning is working suitably, and that program inputs convey significant
yields. All decision branches and inside code stream should be affirmed. It is the
attempting of individual programming units of the application .it is done after the zenith
of an individual unit before coordination.
➢ This is a fundamental testing that relies on upon learning of its improvement and is nosy.
Unit tests perform fundamental tests at fragment level and test a specific business
process, application, or possibly system setup. Unit tests ensure that each stand-out
method for a business strategy performs accurately to the detailed particulars and
contains clearly described information sources and expected results.

7.2 Integration Testing


➢ Joining tests are proposed to test facilitated programming portions to choose whether they
truly continue running as one program. Testing is event driven and is more stressed with
the crucial after-effect of screens or fields. Compromise tests show that notwithstanding
the way that the parts were autonomously satisfaction, as showed up by successfully unit
testing, the mix of fragments is correct and consistent. Blend testing is especially away to
uncover the issues that rise up out of the mix of sections.

7.3 System Testing


➢ Structure testing ensures that the entire composed programming system meets necessities.
It tests a setup to ensure known and obvious results. An instance of system testing is the
outline arranged structure compromise test. Structure testing relies on upon process
delineations and streams, underscoring pre-driven process associations and coordination
centres.
➢ The general structure is attempted to affirm whether the completed modules are
unsurprising with each other with the give input and the best possible modules are
summoned as and when called at particular events. The data set of archives required are
scrutinized, then encoded, then exchanged onto cloud server which is then open for
remote customer to see and download stacked records.

7.4 Acceptance Testing

Acceptance testing is a test coordinated to choose whether the essential of assurance or

DEPARTMENT OF COMPUTER APPLICATION(MCA)


70
2022-2023
IoT Based Home Automation Using Telegram App

contract or met. Affirmation test cards are ideally made in the midst of sprint organizing or

DEPARTMENT OF COMPUTER APPLICATION(MCA)


71
2022-2023
IoT Based Home Automation Using Telegram App

accentuation orchestrating meeting, before progression begins so that the creators have a
sensible idea what to make. Once in a while affirmation tests may navigate various stories and
they are assorted ways to deal with test them out in the midst of veritable sprints. The
affirmation test suit is continue running against the gave input data or using an affirmation
test script to facilitate the analysers. The affirmation testing target is to give sureness that the
passed on system meets the business requirements of both supporters and customers. The
affirmation face may in like manner go about as the last quality entry, where any quality
disfigurements not in advance recognized may be uncovered.

7.2.1 Unit test cases

Table 6.1 Test case for NodeMCU

DEPARTMENT OF COMPUTER APPLICATION(MCA)


72
2022-2023
IoT Based Home Automation Using Telegram App

Table 7.2 Test case for relay

This test case we have to converting the 5v power supply to 12v. So we are using relay it will
input taken from arduino board and given to output sensors, using 12v relay refers in table
6.3. In this chapter I discuss about the testing phase of my project work.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


73
2022-2023
IoT Based Home Automation Using Telegram App

CHAPTER 8

CONCLUSION

This project in general has been successfully implemented. The software produced for this
project is functionally correct, reasonably robust, and usable. The project has met the entire
general and a non-functional requirement stated in chapter 3 and in addition has been
implemented in a modular fashion, which can be easily modified or rewritten at a lower stage.

In this project, we analysed the IoT based home automation system associated day by day in
the IoT. We conclude the implementation of home automation with identifying the problem
of the existing system and resolving it in a cost effective manner.

The software is robust. The design of the software means that most errors complex in non- fatal
manner, meaning that the software can continue executing even there is a bad response.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


74
2022-2023
IoT Based Home Automation Using Telegram App

CHAPTER 9

FUTURE ENHANCEMENT

9.1 Future Enhancement

As the software is being developed, a number of minor shortcomings in the system were found.
There are a number of changes to the design that could be considerable in future addition to
the software.

▪ The performance of the software is something that could also be improved by optimising the
code if given more time. The performance gains to do this however would only be noticeable
on very slow connections to the internet.

▪ Future scope of this project will include making smart home automation system that could
detect the presence of someone in a room, through sensors and manage the appliances
accordingly. This will also help towards conservations of energy and increasing lifetime of
the appliances.

▪ In future we plan to improve of security problems. The various future applications may be
used by controlling various household devices with internet. It can also be managed through
android based application. In addition to door lock opener further we can implement biometric
door opener.

▪ Because of the hardware limitations of the arduino board there are only a fixed number of
devices that can be attached to the system. Further work will include trying to designhardware
that can easily be explained to accommodate large number of devices.The changes mentioned
here would not be too complex to implement. The modular design of the system would allow
for changes to be made without significant changes to the existing code.

DEPARTMENT OF COMPUTER APPLICATION(MCA)


75
2022-2023
IoT Based Home Automation Using Telegram App

REFERENCES

• Fletcher, M.: “Arduino board: From Identification to Intervention, 324 p. TheGuilford


Press” (2006)

• Introduction to IOT https://www.techtarget.com/iotagenda/definition/Internet-of-


Things-IoT

• Evolution of IOT https://www.techaheadcorp.com/knowledge-center/evolution-of-iot/

• Telegram bot guide for home applainces https://jjtxm.dom-weselny-secemin.pl

• " Internet of Things " by Rajkumar Buyya, Amir Vahid Dastjerdi

• Complete reference of arduino software with tools http://www.arduinosoftware.

• Smith, C., Strick, L.: “Arduino elements in IDE A to Z: A Complete Guide toLearning
arduino software to Adulthood, 528 p. Free Press” (2010)

DEPARTMENT OF COMPUTER APPLICATION(MCA)


76
2022-2023
IoT Based Home Automation Using Telegram App

APPENDIX A

ACRONYMS

IoT Internet of Things

VCC Positive(+ve) power supply

GND Ground(-ve) power supply

DEPARTMENT OF COMPUTER APPLICATION(MCA)


77
2022-2023
IoT Based Home Automation Using Telegram App

APPENDIX B

SNAPSHOTS

Light On

Light Off

DEPARTMENT OF COMPUTER APPLICATION(MCA)


78
2022-2023

You might also like