Академический Документы
Профессиональный Документы
Культура Документы
SmartHome
Gladiators
TH07
RahulGupta,100050086
PrakharJain,100050024
UtkarshDiwaker,100050087
SaketTiwari,100050075
TableofContents
1.Introduction
2.ProblemStatement
3.Requirements
3.1FunctionalRequirements
3.2HardwareRequirements
3.3SoftwareRequirements
4.SystemDesign
5.WorkingoftheSystemandTestresults
5.1CommunicationbetweenArduinoandRaspberryPi
5.2Stepswhenaswitchonswitchboardisturnedon/off
5.3Stepswhenaswitchonwebsiteisturnedon/off
5.4Howaresensorvaluesupdated
5.5Automaticon/offswitchviaSensors
5.6DiscoveryProtocol:
5.7AssigningNamestoSwitches,SensorsandRooms:
5.8TestResults:
6.DiscussionofSystem
7.FutureWork
7.1Bugs
8.Conclusions
9.References
1.Introduction
The system we developed has come to be called as Smart Home collectively, including the
hardware and software components. The motivation for developing Smart Home was to provide a
central control dock for all home switches and appliances. A docklikethiswould onlyhave utilityif it
couldbeaccessedfromanywhere,beitaremotelocationorlocallyinsidethehouse.
The Smart Home system allows access to switches through a web page which can be accessed
from anywhere with an internet connection. A user can view the state of a switch in real time as it
changes. In addition to that accessing sensor values with a delay of two seconds is also available on
this system. Control of switches depending on thesensor values has alsobeenenabled. Thiskindof a
setup can be useful in all environments requiring remote and intelligent control of electrical switches,
whichcanrangefromhomestoofficesandcanevenbeappliedtoagreenhouse.
In this report first we give an overall description of the Smart Home. Next we go into specific
details of hardware, software,userinterface,communicationinterfaceand testing strategiesin section
3.Wehaveexplainedtheintricaciesofeachofthesetopicsinthecorrespondingsections.
2.ProblemStatement
We intended to comeupwith asystemwhich wouldallow us tocontroltheswitchesofourhome
remotely via a web interface. Thesystem should alsobesmartenough toautomaticallyturnon/off the
switchesdependinguponthesensorsintheroom.
We believe that this is a real life problem that have moved to using smaller portable devices
connected to the internet.The product makes the users life easier by not requiring him/her to be
physically present ata placetoswitchon/offtheelectricalappliancesandfixtures. Thisproductbrings
switchestotheusershand.
With the advent of mobile technology people the tech savvy users to remotely control their
switches.Thefunctioningandefficacyoftheproductdependsontheinternetconnectivity.
3.Requirements
3.1FunctionalRequirements
Thefunctionalrequirementsofourprojectareasfollows
1. Switcheson/offinplace
2. Remotecontrolofswitchesviaweb
3. LEDlightsforinplaceswitches
4. Interactiveuserinterface
5. Anychangesmadetotheswitchinplaceshouldbereflectedonthewebinrealtime.
3.2HardwareRequirements
1. Raspberry Pi A centralised server for a home/greenhouse which communicates with the
arduinoboardsthroughXBee.
2. Arduino Boards We use Arduino Duo as hardware interfaces that control the switches.
TheseareconnectedtotheRaspberryPioverwifiviaXBeechips.
3. XBeeXBeesareusedforcommunicationsbetweenRaspberryPiandArduinoboards.
4. Switchboard Switches are attached on the switchboard to manually turnon/off LEDs.These
switchboardsareconnectedtotheirrespectiveArduino.
3.3SoftwareRequirements
1. Arduino IDE This software is required to program the Arduino Boards according to our
requirement.
2. NodeJS Web Server Weare usingtheNodeJSWebserverto create persistentwebsockets
between the web browser and the Raspberry Pi. This helps us to have real time communication
betweenthem.
3. MySQL MySQL is used as a database management system for storing the current status of
switchesinthedatabase.ItisusedbyNodeJSwebserver.
4.SystemDesign
Figure1:SystemDesign
Figure2:SwitchboardCircuit
Figure3:WebInterface
5.WorkingoftheSystemandTestresults
5.1 Communication between Arduino and Raspberry Pi
MessagesarepassedfromArduinotoRaspberryPiserverorviceversaviaXBee.Wehave
madeacustomprotocolforsupportingdifferenttypesofmessages.Themessageisoftheform:
255<switch_board_id><Message_Type><Field_A><Field_B>
a. IfMessage_Typeisequalto1,thenField_AcorrespondtoSwitch_IDandField_Bcorrespondto
Switch_State(1foron,0foroff).
b. IfMessage_Typeisequalto2,thenField_AcorrespondtoSensor_IDandField_Bcorrespondto
Sensor_Reading(between0and255).
c. Ifmessagetypeis10,thenthemessagecorrespondingtoField_Aisthenumberofswitchesand
Field_Bholdsthenumberofsensorsofaswitchboardcorrespondingtoswitch_board_id.
Similarstepsfollowintherenamingofsensors,whichcanbeinitiatedbyclickingtheeditbuttononthetop
ofthesensorstable.
Figure5:EditingRoomnames,SwitchNamesandSensornames
6.DiscussionofSystem
a)Whatallcomponentsofyourprojectworkedasperplan?
All except onecomponents worked asperplan.We hadresolvedtoimplementRelaydrivingcircuits
intheSRSdocumentbutendedupnotdoingitbothduetotimeconstraintsandimplementationdifficulty.
b)WhatfunctionalitieswereaddedotherthanthosediscussedinSRS?
1. Sensor Readings: We felt the need to add sensors to the system. So, we added sensors to
switch boards, which allow us to see real time sensor values on the website. Sensors can be of
differenttypeslikelightsensor,temperaturesensor,etc.
2. Automatic Switch On/Off via sensor readings: To make the system smarter, we added the
functionality to automatic switch on/off the switches based on sensor readings. Through this, a
user can bind a switch with a particular sensor and specify the sensor range in which he/she
wants to turn on/off the switch. So, when the specified sensor reading is within the specified
range,thesystemwillautomaticallyturnon/off(asspecifiedinthesettings)theswitch.
c)ChangesmadeinplanfromSRS:
Initially, We decided to use Ajax andPHPformakingclientserverapplication. We implementedit
but it seemed veryslow andweneededafastersystemfor realtime communication. Then wedecided
to go for NodeJS. NodeJS allows real time clientserver communication by making persistent web
sockets.WealsocouldntimplementtheRelayDrivingcircuits.
7.FutureWork
Wehavemainlytwocomponents:webserverhostedontheRaspberryPiandSwitchBoardattachedwith
theArduino.Bothofthesecomponentsarereusable.Ifonecanunderstandtheworkingofthissystem
correctly,theneitherofthesecomponentscanbecombinedwithsimilarothercomponents.Forexample,
thesamewebserverhostedonthesameRaspberrypiconnectedtothesameXBeemodulecanbeused
withanotherswitchboarddesignedbysomeoneelsejustbyfollowingthesamecommunicationprotocol.
Possibleextensionsoftheproject:
1. Scheduling:Aschedulingalgorithmcanbeimplementedontheservertoscheduleeventslike
turningon/offswitchesaccordingtothetime,turningonthelightwhenyoureturnfromhomeis
oneexampleforthisusecase.
2. Additionofavideo/audiofeed:Wecouldprovideamodalwiththevideofeedofthehomeor
greenhousetomonitorthelocationforsafetyand/ormaintenancepurposes.wecouldalso
similarlyaddaudiofeedifrequired.
3. UseofMux/Demux:Asarduinohaslimitednumberofpins,multiplexeranddemultiplexercan
beusedtoincreasethenumberofswitchesattachedtoarduino.
7.1 Bugs
Apartoffutureworkcouldberesolvingthebugsthatexistinthesystem.Theonlybuginthe
presentsystemisthatthepageneedstoberefreshedbeforethesensornameisreflectedonallother
webpageswherethesocketconnectionexists,thisisnotanissueinthecaseofroomsandswitches
orswitchsensormaps.
8.Conclusions
Webelievethattheprojecthasachievedeaseofswitchingelectricalconnectionsfortheuser,ina
costeffectiveandefficientway.Thecontroloftheswitchesusingthesensorsensuresthesmartness
ofthesystemasawhole.TherealtimedatadeliveryusingNodeJswasachallengingaffairto
implementresultinginarealtimeresponsivesystem.Thecircuitryusedwasdesignedand
implementedwiththegoalthatagooddemonstrationofthesystemcouldbegiven,butaneedfor
usingrelaydrivingcircuits.ThecommunicationbetweenXBeesbydefiningourowncommandsand
protocolswasachallengingtask.Allthesecanbeputtouseinfuturework.
Thepresentsystemcanbeusedtoswitchelectricalfixtureseithermanuallyorwithsensor
constraints.Thediscoveryprotocolhasbeenimplementedtoprovidetheusertheeaseofattaching
newsensorsandswitcheswithoutchangingArduinocode.Theuseoftheeditbuttontochangenames
hasbeenimplementedtoensurethatnocodechangesareneededontheRaspberryPiserver.The
circuitrydescribedabovecanbeusedtomakerelevantconnectionsinarealsystembeingdeployed.
Overallthisprojecthasbeenagreatlearningexperienceforalltheteammembers.Wehave
learntalotregardinghowanEmbeddedSystemisdifferentfromanyothersoftwaredevelopement
project.Wehavealsolearntdifferenttechnologiesintheprocess.Inadditiontothiswehavealso
learntthestagesofprototypingaproductinanentrepreneurialenvironmentandgottenapeekinto
howprojectsaredealtwithwhenthereisanenduserinvolved.
9.References
NodeJS:http://nodejs.org/
JadeTemplateLibrary:http://jadelang.com/
BootstrapCSSFramework:http://getbootstrap.com/
AjaxJavascriptLibrary:https://api.jquery.com/jQuery.ajax/
ArduinoProgrammingLanguage:http://arduino.cc/en/Reference/HomePage#.UxBr89YKgg