Home Automation and Energy Management using Android App

DOI : 10.17577/IJERTV4IS120114

Download Full-Text PDF Cite this Publication

Text Only Version

Home Automation and Energy Management using Android App

Amit Kumar Dwivedi (ME Student) Department of Electrical Engineering NITTTR, Chandigarh

Mrs. Shimi S. L (Assistant Professor) Department of Electrical Engineering NITTTR, Chandigarh

AbstractThis paper presents a project of low cost standalone home appliances control and monitoring system using microcontroller with real time GSM Module connectivity and appliances remotely controlled using Android based smart Phone App running on the Android platform. The main objective of home automation and energy management using Android app is to help uneducated, handicapped and old aged people. The Android mobile phone applications are more popular among software developers because of its open architecture. It is very good platform for real time interfacing, it offers a lot of features. In designing the app there is no need to write lengthy programming code. It provides a visual design interface as the way app looks as the block of interlocking components to control app behavior. The Android development kit has used to develop the app.

Keywords Microcontroller, Android development kit (ADK), GSM Module.

  1. INTRODUCTION

    With the continuous growth of mobile devices in its popularity and functionality the demand for advanced ubiquitous mobile applications in peoples daily lives is continuously increasing. Utilizing web services is the most open and interoperable way of providing remote service access or enabling applications to communicate with each other. In the busy and hectic life home automation and energy management system plays very important role in monitoring and energy management of appliances. There is an attractive market. Smart home contains multiple home appliances connected with one another. Android application provides the flexibility to control the appliances as well as monitors the appliances and electricity consumed by them. The most commonly used technology for home automation projects are Wi-Fi, WI-MAX, Bluetooth and GSM.

    The GSM is the most popularly used cellular technology. Since the largest numbers of subscribers are using GSM technology so it is most appropriate home automation project. GSM technology is preferred because of its wide range of coverage this makes whole system online for all time. Another reason of using GSM technology is its highly secured infrastructure other person cannot monitor the sent and received information. In this project an Android application is being developed to control the appliances. So by using simple touches controlling of appliances can be done.

    II BRIEF SYSTEM DESIGN

    The goal of this project is to create a home automation and energy management system using microcontroller, GSM Module, Analog Energy Meter, Relays.

    After designing the hardware the microcontroller is programmed then Android application is designed for the controlling and monitoring.

    The system consists of:

    1. 8051 Microcontroller

    2. LCD Display

    3. GSM module

    4. Regulated Power Supply

    5. Relay Module

    6. Opto coupler

    7. Transistors

    8. Resistors

    1. Overview of AT89S52 Microcontroller

      The AT89S52 is a small-control, superior CMOS 8-bit microcontroller with 8K bytes of in system programmable Flash memory. The device is manufactured using Atmels high-density non-volatile memory technology and is compatible with the industry-standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non- volatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly flexible and cost-effective solution to many embedded control applications. The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode, stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents, but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset.

      Fig.1 AT89S52Microcontroller PIN Diagram

    2. GSM MODEM

      A GSM modem is a specialized type of modem which accepts a SIM card, and operates over a subscription to the mobile operator, just like a mobile phone. From the mobile operator perspective, a GSM modem looks just like a mobile phone. When a GSM modem is connected to computer, this allows the computer to use the GSM modem to communicate over the mobile network. While these GSM modems are most frequently used to provide the internet connectivity, many of them can also be used to send and receive the SMS and MMS messages. A GSM modem can be a dedicated modem device with a serial, USB or Bluetooth connection; it can be a mobile phone that provides GSM modem capabilities. For the purpose of this document, the term GSM modem is used as a generic term to refer to any modem that support one or more of the protocol in the GSM evolutionary family, including 3.5G technologies GPRS and EDGE, as well as the 3G technologies WCDMA, UMTS, HSDPA and HSPA. A GSM modem exposes an interface that allows applications such as Now SMS send and receive messages over modem interface. The mobile operator charges for this message sending and receiving as if it was performed directly on the mobile phone. To perform these tasks, a GSM modem must support an extended AT command set for sending and receiving SMS messages, as defined in the ETSI GSM 7.05 & 3GPP TS

      27.005 specifications. GSM modem can be a quick and efficient way to get started with SMS because a special subscription to an SMS service provider is not required.

      Fig.2 GSM Interfacing Board

    3. LCDMODULE

    A 16×2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5×7 pixel matrix. This LCD has two registers, namely, Command and Data. The command register stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position, controlling display, etc. The data register stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD. Click to learn more about the internal structure of an LCD. It has a total of 16 pins.

    Fig.3 Pin diagram of 16×2 LCD

    D Analog Energy Meter

    Electronic Energy Meter is based on Digital Micro Technology (DMT) and uses no moving parts. So the EEM is known as Static Energy Meter In EEM the accurate functioning is controlled by a specially designed IC called ASIC (Application Specified Integrated Circuit). ASIC is constructed only for specific applications using Embedded System Technology. Similar ASIC is now used in Washing Machines, Air Conditioners, Automobiles, and Digital Camera, etc. In addition to ASIC, analogue circuits, Voltage transformer, Current transformer etc. are also present in EEM to Sample current and voltage. The Input Data (Voltage) is compared with a programmed Reference Data (Voltage) and finall a Voltage Rate will be given to the output. This output is then converted into Digital Data by the AD Converters (Analogue- Digital converter) present in the ASIC. The Digital Data is then converted into an Average Value. Average Value per Mean Value is the measuring unit of power. The output of ASIC is available as Pulses indicated by the LED (Light Emitting Diode) placed on the front panel of EEM. These pulses are equal to the Average Kilo Watt Hour (kWh / unit). Different ASIC with various kWh are used in different makes of EEMs. But usually 800 to 3600 pulses / kWh generating ASICs are used in EEMs. The output of ASIC is sufficient to drive a Stepper Motor to give display through the rotation of digits embossed wheels. The output pulses are indicated through LED. The ASIC are manufactured by Analogue Device Company. ADE 7757 IC is generally used in many countries to make EEMs.

    Fig.4 Analog Energy Meter

    1. Relay Driver IC

      The remote controlling on consumer end is achieved with the use of a single pole double throw relay with the microcontroller. But the microcontroller cannot drive a relay directly. For this driving purpose ULN2003 driving IC is used. A ULN2003 is a high-voltage, high-current Darlington transistor array. It consists of seven NPN Darlington pairs that feature high-voltage outputs with common-cathode fly back diodes for switching inductive loads. The collector- current rating of a single Darlington pair is 500mA. The Darlington pairs may be paralleled for higher current capability. Applications include relay drivers, hammer drivers, lamp drivers, display drivers (LED gas discharge), line drivers, and logic buffers. The ULN2003 has a 3.7k series base resistor for each Darlington pair for operation directly with TTL or 5V CMOS devices.

      Fig. 5: (a) Pin diagram of ULN 2003, (b) Logic Diagram and (c) Schematic of EachDarlington Pair

      Fig 6 Internal structure of Relay

      Table 1 Relay Specifications

      Item

      Min

      Typical

      Max

      Unit

      Working Voltage

      4.75

      5.0

      5.25

      VDC

      Current

      185

      mA

      Pull-In Voltage

      (Max)

      3.75

      VDC

      Operation Time

      (Max)

      15

      ms

      Operating

      Temperature

      -25

      70

      OC

      G ANDROID

      Android is an operating system, powered by Google, for mobile devices such as tablets, smart phones and PDAs. It was initially developed by android incorporated, but later acquired by the Google. Android is an open development platform, which means that handset makers can use the platform and customize it to fit their own requirements. It is estimated that there are more than 300 million activated android devices in the world and android is installed 56% of the devices worldwide. Concentrating the architecture, Android comprises of five layers being: Linux kernel, Android runtime environment, Libraries, Application framework, and application layer.

    2. Relay

    The internal structure of SPDT Relay is shown in Fig. 3.25. The supply to the consumer is through a Single Pole Double Throw (SPDT) relay in the Smart Meter. Features like remote turn ON/OFF the supply, automatic cut OFF on theft detection and crossing the peak time energy consumption limit in the smart meter are governed through this relay. The Relay consists of a coil, 1 common terminal, 1 normally closed terminal, and one normally open terminal. When the coil of the relay is at rest (not Energized), the common terminal and the normally closed terminal have continuity. When the coil is energized, the common terminal and the normally open terminal have continuity. This relay's coil is rated up to 5V and the contact is rated up to 30A (@250VAC, 30VDC). The specification is listed in Table 3.4. The relay can use to control high current devices.

    Fig.7 Android Architecture

    The most important part of the android operating system is the Linux kernel. The Linux kernel uses for the memory management, process scheduling, network and other services. Every manufacturer can modify the Linux kernel to suit the

    needs of their mobile device. The Linux layer is followed by the android layer that contains the native libraries that are installed for a specific phone and vendor. Android run time comprises Dalvik virtual machine and the core Java libraries sit in the kernel. The Dalvik virtual machine is Googles interpretation of Java that is specifically designed for the mobile devices. The application framework layer lies on the top of these layers and is the layer used by the developers to create the application. Finally the applications and widgets are built on the top of the previous layers. Each interface screen is exhibited by Activity classes. A single application may consist of one or more activities and a Linux process that contains activities. An application can run in the background, even if its process has finished. It means that the activitys life cycle is not tied to the process life cycle. In short, Linux processes are just trivial containers for activities that can be disposed when they are no longer needed. The Advantages of Using Android App are, it makes app possible at no auxiliary cost. It has superior guarantee. It enhances privacy. It is rich with multimedia capacity. It is easy to conduct

    GSM

    Module

    Relay Driver Circuit

    Microcontroller AT89S52

    Load 1

    Load 2

    Load 3

    Load 4

  2. WORKING

    Android Phone

    LCD

    Energy Meter

    Fig.8 Block Diagram

    The figure shown above is the simple block diagram of the project. It is a simple illustration of how implemented project and the various parts involved in it. From the above representation, the first smart phone having an Android application is used as a transmitting section from which the subscribers send text messages through android application that contain commands and instruction to the second mobile station. The second mobile station (GSM Modem) is installed in specific areas where automation system is located. The mobile phone as indicated in the block diagram is the smart phone having android operating system. The received SMS message is stored in the SIM memory of the phone and then extracted by the microcontroller and processed accordingly to carry out specific operation. The relay driver is used to drive the relay circuits which switches the different appliances connected to the interface. The LCD is used to indicate the status of the operation performed by the microcontroller. The figure shown above is the simple block diagram of the project. It is a simple illustration of how implemented project and the various parts involved in it. From the above representation, the first smart phone is used as a transmitting section from which the subscribers send text messages through android application that contain commands and instruction to the second mobile station. The second mobile station (GSM Modem) is installed in specific areas where automation system is located. The mobile phone as indicated in the block diagram is the smart phone having android operating system. The received SMS message is stored in the SIM memory of the phone and then extracted by the microcontroller and processed accordingly to carry out specific operation. The relay driver is used to drive the relay circuits which switches the different appliances connected to the interface. The LCD is used to indicate the status of the operation performed by the microcontroller.

  3. FLOW CHART

    Microcontroller Execute the commands Received from GSM Modem

    Start

    Initialize Microcontroller 8051 and other Circuit

    Microcontrollersees the statuses of appliances are ON/OFF sent GSM Modem

    For Each Pulse from Energy Meter Counter Incremented by 1 Unit and save it resistor R6

    Microcontroller Execute SMS Command

    Port P2.0 Monitors Pulses from Energy Meter

    Initialize the counter to 0 , Save it to resistor R6

    No (ON/OFF)

    Display on LCD Home Automation

    Blinking LEDS Shows Appliances Working Properly

    Appliances Gets ON/OFF According to SMS Command

    END

    Is the executed command about the status or ON/OFF appliances?

    Yes(Status)

    Microcontroller extracts the stored energy meter unit and sent to GSM modem Serial Communication

    END

    Is Interrupt Generated From Miss Call?( Port P2.2 Monitor)

    LCD Display Reading SMS

    Fig. 9 Flow Chart of working of Project

  4. ANDROID APP DEVELOPMENT

    In the project an Android application is being used. It has a huge market and open source. A number of different programming tools are used for the development of the application.

    1. Overview Of Android

      Android an open source and Linux-based Operating System for mobile devices such as smart phones and tablet computers. Android was developed by the Open Handset Alliance, led by Google, and other companies. Android offers a unified approach to application development for mobile devices which means developers need only develop for Android, and their applications should be able to run on different devices powered by Android. The first beta version of the Android Software Development Kit (SDK) was released by Google in 2007 whereas the first commercial version, Android 1.0, was released in September 2008. On June 27, 2012, at the Google I/O conference, Google announced the next Android version, 4.1 Jelly Bean. Jelly Bean is an incremental update, with the primary aim of improving the user interface, both in terms of functionality and performance. The source code for Android is available under free and open source software licenses. Google publishes most of the code under the Apache License version

        1. and the rest, Linux kernel changes, under the GNU General Public License version 2.

          1. Android Applications Platform

      Android applications are usually developed in the Java language using the Android Software Development Kit. Once developed, Android applications can be packaged easily and sold out either through a store such as Google Play or the Amazon App store. Android powers hundreds of millions of mobile devices in more than 190 countries around the world. It's the largest installed base of any mobile platform and growing fast. Every day more than 1 million new Android devices are activated worldwide.

    2. Environment Setup

      Android application development on either of the following operating systems:

      • Microsoft Windows XP or later version.

      • Mac OS X 10.5.8 or later version with Intel chip.

      • Linux including GNU C Library 2.7 or later.

      • Android applications are freely available and can be downloaded from the Web. Following is the lists of softwares are required before start Android application programming.

      • Java JDK5 or JDK6

      • Android SDK

      • Eclipse IDE for Java Developers (optional)

      • Android Development Tools (ADT) Eclipse Plugin (optional)

    3. Programming for Sending SMS Using Android App

    SMS is one of the most used functions on mobile phones. It is great for short person to person communications. It can also be used in a variety of ways within applications beyond its normal use. For instance, it can be used to exchange small amounts of data between phones running the same application. Start with a normal person to person SMS messaging and move towards developing applications that utilize SMS for other purposes such Automation.

    1. Sending SMS with an Intent In Android an Intend can be used to send an SMS message utilizing the normal SMS activity

      Intend smsIntend = new Intend (Intend.ACTION_VIEW);

      smsIntent.setType ("vnd.android-dir/mms-sms"); smsIntent.putExtra ("address", "12125551212");

      smsIntent.putExtra("sms_body","Body of Message");

      The Intent specified above is a generic "ACTION_VIEW". Android knows based upon the specified "type" that it is meant for the built-in SMS Activity. The "address" and "sms_body" extras specify the phone number and the body of the message that will be filled in when the Activity launches.

    2. Programmatically Sending An SMS

    The user doesnt have to rely upon the built-in applications to handle SMS, can utilize the Android API to programmatically send SMS messages from our own applications. First, in order to send SMS, there is need to add the following permission to our AndroidManifest.xml file:

    <uses-permission

    android:name=android.permission.SEND_SMS><

    /uses-permission>

    Here is a basic snippet of code for sending an SMS:

    SmsManager SMS = SmsManager. getDefault ();

    sms.sendTextMessage("7508666256", null, "Hi there", null, null);

    The first argument in the "sendTextMessage" method is the phone number to send to and the third argument is the body of the message. That explore the other arguments which are set to null later. When this code is run, it just sends an SMS message. No questions asked.One problem with the above is that users may not like applications which just send out SMS messages without a prompt or at least the knowledge that it

    has happened. To indicate to a user that a message has been sent,the user can pass in something called a "PendingIntent". This is an Intent that the receiving Activity will use to call our Activity back to once the message has been sent. It is passed as the fourth argument in the "sendTextMessage" method of the SmsManager object.To run the app from Android studio, open one of the project's activity files and click Run icon from the toolbar. Before starting the application, Android studio displays following window to select an option where the user wants to run your Android application.

    Fig.11 Message window before sending SMS

    The user can modify either of the given default fields and finally use send SMS button to send SMS to the mentioned recipient.

    Fig 10 Android Development Kit, Window

    Select mobile device as an option and then checks mobile device which will display following screen:

    Fig 11 Android App For Sending SMS Command

    Now use Compose SMS button to launch Android built-in SMS clients which is shown below:

  5. EXPERIMENTAL MODEL

    Fig12 Proto Type Developed

    The above picture shows the complete assembly of hardware used in the project. In the Home automation kit two microcontrollers is used one is 89C51 and another Arduino microcontroller is being used. Two types of power supply 5V and 12V are being used in the project. Energy meter used in the project generates the pulses corresponding to the energy consumed by the loads. There transformers are used in the project as shown in the picture two are the 5V and one is 12V transformer. Three ICs MAX232, ULN2003 and 4N35 are used. Current transformer is used to measure the current. Four relays shown in the picture are used to make the four loads or bulbs ON/OFF. GSM module shown in the picture is used to receive the SMS from the mobile station.

  6. OUTPUTS

This Table shows the output on prototype home automation kit, that various combinations of loads can be switched ON and OFF by simply touching a particular button on Android App.

Table 2 11

Android Application Prototype Kit Output

1

12

2

13

3

14

4

15

5

6

7

(a)

(b)

Fig 13 LD Display Output

  1. VII CONCLUSION

    A flexible, economical and echo-friendly Home Automation and Energy Management System using Smart Phone GSM and Microcontroller has been designed to meet the rising energy demand. The designed system comprises a Smart Meter at the consumer end and a server at utility end. The

  2. smart meter has been designed using a low cost AT89S52

    microcontroller, DS137 RTC, 16×2 LCD, ULN2003 relay drive, SPDT relay and GSM module. The circuit for the Smart Meter was simulated in Proteus 7 and the microcontroller embedded programing was done on Keil

    µvision 3. Printed Circuit Board (PCB) was designed using

  3. Orcad 9. Separate monitoring of energy consumption,

    sending the energy consumption data as well as code corresponding to energy theft detects alert and activating/deactivating the consumer power supply on utility commands are achieved by the program embedded on the microcontroller of the smart meter, generating electricity bills automatically. The designed system is having the following merits.

    1. Economical: Implementation of home automation and energy management will, not only makes the public vigilant in their electricity bill and hence the electrical energy consumption, but also create awareness among the public about significance of energy conservation. This decreases the electricity bill of the consumer.

    2. Eliminates the Labour of Meter Data Collection: Automatic Meter Reading is one of the features of the Smart Metering. Since the smart meter measures the energy consumption data wirelessly, the laborious and the inappreciable task of manual data collection will be eliminated. This will also eliminate the corruption possibility made in the meter data collection.

    3. Remote Detection of Energy Theft and Meter Fault: Smart Meter detects energy theft and faulty meters remotely. The utility can take action at the earliest on these situations. This will decrease the financial loss due to missing of energy consumption data.

    4. Automatic Generation of Electricity Bill: At the end of the billing span, the microcontroller program automatically generates electricity bill and store in the secondary memory of the server. This will decrease the labour of data entry operator.

VIII REFERENCES

  1. Gang Cao, Tiefeng Xu, Taijun Liu, Yan Ye, Gaoming Xu, A GSM- Based Wireless Remote Controller Proceeding of the IEEE International Conference on Electronics, Communications and Control (ICECC), Zhejiang, pp 2413 2416, 9-11 Sept. 2011.

  2. Sarwar Shahidi, Md. Abdul Gaffar, Khosru M. Salim, Design and implementation of Digital Energy Meter with data sending capability using GSM network Proceeding of the IEEE International Conference on Advances on Electrical Engineering, Dhaka Bangladesh, pp 207-212, 19-21 December 2013.

  3. Atheena Charly, Janardhanan Reddy, S. Ashok, Development of Inbuilt Energy Management Controller" Proceeding of the IEEE International Conference on Advanced Communication, Control and Computing Technologies, NIT Calicut India, pp 372-375, May 8 2014.

  4. Anmar Arif, Muhannad, AI-Hussain, Nawaf AI-Mutairi and Essam AI-Ammar, Experimental Study and Design of Smart Energy Meter for the Smart Grid " Proceeding of the IEEE International Conference on Renewable and Sustainable Energy Conference (IRSEC), Ouarzazate, pp 515-520, 7-9 March 2013.

  5. K. S. K. Weranga, D. P. Chandima, Smart Metering for Next Generation Energy Efficiency and Conservation Proceeding of the IEEE International Conference on Innovative Smart Grid Technologies – Asia (ISGT Asia), Tianjin, pp 1-8, 21-24 May 2012.

  6. H. ElKamchouchi and Ahmed ElShafee, Design and Prototype Implementation of SMS Based Home Automation System Proceeding of the IEEE International Conference on Electronics Design, Systems and Applications (ICEDSA), Kuala Lumpur, pp 162-167, 5-6 Nov. 2012.

  7. Afshan Mulla, Jaypal Baviskar, Jeet Desai, Chandrashekhar Beral, Anagha Jadhav, GSM Based Interactive Voice Response System for Wireless Load Control and Monitoring Proceeding of the IEEE International Conference on International Conference on Communication, Information & Computing Technology (ICCICT), Mumbai India, pp 978-985, 16-17 Jan.

  8. Rozita Teymourzadeh, Salah Addin, Kok Wai Chan and Mok Vee Hoong, Smart GSM Based Home Automation Proceeding of the IEEE International Conference on International Conference on Systems, Process & Control (ICSPC2013), Kuala Lumpur, Malaysia, pp 306-309, 13-15 December 2013.

  9. Rasika S. Ransing and Manita Rajput, Smart Home for Elederly Care Based on Wireless Sensor Network Proceeding of the IEEE International Conference on International Conference on Nascent Technologies in the Engineering Field (ICNTE), Navi Mumbai India, pp 1-5, 9-10 Jan. 2015.

  10. Md. Mejbaul Haque, Md. Mortuza Ali and Md. Rafiqul Islam Sheikh, Microcontroller Based Single Phase Digital Prepaid Energy Meter For Improved Metering and Billing System International Journal of Power Electronics and Drive System (IJPEDS) Vol.1, No.2, pp. 139-147, December 2011.

Leave a Reply