Raspberry Pi based Interactive Home Automation System through E-mail

17 downloads 148626 Views 1MB Size Report
Home Automation System through E-mail. Sarthak Jain, Anant Vaibhav, Lovely Goyal. Student member, IEEE,. Dept. of Electrical and Electronics Engineering, ...
2014 International Conference on Reliability, Optimization and Information Technology ICROIT 2014, India, Feb 6-8 2014

Raspberry Pi based Interactive Home Automation System through E-mail Sarthak Jain, Anant Vaibhav, Lovely Goyal Student member, IEEE, Dept. of Electrical and Electronics Engineering, Maharaja Agrasen Institute of Technology Delhi - 110086, India [email protected], [email protected], [email protected]

Abstract- Home automation is becoming more and more popular

developed a Java based home automation system. The use of Java technology, which incorporates built-in network security features, produces a secure solution. However, the system requires an intrusive and expensive wired installation and the use of a high end Pc. Baudel et at (1993) proposed a novel control network, using hand gestures. The controller uses a glove to relay hand gestures to the system. Ardam et at (1998) introduced a phone based remote controller for home and office automation. The system differs in that all communications occur over a fixed telephone line and not over the Internet. The system can be accessed using any telephone that supports dual tone multiple frequency (DTMF).

day by day due to its numerous advantages. This can be achieved by local networking or by remote control. This paper aims at designing a basic home automation application on Raspberry Pi through reading the subject of E-mail and the algorithm for the same has been developed in python environment which is the default programming environment provided by Raspberry Pi. Results show the efficient implementation of proposed algorithm for home automation. LEDs were used to indicate the switching action.

Key Words -Raspberry Pi, E-mail, Home Automation, Python.

The research available into home automation in public domain lies predominantly in the academic arena, with little industrial research being available in open literature. The adoption of home automation technologies into commercial systems has been limited, and where available consumer uptake has been slow. The aforementioned systems offer little in the way of interoperability. Attempts have been made to provide network interoperability and remote access to home automation systems through the development of home gateways. Kushirio et at (1998) proposed a home energy management focused home gateway, which connects the home network with the Internet. The system was installed in twenty houses in the Tokyo area. Saito et at (2000) defined a home gateway as the point of ingress between a personal area network and a public access network. Yoon et at (2008) implements a home gateway that accepts mobile phone signals and activates or deactivates an LED representing a home device. Ok et at (2006) proposed a home gateway based on the OSGI (Open Service Gateway Initiative), which allows service providers to access home automation systems for administration and maintenance services. These systems have made a significant contribution to the development of a home gateway. However, the existing network infrastructure within the home environment has not been taken into consideration when selecting the networks for integration with the respective home gateways.

I. INTRODUCTION Home automation refers to the application of computer and information technology for control of home appliances and domestic features. Its application varies from simple remote control of lighting to complex computer/micro-controller based networks involving varying degrees of intelligence and automation. Home automation results in convenience, energy efficiency, and safety benefits leading to improved quality of life. The popularity of network enabled home automation has been increasing greatly in recent years due to simplicity and much higher affordability. Moreover, with the rapid expansion of the Internet, there is the potential for the remote control and monitoring of such network enabled appliances. However, the new and exciting opportunities to increase the connectivity of devices within the home for the purpose of home automation through internet are yet to be explored. Several definitions are available in the literature for home Automation. Bromley et at (2003) describes home automation as the "introduction of technology within the home to enhance the quality of life of its occupants, through the provision of different services such as telehealth, multimedia entertainment and energy conservation". There has been significant research into the field of home automation with many other communication protocols like bluetooth, hand gestures, DTMF etc. The XlO industry standard, developed in 1975 for communication between electronic devices, is the oldest standard identified from the author's review, providing limited control over household devices through the home's power lines. Sriskanthan et at (2002) introduced a Bluetooth based home automation system, consisting of a primary controller and a number of Bluetooth sub-controllers. AI-Ali et at (2004)

978-1-4799-2995-5/14/$31.00©20 14 IEEE

The paper proposes a Raspberry Pi based home automation system through e-mails.

277

This paper presents a basic application of Raspberry Pi in home automation control through internet (E-mail) where subject of the received e-mail is read by the developed algorithm fed into raspberry Pi and system responds to the corresponding instructions. The presented system is interactive, efficient and flexible according to the consumer needs. It immediately replies the status of work done by raspberry Pi to the consumer. The proposed system has been tested practically using LEDs as switching signal indicators, which can be seen in the presented results. The project can be extended for more applications apart from switching of home devices like surveillance, power monitoring, fauIt monitoring, power control, security etc.

Fig. I. Raspberry Pi board.

II. SYSTEM CONFIGURATION Fig. 3 describes the configuration of the proposed system. Raspberry Pi has been chosen as the processing unit for the system because of its user friendly features and economical benefits. Further, python coded algorithm has been fed into the raspberry Pi and is connected to the internet through Modulator­ Demodulator (MODEM) interface to access and send e-mails to the consumer. The Devices to be controlled have been interfaced with raspberry Pi using relay driver circuit due to different power ratings of devices and raspberry Pi. A display (optional) may also be connected to view the instantaneous status and processing of raspberry Pi.

Raspberry Pi (shown in Fig. 1) is a credit-card-sized single­ board computer developed in the UK by Raspberry Pi foundation with the intention of stimulating the teaching of basic computer science in schools. It has two models; Model A has 25 6Mb RAM, one USB port and no network connection. Model B has 5 12Mb RAM, 2 USB ports and an Ethernet port. It has a Broadcom BCM2835 system on a chip which includes an ARMl176JZF-S 700 MHz processor, Video Core IV GPU, and an SD card. The GPU is capable of Blu-ray quality playback, using H.264 at 40MBits/s. It has a fast 3D core accessed using the supplied OpenGL ES2.0 and OpenVG libraries. The chip specifically provides HDMI and there is no VGAsupport.



The foundation provides Debian and Arch Linux ARM distributions and also Python as the main programming language, with the support for BBC BASIC, C and Perl, detailed description of Raspberry Pi board has been given in Fig. 2 (Raspbefl)' Pi user guide). Python was chosen as the main programming language, as it is generally accepted to be both easy to learn and a fully fledged , programming language suitable for real world applications. With the addition of NumPy, SciPy, Matplotlib, IPython, and PyLab, Python can be used for computational mathematics as well as for the analysis of experimental data or control systems (Ali etal-2013).

Fig. 3. Layout of the proposed system configuration

Also, the recent development of the Raspberry Pi mini­ computer has unlocked great potential for computing to be applied in a vast number of areas. Due to the unique advantages of the Raspberry Pi system, this technology holds great promise for providing solutions within the developing world. This includes but is not limited to education tools, especially the use of GPIO (General Purpose Input/Output) which allows automated data acquisition and producing simple digital control systems in a school laboratory setting. The most distinctive feature of the Raspberry Pi when used for educational purposes is the GPIO module, which allows interfacing with general purpose electronics (Ali etal-2013).

Raspberry Pi Quick start

Receiving

III.

CONTROL ALGORITHM 3V3

LED (Switch (l I LED2(Switch2) rI I GPI04

GPIOl7

� �

Fig. 2. Description of raspberry Pi Board.

1

2

5V

3

4

GND

5

6

I)

7

8

9

10

11

12

13

14

15

16

I

� LED3(Switch3) GPIOl8

I

Fig. 4. Pin layout of raspberry Pi GPIO used in system.

278

The GPIO pins for input and output have been defined to control different devices. The Raspberry Pi board has GPIO pin layout as shown in fig. 4. Out of the 26 pins, 3 pins have been used to control three devices in this project which have been represented by 3 LEDs for testing the switching signal. For practical purposes a relay driver circuit and relays can be interfaced with Raspberry Pi and appliances, respectively, for their controlling.

if(len(x)O): GPIO.setmode(GPIO.BOARD) #s ignal to devices if(x[O]

==

'ONI'):

Reply('Turning ON swithch I' , y[O]) GPIO.setup(7,GPIO.OUT) GPIO.output(7,GPI0.HIGH) if(x[O]

==

#Turn ON LEDI

'ON2'):

Reply('Turning ON switch 2', y[O]) GPIO.setup(II,GPIO.OUT) GPIO.output(II,GPIO.HIGH) if(x[O]

Initi alise the system (i.e., log in home aCCOJIt Rasp8err)pI, GPIOpins

==

#Turn ON LED2

'ON3'):

Reply('Turning ON swithch 3', y[O]) GPIO.setup(12,GPIO.OUT)

Dedicated to

fordevice intermcing, etc)

GPIO.output(12,GPI0.HIGH) if(x[O]

==

#Turn ON LED3

'OFFI '):

Reply('Turning OFF swithch 1', y[O]) GPIO.setup(7,GPIO.OUT) GPIO.output(7,GPI0.LOW) if(x[O]

==

#Turn OFF LEDI

'OFF2'):

Reply('Turning OFF swithch 2', y[O]) GPIO.setup(II,GPIO.OUT) GPIO.output(II,GPIO.LOW)

Implement the funct ion

if(x[O]

correspondi

==

#Turn OFF LED2

'OFF3'):

Reply('Turning OFF swithch 3', y[O])

ng to the read subject

GPIO.setup( 12,GPIO.OUT)

and reply

GPIO.output(12,GPI0.LOW)

the status to

the senrer

time.sleep(O.S)

#Turn OFF LED3

#call delay

Fig. 6. Control Structure of proposed algorithm coded in pythonIDE Wait for 0. 5 s e conds befu re checking thc new mail and

update

IV. PERFORMANCE EVALUATION For verification of the practicality of the proposed algorithm, LEDs were used to indicate the switching signal of the interfaced devices. The experimental setup is shown in Fig. 7. Results were generated by a series of E-mails sent to the G-mail account of raspberry pi and the corresponding inbox and sent mails of raspberry G-mail account are shown in Fig. 8 and Fig. 9, respectively. For example, an E-mail with the subject

Fig. 5. Flowchart of the control algorithm used.

The pins used in this project were: pin7(GPI04), pinll(GPIOI7) and pinI2(GPIOI8) . The code for implementing the control strategy for home automation was written in python environment on Raspberry Pi. Firstly, the code was set to initialize and log in into home g-mail account (g­ mail-imap) using the e-mail library of pythonIDE. After successful initialization, Raspberry Pi starts reading the subjects of e-mails from the account specified in the code. The subject of these e-mails is then compared from the initializing commands of the interfaced devices and the control signal is generated according to it on the corresponding GPIO pin. This process is repeated continuously at an interval of 0.5 seconds. Fig. 5 represents the algorithm of the used code in the form of flowchart. Fig. 6 shows the controlling module of the proposed algorithm, coded in pythonIDE. Here, the subject read from the e-mail is stored in an array x[], and the 'if structure was defmed as per the elements of that array, i.e. if subject is 'ONI', raspberry Pi replies 'Turning On switch I' to the sender and simultaneously the switch at pin.7 is turned ON and the structure is looped for checking new mail after every 0.5 seconds.

Fig. 7. Working Experimental setup, responding to email with subject 'On I" i.e. LEDI is glowing, representing the switching signal for switch I.

279

·O N l ' w a s s e n t t o r a s p b e r r y P i a c c o u n t ('[email protected]' in this case) from the consumer account (,[email protected]' in this case). The algorithm, read the subject 'ONI' and turned ON the device 1 represented by LEDI and instantly replied to sender by an email 'Turning ON switch l' under the subject- 'Home automation activated'. The code also includes exception handling in case of invalid e-mail from the consumer.

Go gle Gmail-

*NH+*



Inbox

Home_automation_activated

GoDaddy - Find New Custo mers Online - Rs.

Starred

Similarly the same switch can be turned OFF by sending an e-mail with subject 'OFFI' to the raspberry Pi account. Further, This work consists of two more switches which can be controlled by sending e-mails under the subject- 'ON2' & 'ON3' to turn ON the switch2 & Switch3 and correspondingly - 'OFF2' & 'OFF3" to turn them OFF. So, the results show that home automation has been successfully implemented with efficiency and reliability.

to anant vaib ...

Sent Mail

Turning ON swithch

1

Drafts �

[email protected]

Circles

to anantvaib .... -

-

.....

Search, chat

Turning OFF swithch

1

or SMS

[email protected]

Looks like you donOt have anyone to chat

to ananLvaib ....

with yet. Invite some

Turning ON switch

contacts to get started.

2

Learn more

In this highly developing era, where directly or indirectly, everything is dependent on computation and information technology, Raspberry Pi proves to be a smart, economic and efficient platform for implementing the home automation. This paper provides a basic application of home automation using Raspberry Pi which can be easily implemented and used efficiently. The code provided is generic and flexible in a user friendly manner and can be extended for any future applications like power control, surveillance, etc, easily. Moreover, this technique is better than other home automation methods is several ways. For example, in home automation through DTMF, the call tariff is a huge disadvantage, which is not the case in proposed method. Also, in Web server based home automation, the design of web server and the space required is eliminated by this method, because it simply uses the already existing web server provided by G-mail.

[email protected] to ananLvaib .... Turning ON swithch

Fig.

1

9. Screen shot of "SENT MAIL" from raspberry Pi

REFERENCES [I]

AI-Ali A. R. and AI-Rousan M., "Java-based home automation system",IEEE Transactions on Consumer Electronics,vol. 50, no. 2,pp. 498- 504,2004.

[2]

Ali M., V laskamp J.H.A, Eddiny N.N. , Falconer B. and Oram

c.,

"Technical Development

Implications of the

and

Socioeconomic

Raspberry Pi as a Learning Tool in

Developing Countries", 5th Computer Science and Electronic Engineering Conference (CEEC),pp. 103- 108,2013. [3 ]

Ardam H. and Coskun I., "A remote controller for home and

[4 ]

Baudel T. and Beaudouin-Lafon M., "Charade: remote control

office appliances by telephone", IEEE Transactions on Consumer Electronics,vol. 44,no. 4,pp. 1291-1297,1998.

gle

of objects using free-hand gestures", Communications of the ACM,voI. 36,no. 7,pp. 28-35,1993. [ 5]

Gmail

10

[email protected]

Important

V. CONCLUSION & FUTURE SCOPE

Go



....

o

T

Systems,

More ..

Primary

Connectivity

and

Services",

www.nextwave.org.uk,2003. [6]

C

Bromley K., Perry M., and Webb G. "Trends in Smart Home

I

.

.-

Soc

Kushiro N. , Suzuki S., Nakata M., Takahara H. and Inoue M., "Integrated home gateway

controller for home energy

management system", IEEE International Conference on Consumer Electronics,pp. 386-387,2003.

Inbox Anant vaibhav (2)

[7]

ON1

Starred Important Sent Mail

Ok S. and Park H. , "Implementation of initial provisioning function for home gateway based on open service gateway initiative platform", T he 8th International Conference on

Anant vaibhav

OFF1

Anant vaibhav

ON2

Advanced Communication Technology,pp. 1517-1520,2006. [8 ]

Saito T., Tomoda I., Takabatake Y., Ami J. and Teramoto K., "Home Gateway Architecture And Its Implementation", IEEE International Conference on Consumer Electronics, pp. 194195,2000.

[9 ] Fig.

Sriskanthan N. ,Tan F. and Karande A. ,"Bluetooth based home automation system", Microprocessors and Microsystems,Vol.

8. Screen shot of "lNBOX" received on raspberry Pi

26,no. 6,pp. 281-289, 2002. www.raspberrypi.orgjarchives/tagjraspberry-pi-user-guide [ 10 ]

YoonD. ,BaeD.,Ko H. and Kim H., "Implementation of Home Gateway and GUI for Control the Home Appliance", T he 9th International Conference on Advanced Technology,pp. 1583-1586,2007.

280

Communication