Nothing Special   »   [go: up one dir, main page]

Mini - Project - Report - Microcontroller Apllication

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

Namibia University of Science and Technology

Faculty of Engineering
Department of Electrical and Computer Engineering
MICROCONTROLLER APPLICATIONS (721S)
PROJECT REPORT: HOME AUTOMATION SYSTEM
USING TELEGRAM APP
Submitted by
Mabhena Shepherd Junior
214052362

In partial fulfillment of the requirements of B.Eng. Degree in Electronics and


Telecommunications Engineering
Abstract
Home automation systems are becoming more and more popular every day because of their
numerous applications. This can be achieved by local area network or by remote control. We
live in fast paced world where things are constantly changing at a very rapid pace and the
aspect of technology is no different. People are constantly juggling a lot from in their day to
activities thus putting a strain on their minds and the way certain tasks are handled. Thus,
technology can ease the level with which certain tasks are handled especially in the home
space. The answer to this is Home Automated Systems. One can ponder upon the question
and ask what is a home automated system and how can it improve one’s quality of life in
their living environment without shedding a sweat. The answer to this simple, from the day to
day tasks and activities an individual partakes in, a sense of comfort and relaxation in their
homes is a necessity and a home automated system can provide the deliverance of controlling
appliances, lights etc. without one having to physically move around the home. Home
Automation Installation is used to streamline and enhance your lifestyle by developing
custom home systems that contribute to your home's comfort, convenience and luxury.
Control your lighting, climate, music, and network from a smart device that's easy to use.
Carry your smart device on orders or vacations with you and still have the ability to control
your entire home. If you're not, your home automation system will be there for you.This
paper proposes a home automated system using Raspberry PI and a messaging application to
address the needs stated above.

2
Table of Contents
Introduction...........................................................................................................................................4
Background Information....................................................................................................................4
Raspberry Pi...........................................................................................................................................4
Telegram................................................................................................................................................4
Problem Statement...............................................................................................................................4
Objectives..............................................................................................................................................5
Design and Methodology......................................................................................................................5
Hardware Requirements...................................................................................................................5
Methodology.....................................................................................................................................5
Working Mechanism..........................................................................................................................5
Conclusion.............................................................................................................................................6

3
Introduction
Background Information
Technology has become an integral part of people's lives, it continues to influence most facet
s of everyday life and has facilitated better social communication, ease of travel, entertainme
nt and media indulgence. It can also be facilitated in the home environment for convenience,
comfortably and luxury through smart homes implemented through the Internet of Things
(Iot), which simplifies the way in which things were traditionally done.

Raspberry Pi
Raspberry-Pi is characterized by raspberrypi.org as a minimal effort, Mastercard size PC that
attachments into a PC screen or television, and uses a standard console and mouse. It is
introduced as a little gadget that empowers individuals to experience figuring and pick up
programming dialects, for example, Scratch and Python. Basically, it can perform whatever
one would anticipate a PC or workstation to perform. Dr Eben Upton characterizes it as a
little, shabby ARM based PC for training and for specialists.

Telegram
Telegram is an instant messaging and voice of service application with a focus on security
and speed available for Android, iOS, Windows Phone, Windows NT, macOS and Linux. It
is a cloud-based service, meaning you can access your messages from several devices at
once. Since Telegram is accessible on Linux based devices it can be interfaced with
Raspberry Pi, since it runs on a Linux based OS.

Problem Statement
Home Automated systems demand is growing by the day due to its numerous advantages.
People are constantly spending countless hours on the mobile devices, mostly on social
networks and instant messaging application. To avoid the hustle of switching between
different application on a particular device, one would wonder, wouldn’t it be nice to control
the house lights appliances and security systems using an instant messaging application like
Telegram. In addition to this people sometimes find themselves in situations where they live
their place of residence without switching off certain appliances and lights, thus waiting
electricity (a commodity which is proving to be scarce in certain parts of the world). The
home automated system can rectify this problem where u can turn on and off appliances even
if you are not physically present in a certain environment. This paper henceforth proposes a
home automated system to control the lights in different rooms using Telegram.

Objectives
1. To interface Raspberry Pi 3 with the Telegram messaging application.
2. To switch lights on/off in different rooms using Telegram.

Design and Methodology


The chapter highlights various hardware and software that will be used to achieve the
objectives of the project.

4
Hardware Requirements
Hardware/Components Quantity
Raspberry Pi 3 (with internet connection) 1
LEDs 4
Power Supply 1
Jumper Wires 4
Bread Board 1

Methodology
The plan of this undertaking incorporated the above stated equipment in the table.
Telegram Configuration
The preliminary steps towards the commencement of the design project was to configure the
Telegram instant messaging application with Bot Remote Control.
Step 1: Installing Telegram on the mobile device
The first step involved installing Telegram on the mobile phone, it is available on the
following platforms: Android, iOS, Windows Phone, but to name a few
Step2: Communicating with the Bot Father.
Before communicating with the Bot Father Remote Bot for Telegram was
downloaded from the Google Play Store. Upon finishing the installation of the
Remote Bot for Telegram, a bot name and bot username were created for establishing
connection between Telegram and the Remote Bot. This was completed successfully.
This bot created is for remotely connecting to the mobile phone remotely from any of
one’s devices with telegram installed running with the same mobile number.

Figure 1

Secondly, another bot was created specifically for communication between Raspberry
and Telegram. This was done by prompting the following command the Bot Father
chat interface
/newbot
Bot_name – Pi Bot

5
Bot_username-technolux_bot

Figure 2

Step3: Acquiring token for access


After successfully creating the bot. A token was granted to access the HTTP API.
Token: 780690436:AAFYZdQU2tzP3_XgCbf_w38awm-qmEIMVvs
This token is used for security purposes so that persons that are not yourself can not
have access to the bought you created.
Step4: Telepot for installing Telegram on Raspberry Pi
The python package called Telepot makes it possible to use Telegram Bot in
Raspberry Pi. This package was installed on Raspberry Pi using the following
commands
sudo apt-get install python-pip
sudo pip install telepot
Step5: Programming the Raspberry Pi
The following code was written on the Raspberry Pi, with the access token prompted
into the code to specify which bot Raspberry Pi is communicating with.

6
Figure 3

Figure 4

7
Figure 5

Step6: Running the Program in the Raspberry Pi.


The code was run under the Python Shell 2.7
1. The raspberry Pi 3 will be interfaced with telegram, which will require Telegram bots
to be imported into the Raspberry Pi. (Telegram Bots - these are third party
applications that run inside Telegram. Users can network with bots by sending them
messages, commands and in-line requests. One can control the bots using HTTPS
requests to the bot API. )
2. Next will proceed to configure how to control the GPIO pins using Telegram, so that
we provide hardware support for the bot.
3. The four Led’s will represent the four lights in four different rooms.
4. Each light will be toggled using natural language (just as you would when chatting)
using Telegram.
Working Mechanism
1. The Raspberry Pi read the data (message) sent from the Telegram bot and toggled the
lights accordingly.
2. It checked for specific wording instead of the whole sentence to make the input
procedure from the device easy, meaning it checked for the on and off words.
3. After it had detected either of these two words it looked for other key words which in
this case was Green (Room1), Red (Room2), Yellow (Room3) and White (Room 4).
4. The respective lights were toggled only if the word was detected.

8
Figure 6

The figure above shows the communication between the Raspberry Pi and Telegram via the
Pi Bot. Every time the user prompted an instruction a response would be received in
correspondence to the sent message.

9
Figure 7

10
Figure 8

Figures 7 and 8 depict the output responses from the instructions prompted in figure 6. Each
time an instruction was sent there was a corresponding response which gave an output in
accordance to what it was instructed to perform.

11
Modifications
Future modifications of the design will see voice to text capabilities being implemented into
the program, i.e. currently the user has to type the message, future designs will see the user
just having to control the GPIO pins using voice texts. In this regard one doesn’t have to type
but simply speak into the mobile phone microphone as though sending a voice note.

Applications
The above implemented design can have quite a vast number of real-world applications
which can revolutionize the way in which we live and perform certain tasks.
The LED’s can be replaced with relays and AC appliances then this design can be turned into
a Smart Phone controlled Home Automation System. This system could be used to control all
house lights, i.e. turning the house lights ‘on’ and ‘off’, as depicted in the figure below.

Figure 9

In addition to lights, a vast number of house hold appliances can be controlled in exactly the
same way as shown in figure. These appliances include the home entertainment unit,
microwaves, fridges, basically any house hold appliance can be controlled in this manner.

Conclusion
Overall completion of the proposed design was a success, with all the objectives having been
met. The application of the proposed design will primarily focus on a Smart Phone controlled
Home Automation system with modifications being implemented at this stage.

12
References
1. https://core.telegram.org/bots
2. https://www.instructables.com/id/Telegram-on-Raspberry-Pi/
3. https://www.slideshare.net/kasimmalik2/iot-based-home-automation-using-raspberry-
pi3

13

You might also like