Professional Documents
Culture Documents
3.1 Introduction
This chapter presents the various methods used in developing the android controlled appliance
using GSM and Bluetooth for home automation. The steps taken in designing the system were
in two phases; the first phase is the design of the relay switching system, interfacing of GSM
to the system to receive control commands from the android phone from far distances and
interfacing of Bluetooth with the system to receive control commands from near distances. The
second phase was the design of the android application that sends control to the system via
Bluetooth.
1. Atmega328P Microcontroller
2. GSM800L module
3. Bluetooth module
4. LCD display
6. Relay
7. Android phone
The switching circuits consists of different components working together to achieve the
purpose of switching ON and OFF the appliances based on the control commands received
from the GSM and Bluetooth and display the status of the whole system through the LCD
display in the
The relay switching circuit is the circuit that switch ON and OFF the appliances connected to
circuit. The switching circuit showing how these component are interconnected to achieve the
3.2.1 Relay
The relay is an electrical switch that uses an electromagnet to mechanically operate a like a
switch, other operating principles are employed too such as SSR (Solid State Relays). Relays
are made use of in circuits where it is necessary to separate low-power signal, or where several
circuits need to be controlled by just one signal. Relays were primarily used in telephone
A simple relay consists of a coil of wire wrapped around a soft iron core, an iron yoke which
provides a low reluctance path for magnetic flux, a movable iron armature, and one or more
sets of contacts. When an electric current is passed through the coil, it generates a magnetic
field that activates the armature, and the consequent movement of the movable contacts(s)
either makes or breaks a connection with a fixed contact. If the contacts were in contact before
the current was passed through it, they are separated and one contact may now be connected to
another contact and vice versa. A picture of a latching magnetic relay is shown in Figure 3.1.
The relays used in the relay switching circuit is a 5V, 240V magnetic relay. This is a low power
A liquid crystal display is a flat-panel display which uses light-modulating properties of liquid
crystals to display data in printed forms. Liquid crystals do not emit light directly. LCDs are
available to display arbitrary images (as in a general-purpose computer display) or fixed images
with low information content, which can be displayed or hidden, such as preset words, digits,
LCDs are used in a wide range of applications including computer monitors, televisions,
instrument panels, aircraft cockpit displays, and indoor and outdoor signage. Small LCD
screens are common in portable consumer devices such as digital cameras, watches,
calculators, and mobile telephones, including smartphones. LCD screens are also used on
consumer electronics products such as DVD players, video game devices and clocks. LCD
screens have replaced heavy, bulky cathode ray tube (CRT) displays in nearly all
applications. LCD screens are available in a wider range of screen sizes than CRT and plasma
displays, with LCD screens available in sizes ranging from tiny digital watches to huge, big-
LCD module was employed in this project to display the status of appliances and the mode
through which the last command was received. A LCD module is shown in Figure 3.3
The Atmel 8-bit AVR RISC-based microcontroller combines 32 kB ISP flash memory with
general purpose working registers, three flexible timer/counters with compare modes, internal
and external interrupts, serial programmable USART, a byte-oriented 2-wire serial interface,
SPI serial port, 6-channel 10-bit A/D converter (8-channels in TQFP and QFN/MLF
packages), programmable watchdog timer with internal oscillator, and five software
selectable power saving modes. The device operates between 1.8-5.5 volts. The device
The program that controls the general behaviour of the system is burned onto an Atmega328P
receives command from the Bluetooth and GSM and then in turn turns ON or OFF the relays
depending on the control command received. The microcontroller is also responsible for
GPRS system. Global System for Mobile communication (GSM) is an architecture used for
mobile communication in most of the countries. GSM has the capability of receiving messages,
control command is sent to the GSM module interfaced with the Atmega328 via SMS from the
android phone that controls the appliances. A figure of the GSM module employed in this
Bluetooth is a wireless technology standard for exchanging data over short distances (using
short-wavelength UHF radio waves in the ISM band from 2.4 to 2.485 GHz) from fixed and
mobile devices, and building personal area networks (PANs). Invented by telecom vendor
Ericsson in 1994, it was originally conceived as a wireless alternative to RS-232 data cables.
Bluetooth is managed by the Bluetooth Special Interest Group (SIG), which has more than
consumer electronics. The IEEE standardized Bluetooth as IEEE 802.15.1, but no longer
maintains the standard. The Bluetooth module adopted in this project is the HC-06 that
receives data from another Bluetooth device and transfer it to the Atmega328 microcontroller
using TTL logic via a TX and RX pin. The control commands sent to the Bluetooth is in form
of String which is then analysed by the Atmega328 microcontroller and the proper control
action is carried out by the microcontroller through the relays. The Bluetooth module is
Android software development is the method through which new programs are created to run
on the Android operating system. Applications for Android operating system are mostly
developed using Java programming language and the Android software development kit
(SDK), although other development environments are also available for use.
platform on which the android application source code is written is needed, the written code is
then compiled and exported to an installable for users in the android .apk format.
Figure 3.1 shows a flowchart of the steps to be carried out when developing an android
application through the eclipse IDE which was used for this project.
The XML design projects all the graphical user interface (GUI) designs and the Java engine is
responsible for linking the android OS to the GUI and processing the events triggered by users
Design application
engine with java
Export to
.apk file for
installation
Stop
develop programs or applications in especially Java. It has a workspace where programs are
written and compiled to. Eclipse is developed mainly in Java and it is made primarily for
writing Java applications. Eclipse can be used to develop applications in other programming
languages such as Ada, ABAP, C, C++, COBOL, D, Fortran, Haskell, JavaScript, Julia,
Lasso, Lua, NATURAL, Perl, PHP, Prolog, Python, R, Ruby (including Ruby on Rails
framework), Rust, Scala, Clojure, Groovy, Scheme, and Erlang. The Eclipse software
development kit (SDK), which includes the Java development tools, is meant for Java
developers. Users can extend its abilities by installing plug-ins written for the Eclipse
Platform, such as development toolkits for other programming languages, and can write and
The android application that sends control commands to the switching circuit via Bluetooth
or GSM was developed using Eclipse and the GUI of Eclipse is shown in Figure 3.8
Extensible Markup Language (XML) is a markup language that defines a set of rules for
design goals of XML emphasize simplicity, generality, and usability across the internet. It is
a textual data format with strong support via Unicode for different human languages.
Although the design of XML focuses on documents, the language is widely used for the
(WORA), meaning that compiled Java code can run on all platforms that support Java without
the need for recompilation. Java applications are typically compiled to byte code that can run
Java is the primary language that android OS supports and about 80% of all android
applications are designed using java. Java was used in this project to link the GUI to the main
application and the most important part of the application is the java source code.
Java has the capabilities of all object oriented programming languages; inheritance is a process
of inheriting variables from other classes. This paved the way for the use of libraries. A library
and they are mostly reusable since they are meant for software development. Software
developers, companies who make large scale software driven devices or applications usually
provide libraries for programmers who may want to integrate the application into his own new
application. Applications such as Facebook, Dropbox, Twitter and LinkedIn have libraries for
Java was used to write the classes that sends the control command to the switching circuit via
the Bluetooth or GSM on the phone on which the android application is installed.