Smart Relay for Monitoring and Controlling the Systems

DOI : 10.17577/IJERTCONV9IS05099

Download Full-Text PDF Cite this Publication

Text Only Version

Smart Relay for Monitoring and Controlling the Systems

1Shivaanivarsha N, 2Dr J K Periasamy

1,2Associate Professor

1,2Sri Sairam Engineering College,Chennai,India

AbstractThe pro po sed sy s tem i s evolv ed with the help of Twitter, a n online so cial com munica t io n netwo rk which i s used to send direct – m essag es to the AtmegaArduino Unowhich ena cts a ta sk a cco rding ly by perusing the m essag es. The project propo ses an ef f i c i ent im plem enta t i on fo r Internet o f Things used fo r monito r ing and contro l l ing the hom e a pplia nces v ia Wo r ld Wide Web. They ca n co mmunicate with a ny netwo rk on the Internet, by m eans o f ev en Wireless proto cols l ike Wi – Fi. The Sy stem comprises o f Three impo rta nt modules: The Twitter Account Credentials, The Python Co de and The AtmegaArduino Uno. The extra La y er o f security i s g iv en by the py thon – twitter API i t self, which i s a n Open a ccess l ibra rymo dules tha t i s already put tog ether tha t enables us to a ccess the Info rm atio n o n the Twitter a cco unt. The Alg o ri thm tha t co ntrols the va r io us Dev i ces through Twitter i s co ded in Py tho n. A simple AND log i c g ate can be used to co ntrol a sing le a ppliance. Ho wev er, fo r Multiple Dev i ces a nd com pl ex operatio ns, we use a n AtmegaArduino Uno. The system ha s beendemo nstrated to be structured and LED' s ca n be used to Com pa re the co nduct o f the sy s tem a nd results affirm this co nclusion.

KeywordsIoT,Python,Arduino,Twitter,API,Secure,open- source,World Wide Web

I.INTRODUCTION

Imagine a world in which every device in the house, workarea and vehicle are coupled. A Society where the Electric and electronic gadgets automatically turn on when the vehicle approaches the driveway, the cappuccinostarts brewing when the morning alarm go away off and the entrancegate automatically unbars when reached by a member of the household, but stays locked when a stranger arrives on the front step. This was the type of world the Internet of Things can influence. Internet of Things is a wide area network of things that are attached to the Internet, therefore they have their own IP address and can connect to each other to automate simple tasks responses.

Fig 1. Twitter Developers

II.TWITTER

Twitter is an internet related social network service where clientsuprights and link with contents, "tweets," restricted to 140 characters. Registered users can post tweets, but those who are unregistered can only read them. Clientsapproaches Twitter through its website interface, SMS or a mobile device app. Internet consumers can tweet via the Twitter network, compatible external applications like personal digital assistants, or by Short Message Serviceavailable in certain countries.

Users may subscribe to other users' tweetsthis is known as "following" and subscribers are known as "followers" or "tweeps", a portmanteau of Twitter and peeps.In a social communication network, Twitter spins around the principle of followers. When one choose to follow another Twitter consumer, that user's tweets appear in reverse chronological order on the main Twitter page.

Individual tweets has been forwarded by other customers to their own feed, a process named as a "retweet". Users can also "like" (formerly "favorite") individual tweets. Twitter authorisesclients to reforms their datathrough their mobile gadgetseither by text messaging or by apps released for certain smart phones and tablets.

  1. SECURITY

    Arbitrator Twitter approaches have been required to use OAuth, an authentication method that does not needscustomers to enter their password authentication into the authenticating features. This is to expands the security authenticity and refines the user experience.

    OAuth is an open access standard for authorization, commonly cast offs as a way for Internet clients to authorize their access to websites to approaches their content on other websites but without giving them the authentication. This mechanism is used by companies like Twitter to permit the users to share information about their accounts with third party applications or websites[5,6].

  2. DEVELOPERS

    Twitter is recognized for having one of the most open and powerful developer APIs of any major technology company. Developer interest in Twitter began immediately following its launch, prompting the company to release the first version of its public API in September 2006. The API quickly became iconic as a reference implementation for publicREST APIs and is widely cited in programming tutorials.From 2006 until 2010, Twitter's developer platform experienced strong growth and a highly favorable reputation. Developers built upon the public API to create the first Twitter mobile phone clients as well as the first URL shortener.

  3. THE TWITTER-PYTHON API

    This library provides a pure Python interface for the Twitter API. It works with Python 2.7+ and Python 3.

    Twitter provides a service that allows people to connect via the web, IM, and SMS. Twitter exposes a web services API and this library is intended to make it even easier for Python programmers to use[1,4].

    1. Setting Up Twitter

      Since wInterfacing with twitter used to be easy, all One had to do was put the Username and password into the code and it would work. Now twitter has taken user info more seriously using oAuth, and as a result now the app must be registered with twitter to get an API key[1,2].

      Registering the app on dev.twitter.com will enable to grab fourImportant pieces of Information:

      -ACCESS KEY

      -ACCESS TOKEN SECRET

      -CONSUMER KEY

      -CONSUMER TOKEN SECRET

      These keys will be needed in the python code later to interface with the twitter API.

      status = api.GetUserTimeline('FishinGrapes') ##grab latest statuses

      Str_Tweet = [s.text for s in status] ##put status in an array

      the_tweet = Str_Tweet[0].split() ##split first tweet into words

      ## check for match and write to serial if match

      if the_tweet[0] == '#Tweeter':

      print ('Tweet Recieved, Turning

      on)

      ser.write('1'.encode())

      elif the_tweet[0] == '#Tweeterstop':

      ##break if done

      ser.write('0'.encode()) print ('stopped, awaiting

      instructions.')

      else:

    2. Getting the Application Token

      In order to use the python-twitter API client, one first need to acquire a set of application tokens. These will be the consumer_key and consumer_secret, which get passed to twitter.Api() when starting the application[11,12].

    3. Program Coding

    ##authenticate with twitter

    api = twitter.Api( consumer_key='*Consumer Key here*', consumer_secret='*Consumer secret Here*',

    access_token_key=*Access Token Key Here*, access_token_secret='*Access Token Secret Here*'

    )

    ##set to the serial port

    ser = serial.Serial(port='COM5') ser.baudrate = 19200

    while 1: function seconds

    ser.write('0'.encode()) print ('Awaiting Tweet')

    tweetfun() ## call tweetfun

    time.sleep(15) ## sleep for 15

    ## check serial port

    def CheckFun():

    ser.flushInput() time.sleep(3) line=ser.readline() time.sleep(3)

    if line == ' ':

    line=ser.readline() print ('here')

    status = [] x = 0

    Fig.2. Block Diagram

  4. ARDUINO UNO

    A program for AtmegaArduino Uno may be written in any proramming language for a compiler that produces binary machine code for the target processor. The AtmegaArduino Uno IDE supports the languages C and C++ using special rules of code structuring.

    The AtmegaArduino Uno IDE supplies a software library from the Wiring project, which provides many common input and output procedures[7].

    Fig 3.Arduino Pin Description

    User-written code only requires two basic functions, for starting the sketch and the main program loop, that are compiled and linked with a program stub main() into an executable cyclic executive program with the GNU toolchain, also included with the IDE distribution[5].

    The Arduino IDE employs the program avrdude to convert the executable code into a text file in hexadecimal encoding that is loaded into the Arduino board by a loader program in the board's firmware[10].

    A. Program Coding

    // the loop() method runs over and over again,

    // as long as the Arduino has power

    void loop()

    {

    if (Serial.available() > 0)

    {

    Fig 4. Experimental Setup

    Fig 5. Schematics

    incomingByte = Serial.read(); Serial.println(incomingByte);

    if (incomingByte> 10)

    {

    digitalWrite(relayPin, HIGH);

    }

    else {

    digitalWrite(relayPin, LOW);

    }:

    Serial.print("I received: "); Serial.println(incomingByte, DEC);

    }

    }

  5. RESULTS AND CONCLUSION

Thus, Internet of Things (IoT) has the potential to encompass and instrument an enormous range of connected devicesincluding home appliances and utilities, wearable, homes and corporate buildings, industrial processes, medical devices, law-enforcement devices, military equipment, and other connected applications that today might be barely imaginable. In the present context, "Things" are simply those computerized and networked devices that become part of the IoT. Some of those Things will be directly accessible over the Internet, whereas others would be supposedly hidden in local networks behind firewalls and address-translating routers[9,12].

There are already many risks recognizably associated with the IoT. Some risks are old and well known, but exacerbated by the unprecedented scale of the IoT; estimates for the next few years suggest tens of billions of Things.

Fig 6. Output Screen

Other risks may be new, stemming from the nature of how these Things are designed, what they are used for, how they are deployed and managed (or not managed), and how market forces will influence the development.

ACKNOWLEDGMENT

Thanks toTwitter and the Developers Community.Theclarityoftheircommentsinthesource codeallowedmetounderstandtheunderlyingcommunication proceduresbetweenthedeviceandthehigher-level libraries.Also,thankstoArduino and PyCharmforthier Open-Source Applications..

REFERENCES

  1. S.S.Malvika, D.David Jegan Abishek, S. Mithula, B.Karthikeyan, V.Vaithiyanathan, IEEE, Tweeting Pi: An household computerization system, June 2015

  2. Markus Jung, Christian Reinisch, Wolfgang Kastner , IEEE,Integrating Building Automation Systems and IPv6 in the Internet of Things, IEEE, September 2012

  3. M.S. Neethu, R.Rajasree, Sentiment analysis in twitter using machine learning techniques, IEEE, January 2014

  4. C. R. Nirmala, G. M. Roopa, , K R Naveen Kumar, Twitter data analysis for unemployment crisis, IEEE, April 2016

  5. Maotaz Soliman, Tobi Abiodun, Tarek Hamouda, Jiehan Zhou, Chung-Horng Lung, Smart Home: Integrating Internet of Things with Web Services and Cloud Computing, IEEE, March 2014

  6. M.Piyare, M.Tazil, Bluetooth based home automation system using cell phone, IEEE, August 2011

    WEBREFERENCES

  7. https://www.arduino.cc/en/Main/Documentation

  8. http://knightlab.northwestern.edu/2014/03/15/a-beginners-guide-to- collecting-twitter-data-and-a-bit-of-web-scraping/

  9. https://github.com/geduldig/TwitterAPI

  10. https://dev.twitter.com/docs

  11. http://python.berkeley.edu/2016-10-31-twitter-api-project/

  12. https://docs.python.org/

  13. https://dev.twitter.com/rest/reference/get/search/tweets

Leave a Reply