Sei sulla pagina 1di 47

ARDUINO BASED VOICE ACTIVATED AUTOMATION SYSTEM

BY

HIBA HAROON CLASS NO. 41

SESSION: 2016-2019

Project report submitted to the ICS/IT, The University of Agriculture Peshawar In Partial
fulfillment of the requirements for the degree of BS(CS)

BACHELOR OF SCIENCE IN COMPUTER SCIENCES

SUPERVISED BY

MR. IQTIDAR ALI

INSTITUTE OF COMPUTER SCIENCES AND INFORMATION


TECHNOLOGY FACULTY OF MANAGEMENT AND COMPUTER SCIENCES
THE UNIVERSITY OF AGRICULTURE, PESHAWAR
KHYBER PAKHTUNKHWA-PAKISTAN
FEBRUARY, 2020
ARDUINO BASED VOICE ACTIVATED AUTOMATION SYSTEM

BY

HIBA HAROON CLASS NO. 41

SESSION: 2016-2019
Project report submitted to the ICS/IT, The University of Agriculture Peshawar In Partial
fulfillment of the requirements for the degree of BS(CS)

BACHELOR OF SCIENCE IN COMPUTER SCIENCES


Approved By:

______________________ (Supervisor)

Mr. Iqtidar Ali


Lecturer IBMS

______________________ (Member)
Mr. Gulzar Ahmad
Lecturer IBMS

______________________ (Member)
Mr. Noman Ali
Lecturer IBMS

______________________ (HOD CS/IT)


Dr. Asfandyar Khan

______________________ (Additional Director,ICS/IT)


Dr. Muhammad Fayyaz

INSTITUTE OF COMPUTER SCIENCES AND INFORMATION


TECHNOLOGY FACULTY OF MANAGEMENT AND COMPUTER SCIENCES
THE UNIVERSITY OF AGRICULTURE, PESHAWAR
KHYBER PAKHTUNKHWA-PAKISTAN
FEBRUARY, 2020
TABLE OF CONTENTS

ABSTRACT……….………………………………………………………………………..1
CHAPTER 1……………….……………………………………………………………….2
INTRODUCTION ....................................................................................................... 2
1.1.Origin:………………………………………………………….. .................................... 3
1.1.1.History of Automation ...................................................................................... 3
1.1.2.Home Automation Applications ........................................................................ 3
1.2 Mobile Application: ............................................................................................... 4
1.3 Internetof Things ............................................................................................................ 4
1.3.1 Key features of the IOT ............................................................................................ 5
1.3.2 Advantages and disadvantages of IOT ................................................................... 6
1.4 Project Scope ................................................................................................................... 8
1.5 Objectives : ..................................................................................................................... 9
CHAPTER 2 ............................................................................................................ 10
PROTOTYPE REQUIREMENTS ................................................................................... 10
2.1 Hardware Requirements ............................................................................................... 10
2.2 Software Requirements ................................................................................................ 10
CHAPTER 3 ........................................................................................................... 15
METHODOLOGY ............................................................................................................ 15
3.1 Components ...................................................................................................................15
3.1.1 Arduino board .............................................................................................. 16
3.1.2 Bluetooth Module .................................................................................................. .20
3.1.3 Liquid Crystal Module ............................................................................................ 21
3.1.4 LEDs ....................................................................................................................... 21
3.1.5 Servo Motor ........................................................................................................... .22
3.1.6 Google Voice recognition ..................................................................................... ..23
3.1.7 Wires ....................................................................................................................... 24
3.1.8 Resistor ................................................................................................................... 25
3.1.9 Bread Board ............................................................................................................ 25
3.2 Mobile Application ...................................................................................................... .25
3.2.1Choice of Software ................................................................................................. .25
3.2.2 Functionality Of The Application .......................................................................... 26
CHAPTER 4 ........................................................................................................... 26
ELECTRONIC DESIGN ................................................................................................. .27
4.1 Block Diagram ..................................................................................................... 27
4.2 Circuit Diagram .................................................................................................. 27
4.3 Original Circuit ............................................................................................................ .30
CHAPTER 5 ............................................................................................................ 31
PROGRAMMING ............................................................................................................. 31
5.1 Arduino Programming ........................................................................................ 31
5.1.1 Variable declaration .................................................................................. 31
5.1.1 Setup ( ....................................................................................................... 31
5.1.2 Loop(.......................................................................................................... 31
5.1.3Arduino Code ......................................................................................................... 31
5.2 Mobile Application Programming ............................................................................... .32
5.2.1 MIT App Inventor Code ...................................................................................... 32
CHAPTER 6 ............................................................................................................ 33
CONCLUSION ......................................................................................................................
33 6.1 Two basic Scenarios ...................................................................................... 33
6.1.1 Electricity Cost Efficiency ......................................................................... 33
6.1.2 How will it help aged and disabled people .............................................. 33
BIBLIOGRAPHY ............................................................................................................. 34
ABSTRACT

This project is designed to improve the quality of life of disabled people by automating all
the household appliances /utilities and turning a normal home into a Smart Home. The
Project deals with a voice recognition system using the Arduino Mega2560. The Arduino
board is connected to a computer via USB cable, where it connects with the integrated
development environment (IDE). The Arduino code is written in the IDE and then uploaded
to the microcontroller (Arduino board) where the code can be executed. The Arduino code is
written in C++ including the use of special methods , functions and inbuilt libraries. In this
project the Arduino board is interacting with some modules and actuators like LCD, LED
lights and a servo motor through the inbuilt Google voice recognition which has been added
to the android app. This app makes the use of Google voice recognition and converts your
voice command into text, the text command will be sent over to the microcontroller. The
microcontroller is connected to a serial Bluetooth module which is the receiver of all the
commands. This Bluetooth module creates a connection between Arduino Mega and an
Android app that has been created in MIT App Inventor.
CHAPTER 1
INTRODUCTION

In broad strokes, the main objectives of this project is the use of automation of
electronic boards and mobile applications to ease the life of disabled people and for those
who are in need of this.

In traditional electricity systems we manually change the status of the switch from ON to
OFF and vice versa. By using this project we can control any of our home appliance from
our voice command and control it via bluetooth from our smartphone . For this project we
have used Arduino platform for the hardware and software . The uses of this project can be
unlimited as it automates the ordinary power outlet and it will also be compatible with a lot
of future electrical products. The hardware used in this project is cheap and easily
configurable and do the job very efficiently. The Arduino platform is also very efficient in
doing its functionalities and the most important thing is that it is free for personal use. It can
be used for adding more than one device and this feature is very useful if a user is using more
than one unit of the product. The possibilities of the product are endless.As a result, the
connection of two modern technologies, including hardware and softwares has made it
possible to fulfil the needs .Due to the day by day increased advancement in the latest
technologies ,people are also becoming attracted to automating there homes due to its various
advantages .The industrialized nations, almost every home has been wired for electrical
power, telephones, tv outlets and even doorbells . Almost each household task is automated
by the development of specialized appliances.

1.1 Origin:

1.1.1 History of Automation

• Automation:
Home automation refers to the use of computer and information technology to
control home appliances.
Automation is the task of using the technology to control and monitor it and to
make the processes running on their own or according to the instruction of a
human.
An automated system consists of two parts:

1
Operation: The operational parts are the combinations of different elements that
act directly on the machine and work according to the desired operations of a
human. These elements are called actuators and some examples are sensors,
LEDs, LCD or resistors.

Control: This part of an automated system can be called as the “Brain of system”,
because it is normally constituted by a programmable automaton, which enables it
to communicate with all other constituents of the operation part. The control part in
the automation system, allows to decide on the development of a process,
manipulating certain variables to get them acting in the desired way.

1.1.2 Home Automation Applications:

Houses have evolved throughout history, from caves with fire to warm and
illuminate even torches and candles and finally the arrival of electricity, which has
allowed to increase home comfort. Later, electronics arrived allowing the use of
the appliances, being able to perform programming routines and regulation
processes such as hot and cold washing or video recording.
It was from the 1970’s that integrated systems were used commercially and
developed into the domestic aspect of urban houses, this is when home automation
manages to integrate the two necessary systems, electrical and electronic, in
pursuit of the integral communication of house devices.
It was in the United States where the first devices of building automation
appeared, based on the X-10 protocol. This is a communication protocol for the
remote control of electrical devices, using the pre-existing electrical line to
transmit control signals within home automation equipment by radio frequency
pulses which represent digital information. History of automation applications
comprises different stages, beginning with the first protocols oriented to remote
control and following with the great protocols of self-regulation, considered the
real home automation revolution.

In this way, it was obtained that a house was able to perceive different stimuli
(temperature, light level, presence…) and react to them while interacting with
humans through different options, like mobile or PC.
At this point, is called home automation to a system capable of automate a house
or building including energy management, security, comfort and communication.
It can be integrated through wired or wireless communication networks, although
nowadays the predominant trend is wireless. It could be defined as the integration

2
of technology into the intelligent design of an enclosure. The main points of this
technology are energy saving, comfort, security, communication and data
accessibility.

Figure.1.1 Home automation schematic.

Nowadays thanks to the permanent technological evolution the offer is better and
have grater quality, its use is now more intuitive and perfectly manageable by any
user. Today’s home automation contributes to increase the quality of life, makes
the distribution of the house more versatile, changes environmental conditions by
creating different predefined scenes and makes the home more functional by
allowing the development of domestic, professional and leisure under one single
roof.
1.2 Mobile Application:

The prototype on which this project is based can be controlled from a customized
mobile application.
Definition:
A mobile application is a computer application designed which can be executed
on smartphones, tablets and other mobile devices. It allows the user to perform
many tasks of which can be professional, educational or social. Apps are usually
available through distribution platforms operated by companies that own mobile
operating systems such as Android, iOs, Blackberry or Windows Phone.

1.3 Internet of Things:

The simplest definition of the Internet of Things (IoT) can be, the connectivity of daily
use devices with the internet and to automate the human to device or device to
device interaction by using computer based components and programming languages.
The IoT includes electronic devices, software and programs, actuators, sensors, and
network connectivity which enables these objects and devices to connect and exchange

3
the data.
Another way to describe the Internet of Things is, the network of physical or real world
objects such as devices, vehicles, home appliances and other items with embedded software,
actuators, sensors and networking devices for internet connectivity, all these components
help these real world objects to automate almost every function they can perform without any
direct human interaction.

The IOT is used in every field of life from turning on a light bulb to a huge industrial areas
such as agricultural industries, car making factories and so on. The most common example
can be the self-opening doors, the door has sensors and whenever these sensors detects a
person, it will pass the information to the processor or microcontroller, which then process
the information and tells the electrical devices responsible for opening of the door to open the
door for the coming person. This process is occurs very quickly so the person don’t even
notice any delay.

In today’s world almost every person has a smartphone and due to these smartphones
and due to easily available and fast internet connectivity, the IoT can be used to control and
monitor your devices such as AC, heater, fan, light bulbs, garage doors from the smartphone
in your hand but a problem or a question that rises in everyone’s head is that how can we
control our devices such as bulb and fan because they do not have any connectivity to the
internet and they don’t have any user interface available for their users. So the answer to this
question and problem is that a third party controller can be used for controlling the electricity
flow to the device.

We control the devices by changing the switch from ON to OFF or from OFF to ON
and in most scenarios by plugging and unplugging the power plug of the device, both are
technically same things, in both cases we are starting or cutting the electricity flow to the
device. Now what if we can control this flow from our smartphone or a computer present in a
remote area. For doing this we need a smart plug that is smart enough to connect to the
internet, send and receive commands from the user and also able to control the electricity
flow to the device. Here IoT can be used here because in IoT we have modules for
connecting to the internet, modules for processing data and modules for controlling the
current flow or electricity flow.

4
1.3.1 The key features of the IoT

There are a lot of features of the IoT but the key ones are Artificial Intelligence,
sensors, connectivity, and use of small devices. The detailed description of these features are
given below.

• Artificial Intelligence

The IoT has the power to convert virtually anything into smart, which means
enhancing every field of life by the power of collecting the desired data, artificially
intelligent algorithms and the vast networks (internet). This can mean enhancing your street
light with light sensors that when senses the light, will turn of the street light and when the
light goes or in other words it’s night it will take the decision by its own and will turn the
light ON.

• Sensors

Another key feature of the IoT is the sensors. It is considered as the key feature of the
IoT because the field of IoT has sensors for almost anything. The examples of the sensors can
be the humidity sensor, light sensor, motion sensors, and pressure sensors and so on. These
sensors enables devices to sense almost anything and perform actions according to the data
provided to it by the sensors.

• Connectivity

New emerging technologies in the field of networking and specially IoT networking is
the clear indication that the network or internet connectivity is no more only for big
industries, everyone in today’s world have access to the internet. When the connectivity issue
is no more IoT enables it devices to create a large network of its small devices.

• Small Devices

Over time the devices has become smaller, lighter, cheaper and even more powerful
over time and new inventions are happening very quickly. These small devices helps IoT to
build devices precise, scalable, and versatile and these are considered the kay components for
the success of the productsr

5
1.3.1 Advantages and Disadvantages of IoT

Just like every field of life IoT also have a positive side and a negative side. Below
are some majors from both the sides.

1.3.1.1 The Advantages of the IoT

Like all other fields of computing and science, IoT also has a huge effect on the daily
lifestyle and business of the modern technologies working in the modern world. The
following are some of the advantages that we have from the field of IoT.

• Enhanced Data Collection

One of the biggest problems and barrier in the way of developments was the data
collection and with IoT this problem is solved up to a great level with a large number of the
sensors available. These sensors enable even consumers to collect a significant amount of
data. For example if a person want to track his/her weight on daily or weekly basis. He/she
can do it by connecting sensors in the weight machine to the internet through the IoT and
then synchronise this data with his/her smartphone and can even have graphical or tabular or
any kind of visual form of the data.

• Time

The IoT has saved a lot of human beings time by automating many tasks that required
human presence in the past and sometimes multiple people were required to do a single task
that now can be automated with the help of IoT. Its example can be the appliances present in
the home always required someone to operate or to switch off but now with IoT it can be
done from a remote area through internet and a smartphone or a computer.

• Money

The financial aspect is the best advantage. This technology could replace humans who
are in charge of monitoring and maintaining supplies.

• Tracking

The computers keep a track both on the quality and the viability of things at home.
Knowing the expiration date of products before one consumes them improves safety and
quality of life. Also, you will never run out of anything when you need it at the last moment.

6
1.3.1.2 The Disadvantages of the IoT

Like everything in the world IoT also has some disadvantages. Following are some of
them discussed in detail.

• Compatibility

As of now, there are no standards for taking values from the sensors. These situation
leads to the issue of incompatibility because of no standards availability. To solve this issue
of compatibility, there need to be some standards like USB and Bluetooth have.

• Safety

The software used in programming IoT can be easily hacked by the hackers and the
personal information of the user can be misused. A worst scenario can be if your garage door
is hacked which you control with IoT, so it can give easy access to the hacker to your car.

• Privacy and Security

The biggest issue the IoT is the security of the data and privacy of the information
about the user. All data in IoT should be encrypted so that the financial
information of the users will not be understandable for everyone.
1.4 Project scope

The main and major issues of the world is energy and this project will replace any
manual power outlet into a smart one. By using this project you can switch on or off any of
your devices from any anywhere in your home, when there is no need for the device to be
turned on and sometimes people need to power on device if they are not able to do it
manually . For example, if in case of any sickness, someone want to switch on/off the room
lights or any other device , so by using a this they can do it with just few taps on the screen.

The owners can perform the following action.

• Owner can control the electric device .


• Owner can control multiple devices from their smartphone.
• One device can be controlled by more than one person.

7
The new system has the following major advantages which made it able to accept by
management.

• Less cost
• Less time consuming
• More efficient
• Easy to use
• More reliable
• Real-time status
• Power saving
• Less space
• Minimized need of manpower

1.5 Objectives :
Being Computer Science students, our aim is to make people life easy through latest
technology, and to apply the skills we have learned so for and also used the
professional practices. Now a days new technologies are coming day by day and life
style is changing with time to time, and why not if change is improvement then it is
appreciated almost every professional field adopt new technology with time. If it so
then why not every person use the new technology and take benefit of it and get rid of
traditional approach that they are using for many years. Therefore we come across to
provide everyone the software and hardware to done their daily work operation easy,
fast and remote.In modern world, everything is becoming smart and almost every day
to day device is now able to make decisions, such devices include automobiles,
refrigerators, doors, and many more. If everything is becoming smart and automated
so why not power outlets and plugs.After asking a large number of people we came to
the conclusion that in today’s world almost everyone needs at least an automated home
system because in the world, we are living in, almost everything is automated and by
overcharging the battery dies very soon and the main cause of the overcharging is the
inaccessibility to the plug to cut the flow of electricity to the device and it also waste a
lot of users money. So by using a smart plug for such devices can reduce the risk of
death of the battery before time and also reduces the risk of the death of the device
because overcharging can also burn the circuits in the device and sometimes can cause
severe injuries and even death.

8
The main objective of this project is to design and develop a prototype of Arduino
based voice activated automation system along with the Android application. This
Android application is able to perceive and act according to various types of
operation to fulfill the purpose for which this project was developed. It maximizes
the user’s comfort offering an easy way to personalize home.The steps that should
be taken to achieve the expected result are the following:
• Select the components and software.
• Electronic design.
• Program the board.
• Program the mobile application.
• Build the house model.
• Place and weld the components in the model.
• Test and debug the application

9
CHAPTER 2

PROTOTYPE REQUIREMENTS

As mentioned in the previous section, in order to achieve the objective set, first of
all it is necessary to establish the needs of the project.

2.1 Hardware Requirements:

The hardware requirements consist of an Arduino board a local micro controller


which is the most important part. It is the core component that will communicate
with the mobile application and where the sensors and actuators will be connected.

The hardware requirements of this project are as followed:

• Arduino Mega2560
• Bread Board
• Light Emitting Diode(led)
• 16x2 Liquid Crystal Display
• Jumper Wires
• Resistors
• Servo Motor
• Bluetooth Module HC-06

2.2 Software Requirements:

The software requirements consists of :

• Arduino Language

As this is an Arduino based project so the language used is the C++ programming language
and the Arduino language is merely a set of C/C++ functions that can be called from your
code. We upload the code to the Arduino board and Arduino board runs this code, which is
called sketch and this runs as the board gets powered.

The question that arises in everyone’s mind is, can I program the Arduino board in C? In fact,
you already are; the Arduino language is merely a set of C/C++ functions that can be called
from your code. Your sketch undergoes minor changes (e.g. automatic generation of function

10
prototypes) and then is passed directly to a C/C++ compiler (avr-g++). All standard C and
C++ constructs supported by avr-g++ should work in Arduino. For more details, see the page
on the Arduino build process.

• Arduino IDE:
Arduino IDE (Integrated Development Environment) which is among the advantages of using
an Arduino board as a local microcontroller. The IDE we use for our project is the Arduino
IDE. The Arduino IDE is an integrated development environment (IDE) from Arduino. It is
used to develop sketches/programs for Arduino based boards such as Arduino Nano (Used
for small projects, with small number of programmable pins), Arduino Mega (Used for large
projects and comes with a large number of pins). It is possible to compile programs for the
Arduino using other build tools (e.g. Makefiles and/or AVR Studio). You'll need to configure
these to link against the appropriate files in the Arduino core libraries. See the description of
the Arduino build process.

As mentioned above we are not using Wemos D1R2 mini and it is manufactured by Wemos
not the Arduino but we can program Wemos and many other AVR (Alf and Vegard's RISC
processor) boards with it although it may require some modifications to the Arduino core
libraries.

There are other options also because it’s just an AVR development board, you can use
straight AVR C or C++ (with avr-gcc and avrdude or AVR Studio) to program it. It has its
own development environment which provides facilities for software development. The
Arduino board is connected to a computer via USB cable, where it connects with the
integrated development environment (IDE). The Arduino code is written in the IDE and then
uploaded to the microcontroller where the code can be executed. The Arduino code is written
in C++ including the use of special methods and functions

• MIT App Inventor:

MIT App Inventor is a web application which is an integrated development environment


originally provided by Google.It is in control of the Massachusetts Institute of Technology
(MIT). It allows newcomers to computer programming to create application software for two
operating systems such as Android and iOS. MIT App Inventor is a free and open-source
software which uses a graphical user interface which allows users to drag and drop visual
objects to create an application that can run on mobile devices

11
• Microsoft Word 2013

We use Microsoft word 2013 in our project for the organization of our written work.
Microsoft Word 2013 is a word-processing program, designed to help you create
professional-quality documents. With the finest document-formatting tools, Word helps you
organize and write your documents more efficiently. Word also includes powerful editing
and revising tools so that you can collaborate with others easily.

• Window 10:

The operating we is used for developing our project is window 10 . Windows 10 is a series of
personal computer operating systems produced by Microsoft as part of its Windows NT
family of operating systems. It is the successor to Windows 8.1, and was released to
manufacturing on July 15, 2015, and broadly released for retail sale on July 29, 2015.

12
CHAPTER 3

METHODOLOGY

This project is composed of few different components, the main component is the Arduino
platform and the other main component is the hardware and the communication between the
hardware of this project and the software. Arduino is an open-source electronics platform
based on easy-to-use hardware and software. Arduino boards are able to read inputs - light on
a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a
motor, turning on an LED, publishing something online. You can tell your board what to do
by sending a set of instructions to the microcontroller on the board. To do so you use
the Arduino programming language (based on Wiring), and the Arduino Software (IDE),
based on Processing.Over the years Arduino has been the brain of thousands of projects, from
everyday objects to complex scientific instruments. A worldwide community of makers -
students, hobbyists, artists, programmers, and professionals - has gathered around this open-
source platform, their contributions have added up to an incredible amount of accessible
knowledge that can be of great help to novices and experts alike.

Figure 3.1: The Project Methodology Diagram

13
3.1 Components:

3.1.1Arduino board

Arduino is an open-source electronics platform. It is based on an easy to use


hardware and software. The Arduino boards have the ability to interact with
different types of sensors ,buttons , LEDs and motors which can be controlled by
sending set of instructions to the microcontroller.

In a nutshell, an Arduino is an open hardware development board that can be used


by tinkerers, hobbyists, and makers to design and build devices that interact with
the real world. While Arduino refers to a specific type of board design, it can also
be used to refer to a company which manufactures a specific implementation of
these boards, and is typically also used to describe the community around
compatible boards made by other people or companies which function in a similar
way

Arduino microcontrollers are pre-programmed with a boot loader that simplifies


uploading of programs to the on-chip flash memory. The default bootloader of the
Arduino UNO is the optiboot bootloader.[27] Boards are loaded with program code
via a serial connection to another computer. Some serial Arduino boards contain a
level shifter circuit to convert between RS-232 logic levels and transistor–
transistor logic (TTL) level signals. Current Arduino boards are programmed
via Universal Serial Bus (USB), implemented using USB-to-serial adapter chips
such as the FTDI FT232. Some boards, such as later-model Uno boards, substitute
the FTDI chip with a separate AVR chip containing USB-to-serial firmware,
which is reprogrammable via its own ICSP header. Other variants, such as the
Arduino Mini and the unofficial Boarduino, use a detachable USB-to-serial
adapter board or cable, Bluetooth or other methods. When used with traditional
microcontroller tools, instead of the Arduino IDE, standard AVR in-system
programming (ISP) programming is used.“The Arduino Project” was the creation
of the Ivrea Interaction Design Institut (Italy) which started in 2005. The core
team to design the Arduino consisted of Massimo Banzi, David Cuartielles, Tom
Igoe, Gianluca Martino, and David Mellis.The main aim of the this project was to
provide the students a low-cost open-source and an easy tool for fast prototyping.

14
Before the creation of Arduino the students used BASIC stamp microcontrollers
(BASIC based interpreter on a microcontroller mounted on a stamp sized module).

Arduino is a development board that integrates a microcontroller and its support


circuitry with digital and analog inputs and outputs. It has an open source
computing development platform based on an environment for programs creation.

The most important part is the local controller, an Arduino Mega 2560 board,
which will be the core of the applicationit is the main component which will be
communicating with the sensors and actuators.

3.1.1.1 Choice of board

Shown below there is a comparison chart with the commonly used boards for this
type of application including their most important characteristics.

ARDUINO
BOARD

7-12 130 84 512 96


DUE AT91SAM3X8E 3,3 V 54 12 12
V mA MHz KB KB

LEONARDO 7-12 40 16 2,5


ATmega32u4 5V 32 KB 1 KB 20 7 12
V mA MHz KB

7-12 20 16 256
MEGA ATmega2560 5V 8 KB 4 KB 54 12 16
V mA MHz KB

5-12 40
PRO ATmega328 5V 8 MHz 32 KB 2 KB 1 KB 14 6 6
V mA

7-12 20 16
UNO ATmega328P 5V 32 KB 2 KB 1 KB 14 6 6
V mA MHz

Table 3.1 Arduino boards comparison chart.

15
3.1.1.2. Parts of Arduino Mega board

Figure 3.2. Arduino Mega board.

• µC:

This board is based on the ATmega2560 microcontroller.

General
Flash 16-bit resolution Serial ADC
Device EEPROM RAM purpose I/O
memory PWM channels UART channels
pins
ATmega2560 256 KB 4 KB 8 KB 70 12 4 16
Table 3.2. ATmega256 configuration summary.

`
Figure.3.3 ATmega2560 pinout.

16
This microcontroller uses AVR technology, created by Atmel manufacturer, which
belongs to RISC (Reduced Instruction Set Computer) microcontrollers family. In
computational architecture, RISC is a type of CPU design with fixed size
instructions presented in a reduced number of formats, in which only the loading
and storage instructions access the data memory and with many general purpose
registers.
The goal of this architecture is to enable segmentation and parallelism in the
instruction execution and reduce access to memory.

Figure.3.4 Block diagram of AVR architecture.

• .Communication pins:

Arduino Mega with ATmega2560 has facilities for communicating with the
computer, another board or other microcontrollers, it provides 4 hardware UART
for TTL serial communication:
Pin 0 (RX0) and 1 (TX0), pin 19 (RX1) and 18 (TX1), pin 17 (RX2) and 16
(TX2), pin 15 (RX3) and 14 (TX3). These are used to receive (RX) and transmit
(TX) TTL serial data. Pins 0 and 1 are also connected to the corresponding pins of
the FTDI USB-to-TTL Serial chip.

• ICSP:
In Chip Serial Programmer, is an input that has access to the program memory
(flash) of AVR. It can upload directly from PC to a microcontroller any program

17
without using the USB port. It is useful to work with an external AVR
microcontroller completely blank without bootloader.

• .Digital I/O:
This board contains 54 digital I/O pins, 12 of which are PWM (Pulse Width
Modulation) outputs.

• .Reset button:

The physical press of this button allows to reset, one of the hardware flow control
lines is connected to the reset line of the ATmega2560 via 100 nano farad
capacitor. When this line is asserted, the reset line drops long enough to reset the
chip.

• .Analog inputs:
This board contains 16analog inputs, each of which provide 16-bit resolution. By
default is measuring from ground (0 V reference) to 5 V, though is it possible to
change the range using the AREF pin or analogReference() function by code.

• Power pins:

External power source is used, voltage can be supplied using this pin. For example

1. GND ground pin .


2. 5 V the regulated power supply used to power the microcontroller and
other components on the board. This can come either from Vin via an on-
board regulator or be supplied by USB or another regulated 5V supply.
3. V a 3 V supply generated by on-board chip, with a maximum current of
50 mA.
4. IOREF the value connected to his pin will work as a voltage reference.

• Regulator 3,3 V:
This electronic component delivers 3,3 V and if it receives more voltage is
absorbed and dissipated to avoid component damaging.

• External power supply:


It can be powered by USB or with an external supply of 6 to 20 V.

18
• Regulator 5 V:
It has de same function as 3,3 V one but operating with 5 V, in case of being
supplied by this voltage.

• Crystal oscillator:
Arduino Megas clock oscillator has a 16 MHz clock speed.

• Fuse USB:
The Arduino Mega has a resettable polyfuse to protect computer's USB port. If
more than 500 mA is applied, the fuse will automatically break the connection
until the short or overload is removed.

• USB port:
USB port can be used to power the board and to load the code.

• µC:
ATMEGA16U2 microcontroller allows the ability to upload binary code generated
after compiling the program developed by the user.

• PWM:
Type of digital outputs used to modify the cycle of a periodical signal.

3.1.2 Bluetooth Module:


HC-06 Bluetooth module is designed for establishing short range wireless data
communication between two microcontrollers or systems. The module works on Bluetooth
2.0
communication protocol. It can only act as a slave device. This is cheapest method for
wireless
data transmission and more flexible compared to other methods and it even can transmit files
at speed up to 2.1Mb/s.
HC-06 uses frequency hopping spread spectrum technique to avoid interference with other
devices and to have full duplex transmission. The device works on the frequency range from
2.402 GHz to 2.480GHz.
This project consists of an HC-06 Bluetooth module. The Bluetooth module controls the
whole circuit through an Android app. We can control the LED lights, the PIR sensor, the
servo motor or whole of the circuit by this android app through Bluetooth. Furthermore if
someone wishes to add more modules or sensors to this whole circuit then it can be controlled
by this app simply by using an android device.

19
The communication with this HC-06 module is done through UART interface. The data is
sent to the module or received from the module though this interface. So we can connect the
module to any microcontroller or directly to PC which has RS232 port (UART interface).

Figure 3.5. Bluetooth Module HC-06

3.1.3 .LCD Module:

It is an alpha numeric LCD display, which powered by 5 V. It is characterized by simple


operation, high availability and numerous supports for many microcontrollers.

LCD modules are vey commonly used in most embedded projects, the reason being its cheap
price, availability and programmer friendly. Most of us would have come across these
displays in our day to day life, either at PCO’s or calculators.

16×2 LCD is named so because; it has 16 Columns and 2 Rows.


In this project it is working like an interface to show the user the display of various things for
example if a command to activate the LED or the Servo Motor is given this LCD module will
show the output of the particular thing.

Figure.3.6 16x2 LCD module

20
3.1.4 . Light Emitting Diode:

It uses a combination of other semiconductor materials that emit photons of different colours
when a current pass through it. It is formed by two polarities, one positive or anode and the
other negative or cathode. At the junction between both a potential barrier is formed to
prevent the exchange of electrons between the two regions. When voltage is applied and
LED is directly polarized, the electrons from source flows through it and whenever an excess
electron negatively charged overcomes the potential barrier resistance, crosses it and it
combined with a positive gap in excess. The energy acquired by the electron to cross the
barrier, becomes electromagnetic energy that releases as a light photon. LEDs have many
advantages over incandescent light sources, including lower energy consumption, longer
lifetime, improved physical robustness, smaller size, and faster switching.

LEDs are used in applications as diverse as aviation lighting, automotive headlamps,


advertising, general lighting, traffic signals, camera flashes, lighted wallpaper, horticultural
grow lights, and medical devices.[8]Unlike a laser, the light emitted from an LED is neither
spectrally coherent nor even highly monochromatic. However, its spectrum is sufficiently
narrow that it appears to the human eye as a pure (saturated) color. Nor, unlike most lasers, is
its radiation spatially coherent, so that it cannot approach the very
high brightnesses characteristic of lasers

In this project the LEDs are controlled by giving commands. They are attached to the
microcontroller and are controlled by the google voice recognition via the Bluetooth channel.

Figure 3.7. LEDs

21
3.1.5 Servo Motor:

A servo motor is an electrical device which can push or rotate an object with
great precision. It is just made up of simple motor which run through servo
mechanism.

It consists of three parts:

1. Controlled device
2. Output sensor
3. Feedback system

It is a closed loop system where it uses positive feedback system to control motion
and final position of the shaft. Here the device is controlled by a feedback signal
generated by comparing output signal and reference input signal. Here reference
input signal is compared to reference output signal and the third signal is produces
by feedback system. And this third signal acts as input signal to control device.
This signal is present as long as feedback signal is generated or there is difference
between reference input signal and reference output signal. So the main task of
servomechanism is to maintain output of a system at desired value at presence of
noises.

Figure.3.8 Servo Motor

In this project the servo motor is controlled through the given commands the
Bluetooth channel. It receives the commands and works accordingly.

22
3.1.5 Google Voice Recogition:

Alternatively referred to as speech recognition.Voice recognition is a computer


software program or hardware device with the ability to decode the human voice.
Voice recognition is commonly used to operate a device, perform commands, or
write without having to use a keyboard, mouse, or press any buttons. Alternatively
referred to as speech recognition, voice recognition is a computer software
program or hardware device with the ability to decode the human voice. Voice
recognition is commonly used to operate a device, perform commands, or write
without having to use a keyboard, mouse, or press any buttons. Types of voice
recognition systems: Automatic speech recognition is one example of voice recognition.
Below are otherexamples of voice recognition systems.

• Speaker dependent system - The voice recognition requires training before it can be

used, which requires you to read a series of words and phrases.


• Speaker independent system - The voice recognition software recognizes most users' voices
with no training.
• Discrete speech recognition - The user must pause between each word so that the speech
recognition can identify each separate word.
• Continuous speech recognition - The voice recognition can understand a normal rate of
speaking.
• Natural language - The speech recognition not only can understand the voice but can also
return answers to questions or other queries that are being asked.

In this project, the Android app uses a voice recognizer which recognizes the voices
through the inbuilt google voice recognizer which is present in every smart device. It sends
the voice commands via the Bluetooth channel to the Arduino board. It sends the voice
signals through converting it into text . The text is checked with the commands written in the
code. If they match then the required function is performed.
3.1.6 .Jumper Wires:

The term "jumper wire" simply refers to a conducting wire that establishes an electrical
connection between two points in a circuit. You can use jumper wires to modify a circuit or
to diagnose problems in a circuit.Jump wires (also called jumper wires) for solderless
breadboarding can be obtained in ready-to-use jump wire sets or can be manually
manufactured. The latter can become tedious work for larger circuits. Ready-to-use jump
wires come in different qualities, some even with tiny plugs attached to the wire ends. Jump

23
wire material for ready-made or homemade wires should usually be 22 AWG (0.33 mm2)
solid copper, tin-plated wire - assuming no tiny plugs are to be attached to the wire ends. The
wire ends should be stripped 3⁄16 to 5⁄16 in (4.8 to 7.9 mm). Shorter stripped wires might result in bad
contact with the board's spring clips (insulation being caught in the springs). Longer stripped wires
increase the likelihood of short-circuits on the board. Needle-nose pliers and tweezers are helpful
when inserting or removing wires, particularly on crowded boards.Differently colored wires
and color-coding discipline are often adhered to for consistency. However, the number of available
colors is typically far fewer than the number of signal types or paths. Typically, a few wire colors are
reserved for the supply voltages and ground (e.g., red, blue, black), some are reserved for main
signals, and the rest are simply used where convenient. Some ready-to-use jump wire sets use the
color to indicate the length of the wires, but these sets do not allow a meaningful color-coding
schema.

Figure 3.9. Wires.

3.1.7. Resistors:

A resistor isa passive two-terminal electrical component that implements electrical


resistance as a circuit element. In electronic circuits, resistors are used to reduce
current flow, adjust signal levels, to divide voltages, bias active elements, and
terminate transmission lines, among other uses. High-power resistors that can
dissipate many watts of electrical power as heat, may be used as part of motor
controls, in power distribution systems, or as test loads for generators. Fixed
resistors have resistances that only change slightly with temperature, time or
operating voltage. Variable resistors can be used to adjust circuit elements (such
as a volume control or a lamp dimmer), or as sensing devices for heat, light,
humidity, force, or chemical activity.

Resistors are common elements of electrical networks and electronic circuits and are
ubiquitous in electronic equipment. Practical resistors as discrete components can be

24
composed of various compounds and forms. Resistors are also implemented within
integrated circuits.The electrical function of a resistor is specified by its resistance:
common commercial resistors are manufactured over a range of more than nine orders
of magnitude. The nominal value of the resistance falls within the manufacturing
tolerance, indicated on the component.
In this project resistors of 220 ohm are attached to the leds.

Figure 3.10 Resistances.

3.1.8. Bread Board:

A breadboard is a construction base for prototyping of electronics. Originally the word


referred to a literal bread board, a polished piece of wood used for slicing bread. In the 1970s
the solderless breadboard (a.k.a. plugboard, a terminal array board) became available and
nowadays the term "breadboard" is commonly used to refer to these.

Because the solderless breadboard does not require soldering, it is reusable. This makes it e
asy to use for creating temporary prototypes and experimenting with circuit design. For this
reason, solderless breadboards are also popular with students and in technological education.
Older breadboard types did not have this property. A stripboard (Veroboard) and similar
prototyping printed circuit boards, which are used to build semi-permanent soldered
prototypes or one-offs, cannot easily be reused. A variety of electronic systems may be
prototyped by using breadboards, from small analog and digital circuits to complete central
processing units (CPUs).

A modern solderless breadboard socket consists of a perforated block of plastic with


numerous tin plated phosphor bronze or nickel silver alloy spring clips under the perforations.
The clips are often called tie points or contact points. The number of tie points is often given
in the specification of the breadboard.

The spacing between the clips (lead pitch) is typically 0.1 inches (2.54 mm). Integrated
circuits (ICs) in dual in-line packages (DIPs) can be inserted to straddle the centerline of the

25
block. Interconnecting wires and the leads of discrete components (such
as capacitors, resistors, and inductors) can be inserted into the remaining free holes to
complete the circuit. Where ICs are not used, discrete components and connecting wires may
use any of the holes. Typically the spring clips are rated for 1 ampere at 5 volts and 0.333
amperes at 15 volts (5 watts). The edge of the board has male and female dovetail notches so
boards can be clipped together to form a large breadboard.

Figure 3.11 Bread Board


3.2 Mobile Application

3.2.1 Choice of software

Nowadays thanks to the boom of mobile applications there are infinite possibilities
to build one. One of them is to use a software in which is not needed to know
anything of code,the fact that facilitates access to non-experienced users, but the
problem of this option is that it greatly restricts the field of action in terms of
functionality and default templates are often used, which also limits user’s
challenge of design own and unique mobile application. For these reasons, these
types of software are discarded to be used during this project. After this first

26
selection, there are many software valid for the purpose of this project. The
application was started to develop using Android Studio, but the lack of
experience of programming with Java turned the activity more difficult the
development of the application progressed. Then it was decided that the best way
to continue with the design and development was to use MIT App Inventor
software, an integrated development environment to create mobile applications for
Android operating system. The application’s block editor uses the open blocks
Java library to create a more intuitive language. It uses a block-based
programming language built on Google Blockly and inspired by languages such as
Star Logo TNG and Scratch empowering anyone to build a mobile phone app to
meet a need

Its resulting applications allows to cover a great number of basic needs in a mobile
device, including all the requirements for the project application, but may be
limited for other applications with more complexity.

3.2.2 Functionality of the application

The Android mobile application is programmed in such a way that the Bluetooth
device sends the order to the Arduino board.
First the android device is connected via the Bluetooth module HC-06. Here it is acting as a
slave device. The Arduino communicates with the Bluetooth module via serial
communication and this makes it really easy to write the code. Since we decided to use
software serial and not the Arduino’s hardware serial pins we will need the Arduino software
serial library. This library gives us the freedom to choose any of the Arduino digital pins as
our Rx and Tx pins. The hardware serial pins are the same pins used by the Arduino to
communicate with the computer so connecting them to the Bluetooth will cause interference
which could hinder the code upload process. Although the pins can be disconnected from the
Bluetooth when the code is being uploaded and reconnected after the code has been uploaded
but this is not always efficient.

The basic function of the code is to monitor the incoming serial data stream, if it receives the
voice command “turn on”, it turns the LED on and if it receives a “turn off” it turns the LED
off. Same is the case with the servo motor.

27
CHAPTER 4

ELECTRONIC DESIGN

4.1 . Block diagram

Below is shown the diagram block of the entire application:

Figure 4.1. Block diagramof the application.

The core of the application, where all the information is centralized, is the
microcontroller ATmega2560 included in the Arduino Mega board. The code is
continuously executed in it and it collects all function modes, receiving orders of
the mobile application, information of the environment through sensors and
governing all the actuators connected after processing all the data acquired.

4.2 Circuit Diagrams:

Figure 4.2. LCD connection

28
Figure 4.3. Diagramof the LED connection

Figure 4.4. Servo Connection

29
Figure 4.5. Diagram of Bluetooth Module

30
4.3 Original Circuit:

Figure 4.6. Diagram of Circuit

31
CHAPTER 5

PROGRAMMING

5.1. Arduino programming

The previous section looked at different code elements in the Arduino/C language. Now
you’ll see how they come together into a complete program. Open a fresh version of the
Blink example by clicking on the upward pointing arrow in the Toolbar and then selecting
01.Basics → Blink. Then, copy and paste the following example code into your Arduino
window.

As you have done before, click on the check mark button in the Toolbar to compile the code.
A “Done compiling” message should appear in the Status Bar. If you receive an error
message instead, make sure your code matches the code above exactly. Continue to edit and
compile until you receive a “Done compiling” message.

Each Arduino program has three main parts:

1. variable declaration section


2. setup section
3. loop section

These sections are analogous to the ingredient list (variable declaration), preparation steps
(setup), and cooking steps (loop) in a recipe. Here is a diagram showing where the three parts
are located in the code:

When your program runs, it will first define your variables (the ingredients that you need),
then execute the setup section once (set everything up to begin cooking), and then execute the
loop section over and over (actually do the cooking.

5.1.1 Variable Declaration Section:

Programs often begin with introductory comments that explain what the program is doing.
These comments come before the variable declarations. It is a good idea to begin every
program with comments like these so that when you return to your program later you’ll know
what it does.

32
Variables are usually declared at the beginning of a program immediately following the
introductory comments. All of the variables that you are using in your code should be listed
here, before the setup and loop sections.

5.1.2 SETUP( ):

The first is the function that is executed only the first time that application runs, instead the
second one is executed as a loop, continuously.The setup ( ) is the preparation block and
loop ( ) is an execution block. The setup function is the first to execute when the
program is executed, and this function is called only once. The setup function is used to
initialize the pin modes and start serial communication. This function has to be included
even if there are no statements to execute.

5.1.3 LOOP ( ):

After the setup ( ) function is executed, the execution block runs next. The execution
block hosts statements like reading inputs, triggering outputs, checking conditions etc
The Loop( ) function is a part of execution block. As the name suggests, the loop ( )
function executes the set of statements (enclosed in curly braces) repeatedly. For this
application additional functions are included to segment and make the program more
efficient. There is a function for each mode of function that includes the necessary control
loops. At the beginning of the Arduino code all the components are delimited: type, the pin to
which is associated and the operation mode. In addition, it is also declared the global
variables and the libraries which will be used in the whole code.

33
5.1.4 Arduino Code:

34
5.2 Mobile Application Programming:

Mobile application is programmed with MIT App Inventor software. It is designed to connect
via Bluetooth with the Arduino that controls the house.

The user has to turn on the Bluetooth of the android device and connect it with the Bluetooth
module of the circuit. Once connected , a connection is formed between the android app and
the circuit. Now the user can give the desired commands.

Figure 5.1. Diagram of mobile app without connection

35
In the above figure it can be seen that the Bluetooth is not connected to the Bluetooth module
pf the circuit hence it cannot be controlled yet. So in order to start the application and the
circuit working we first connect the Bluetooth of both devices

Figure 5.2. Diagram showing the availability of devices

In the above figure 5.2 it can be seen the mobile app is showing the availability of the
device having Bluetooth .You have to select the HC-06 which is the Bluetooth modules
name.

36
Figure5.3 Diagram of mobile app without connection

In the above figure it can be seen that the bluetooth is now connected and the circuit is now
ready to be operated

37
Figure 5.4. Diagram of mobile app asking to speak the required command

In the above figure it can be seen the that the mobile application is show the Google voice
recognizer to receive the input from the user in the form of voice. Once it captures the voice
it converts it into text. Now the text form of the command is sent to the arduino there it is
checked and the required command is performed.

38
5.2.1 MIT App Inventor Code :

39
CHAPTER 6

CONCLUSION

The three scenarios would be enough to understand the uses and advantages of this
project. In the first scenario we see about how the Arduino based voice activated home
automation system is useful for saving electricity and time of the user. The second scenario
is about how the Arduino based voice activated home automation system will help disabled
and aged people to control the appliances around them with even changing their position,
which sometimes is hard for them to do. In the third scenario we will consider that how the
Arduino based voice activated home automation system is compatible and easy to install than
other systems available in the market at such a low cost.

6.1 Scenarios:

6.1.1 Electricity cost Efficiency

To compare the Arduino based voice activated home automation system based on
IOT with the traditional manual system, we come across the conclusion that the traditional
manual switching system consumes more electricity than the Arduino based voice activated
home automation system The reason of which the Arduino based voice activated home
automation system can be controlled remotely so the user/consumer don’t need to be present
physically to turn something OFF while in manual or traditional switching system the
consumer need to be present physically to turn something ON or OFF.

6.1.2 How will it help Aged and Disabled People?

The main and the targeted users of the Arduino based voice activated home
automation system will be aged and disabled people because they face a lot of difficulties
while using electrical appliances around them as they are dependent on others to move
around. With the help of this project the disabled and aged people will also be able to control
the common appliances with just a tap of screen. This project will make the life of these
people a lot easier and comfortable because they would not be dependent on others any more
to turn the lights of their room OFF, or turn the fan ON for them because now they would be
able to do it from their smartphone. As it can be seen in the report´s development, all the
objectives exposed have been accomplished. It has not been an easy project and it required
many hours of research to match expectations.

40
This thesis is based on what has been learned during the degree, expanding the
knowledge in different areas to obtain a final project where three main electronic parts meet
electronic design (hardware) , programming(software) and communication between
devices.The fact of having chosen home automation as a subject to work on has been
fulfilling because it is an issue which is currently in full expansion and has a promising
future. This technology is in constant expansion and its scope is growing to cover more
important areas like security, accessibility and user´s comfort. In addition, there is another
technology that has been developed, which is currently highly used and that is mobile
applications. Even though there are many platforms that allow users to create an application,
the handicap has been creating an application capable to communicate with other devices and
also making it exclusive to remotely control them. Personally, it has been the very first time
that I created a mobile application and the hardest thing to complete the project was to make
it work as desired. It has also been the most satisfying part.

As a summary, I have dealt with important parts of the degree I studied, using the
knowledge acquired and increasing it, obtaining the know-how to get myself out in the
professional market.

41
BIBLIOGRAPHY

For the successful working of my project I have referred many sources for the code snippets,
logics and tips and tricks from various books as well as website. Mostly we search for the
required possessions on the google.com search engine.

Books Referred

1. Programming Arduino: Getting Started with Sketches


Book by Simon Monk.
2. Arduino Project Handbook: 25 Practical Projects to Get You Started
Book by Mark Geddes.

Websites Referred
• www.google.com
• www.youtube.com
• www.arduino.cc
• www.instructables.com

42

Potrebbero piacerti anche