A PROJECT REPORT 25 13 Final
A PROJECT REPORT 25 13 Final
ON
HOME AUTOMATION USING TELEGRAM BOT
SUBMITTED BY
SANIKA SACHIN THAKUR
&
SHUBHAM RAJESH NAGVEKAR
PROJECT GUIDE
Mrs. KARISHMA JAIN
CONDUCTED AT
CHIKITSAK SAMUHA’S
I am also thankful to all the teachers for their kind support and help.
Finally, I would also like to thank my friends who helped me a lot in finalizing
and successful completion this project within the limited time frame. Thanking you,
INDEX
SR. NO TITLE PAGE NO.
1. Introduction 4-8
Overview 5
Objective 6
Requirements of Contents 7
Gantt Chart 8
2. Related Work 9-11
Existing System 10
Problem Statement 11
3. Methodology 12-20
Block Diagram 13
Flow Chart 14
Working 15
Circuit Diagram 16
Hardware Components Used 17
Software Tools Used 19
4. System Implementation 21-29
Telegram Bot Setup 22
Raspian OS Installation in Raspberry Pi 4 23
Execution in Raspberry Pi OS 24
Raspberry Pi OS Remote Setup 27
Results 28
5. Troubleshooting 30-31
Troubleshooting 31
6. Conclusion & Reference 32-35
Conclusion 33
Reference 34
INTRODUCTION
OVERVIEW
Home Automation Is Building Automation System For A House, Which Is Called A Smart Home.
Home Automation System Monitors and Control All the Home Appliances. Making the normal day
to day work easy and convenient. Home automation can quickly bring the future in to our homes
by incorporating security, climate, and household gadgets and transforms our regular home into a
futuristic smart home. These smart home systems can be used for simple or elaborate tasks by
integrating devices and gadgets inside and outside of your home. A simple definition for home
automation is the ability to do tasks automatically and monitor or change status remotely. Common
tasks include turning off lights when no one is in the room, locking doors via smartphone, automates
air condition systems that can sense and memorize temperature settings and appliances that help
you reduce the time you spend in the kitchen. In the IoT home automation ecosystem, you can
control your devices like light, fan, TV, etc. A domestic automation system can monitor and/or
manage home attributes adore lighting, climate, enjoyment systems, and appliances. It is very
helpful to control your home devices. The Internet of Things, IoT, is in a huge way and people are
rapidly inventing new gadgets that enhances lives. The price of microcontrollers with the ability to
talk over a network keeps dropping and developers can now tinker and build things inexpensively.
OBJECTIVE
Home Automation allows you to control your energy consumption. Smart home automation
systems are sensitive to daylight and with this sensitivity, you can use your lighting system in
economic mode. Keeping the room temperature at a constant value in your home heating or
cooling systems, you can save energy while heating your home. With smart socket automation
systems, it operates your energy-consuming household appliances in energy-saving mode. With
the Smart Home automation system, you can connect and control your home with your mobile
phone or tablet and get your home in a safe mode with a single button. When you leave home,
you can protect your home against intruders by activating your cameras and motion sensors. In
addition, you can monitor your home on your smartphone with automation systems developed in
smartphone systems. You can instantly monitor the situations around your home. Using iot-based
smart home systems, you can secure the security of your family and home. How is this security
provided? Sensors are used to develop smart devices in the field of technology. With these
sensors, high-tech smart devices are designed. When motion is detected when you are not at home,
it will automatically light up to allow intruders to walk away and better security cameras. So you
can protect your home from intruders. With smart home automation systems, you can do your
daily work without wasting your time. When you can’t find time in your busy work schedule, it
may be difficult for you to do these things, even if it is simple household chores. That’s exactly
where smart home automation systems come in.
REQUIREMENTS OF CONTENTS
Sr. No. Components Specification Quantity required
1 Raspberry Pi4 B 2GB RAM 1
2 Relay Board 2-Channel Board 1
3 Charging Adapter 5-9Volts 1
4 Electric Sockets - 2
5 Connecting wires - As per requirement
GANTT CHART
A Gantt chart is a useful graphical tool which shows activities or tasks performed against time. It is
also known as visual presentation of a project where the activities are broken down and displayed on
a chart which makes it is easy to understand and interpret. A Gantt chart is a popular tool in project
management. It basically drills down activities which need to be done by a fixed time period. It is
commonly used for tracking project schedules.
RELATED WORK
EXISTING SYSTEM
1. sP.N.V.S.N. Murthy, S. Tejeswara Rao, and G. Mohana Rao have published research on
home automation using Telegram. This research includes a circuit design using Raspberry Pi
with IoT and Telegram Bot to control home applications, as well as a syringe pump equipped
with a NodeMCU8266 WiFi module to provide notifications via a smartphone. A
comparative study between Telegram and other messaging services was also conducted by
Murthy et al. Additionally, Murthy et al. designed an application that provides the ability to
create a chatbot without programming language requirements.
2. V. Subba Reddy, Sreevardhan Cheerla, Syed Inthiyaz, et al have published research on face
recognition and home automation using Telegram Bot. This research includes a PI board with
"Telegram Bot" to send the IOT programming to detect and express moistness an area. The
paper also includes manipulation of home appliances using voice indoors. Out of twenty-five
identity trials, the success rate or SR of face identity test was 84%.
3. Dhiraj Sunehra and G. Venkat Ramana have published research on a webpage and telegram
bot controlled home automation system using Raspberry Pi3. This system implements IoT to
automate the control of connected things in a house. The Raspberry Pi3 processor can be
controlled using the developed web page and Telegram Bot. In this IoT project, an AC lamp
can be controlled with a text message from Telegram application using Raspberry Pi.
4. Yasirli Amri and Mukhammad Andri Setiawan have published research on improving the
smart home concept with the Internet of Things (IoT) concept using Raspberry Pi and
NodeMCU. The paper proposes a smart home system that provides energy efficiency, energy
monitoring, security, and privacy management[1]. The communication between user and the
system is done using Telegram Bot. Yasirli Amri is an author of this paper who has also
published other papers on IoT. Mukhammad Andri Setiawan is a Chief Information Officer at
Universitas Islam Indonesia.
PROBLEM STATEMENT
Home automation refers to control the home appliances by using computer technology. Computer
Systems enables from remote control of lighting through to complex micro-controller or computer
based networks with various degrees of intelligence and automation. Home automation provides
security, energy efficiency and ease of use hence, it is adopted more. It also provides remote
interface to home appliances to provide control and monitoring on a web browser.
The field of Automation has well advanced in Industries, as majority of automobile industry
plants as well as bottling plants have Automated assembly lines. But automation has not yet
penetrated in the homes especially in India. If automation was to be used in homes than everyday
life would be get eased. Simple example of use of automation in home can be seen in the transfer
of water from the under-ground water tank to the over-head water tank, by sensing the level of
water in both the tanks. This process eases the every time effort the user has to put in for filling
the tank and also helps in saving water. Also people are getting more acquainted daily with the
use of Smartphone and tablets which are capable of doing much of PC’s work handy. So we have
decided to make a low cost Embedded System in which the smart phones can be used to help
automate entire home. In this system the user will have remote access and control over all the
subsystems present in the house.
METHODOLOGY
BLOCK DIAGRAM
Start
User sends
command to the
telegram bot
Telegram
bot checks
the
command
PROCESS:
A) Raspberry Pi 4
Raspberry Pi 4 Model B was released in June 2019[1] with a 1.5 GHz 64-bit quad core ARM
Cortex-A72 processor, on-board 802.11ac Wi-Fi, Bluetooth 5, full gigabit Ethernet (throughput
not limited), two USB 2.0 ports, two USB 3.0 ports, 1–8 GB of RAM, and dual-monitor support
via a pair of micro HDMI (HDMI Type D) ports for up to 4K resolution. The version with 1 GB
RAM has been abandoned and the prices of the 2 GB version have been reduced. The 8 GB
version has a revised circuit board. The Pi 4 is also powered via a USB-C port, enabling
additional power to be provided to downstream peripherals, when used with an appropriate PSU.
But the Pi can only be operated with 5 volts and not 9 or 12 volts like other mini computers of
this class.
The 2 Channels Relay Module is a convenient board which can be used to control high voltage,
high current load such as motor, solenoid valves, lamps and AC load. It is designed to interface
with microcontroller such as Arduino, PIC and etc. The relays terminal (COM, NO and NC) is
being brought out with screw terminal. It also comes with a LED to indicate the status of relay.
Features of Relay Board:
1. Digital output controllable
2. Compatible with any 5V microcontroller such as Arduino.
3. Rated through-current: 10A (NO) 5A (NC)
4. Control signal: TTL level
5. Max. switching voltage 250VAC/30VDC
6. Max. switching current 10A
7. Size: 50mm x 38mm x 17mm
SOFTWARE TOOLS USED
A) Telegram Application:
Telegram is a cross-platform messaging service with enhanced encryption and privacy. Most
messages feature client-to-server encryption, but Secret Chat messages have end-to-end
encryption. Telegram also supports group chats and self-destructing messages as well.
Specifications of Telegram App:
1. Developed by: Telegram FZ LLC, Telegram Messenger Inc
2. Supports: Android, iOS, Windows, Linux, macOS, Web Platform
3. End-to-End Encryption
B) Fritzing
Fig 6. Fritzing
Fritzing is an open-source initiative to develop amateur or hobby CAD software for the design of
electronics hardware, to support designers and artists ready to move from experimenting with a
prototype to building a more permanent circuit. It was developed at the University of Applied
Sciences Potsdam.
C) Raspberry Pi Imager
Fig 7. Raspberry pi
Raspberry Pi Imager is the quick and easy way to install Raspberry Pi OS and other operating
systems to a microSD card, ready to use with your Raspberry Pi. Download and install Raspberry
Pi Imager to a computer with an SD card reader. Put the SD card you'll use with your Raspberry Pi
into the reader and run Raspberry Pi Imager.
D) Thonny Python
Thonny is an integrated development environment for Python that is designed for beginners.
It supports different ways of stepping through the code, step-by-step expression evaluation,
detailed visualization of the call stack and a mode for explaining the concepts of references and
heap.
SYSTEM IMPLEMENTATION
TELEGRAM BOT SETUP
First, go to telegram.org and download telegram aplication. Create an account then sign in it whatever
you’re on a mobile phone or others. Here, I’m using an Android phone. Open Telegram and you’ll see
a search just go there type “BotFather”. Click “start” then type “/newbot” to create a new bot.
Then give the Telegram bot a unique username. Note that the bot name must end with the word "bot"
(case-insensitive). Copy and save the Telegram bot's access token for later steps.
RASPIAN OS INSTALLATION IN RASPBERRY PI 4
To install Raspberry Pi OS on a Raspberry Pi 4 using Raspberry Pi Imager, follow these steps:
1. Download and install the Raspberry Pi Imager for your operating system.
6. Once complete, insert the microSD card into your Raspberry Pi 4 and power it on.
EXECUTION IN RASPBERRY PI OS
To install the telepot package on a Raspberry Pi, open a terminal and enter the following
commands:
a. sudo apt-get update
b. sudo apt-get install python-pip
c. sudo pip install telepot
B) Coding
Now we create a python file in raspberry pi and create a code to control home appliances and set
GPIOS in code, after this paste the Auth code in the program and then connect the relay
according to the GPIOS entered in the code.
Program:
Device01 = 26
Device02 = 19
Device03 = 13
Device04 = 6
now = datetime.datetime.now()
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
def action(msg):
chat_id = msg['chat']['id']command =
msg['text']
print ('Received: %s' % command)
while 1:
time.sleep(10)
RASPBERRY PI OS REMOTE SETUP
C) TEST CASES:
Output
Start Command Valid
3. Command Verified Raspberry pi Pass
to telegram bot Command
will Turn On
Send Command
to telegram bot Valid Output based on
4. Command Verified Pass
to turn ON/OFF Command given command
your device
Output
Stop Command Valid
5. to telegram bot command
Command Verified Raspberry pi Pass
will Turn off
TROUBLESHOOTING
TROUBLESHOOTING
A) Problems/Faults in Project
We came across various problems while making the project in which the two major problems
were: 1) Pairing the Raspberry pi with Telegram App as the Auth code was getting some kind of
error, 2) Python syntax Error and naming error for components
1) In the first case we witnessed the error in Authentication code as we were not able to get the
correct auth code after creating the Telegram Bot on Telegram App.
2) In the second case we got a syntax error as we tried to increase the connection from 1 gpios pin
to 2 gpios pins.