SlideShare une entreprise Scribd logo
Chapter 5
IoT Design Methodology
Bahga & Madisetti, © 2015
Book website: http://www.internet-of-things-book.com
Outline
• IoT Design Methodology that includes:
• Purpose & Requirements Specification
• Process Specification
• Domain Model Specification
• Information Model Specification
• Service Specifications
• IoT Level Specification
• Functional View Specification
• Operational View Specification
• Device & Component Integration
• Application Development
Bahga & Madisetti, © 2015
Book website: http://www.internet-of-things-book.com
IoT Design Methodology - Steps
Step 1: Purpose & Requirements Specification
• The first step in IoT system design methodology is to define the
purpose and requirements of the system. In this step, the system
purpose, behavior and requirements (such as data collection
requirements, data analysis requirements, system management
requirements, data privacy and security requirements, user interface
requirements, ...) are captured.
Step 2: Process Specification
• The second step in the IoT design methodology is to define the
process specification. In this step, the use cases of the IoT system are
formally described based on and derived from the purpose and
requirement specifications.
Step 3: Domain Model Specification
• The third step in the IoT design methodology is to define the Domain
Model. The domain model describes the main concepts, entities and
objects in the domain of IoT system to be designed. Domain model
defines the attributes of the objects and relationships between
objects. Domain model provides an abstract representation of the
concepts, objects and entities in the IoT domain, independent of any
specific technology or platform. With the domain model, the IoT
system designers can get an understanding of the IoT domain for
which the system is to be designed.
Step 4: Information Model Specification
• The fourth step in the IoT design methodology is to define the
Information Model. Information Model defines the structure of all
the information in the IoT system, for example, attributes of Virtual
Entities, relations, etc. Information model does not describe the
specifics of how the information is represented or stored. To define
the information model, we first list the Virtual Entities defined in the
Domain Model. Information model adds more details to the Virtual
Entities by defining their attributes and relations.
Step 5: Service Specifications
• The fifth step in the IoT design methodology is to define the service
specifications. Service specifications define the services in the IoT
system, service types, service inputs/output, service endpoints,
service schedules, service preconditions and service effects.
Step 6: IoT Level Specification
• The sixth step in the IoT design methodology is to define the IoT level
for the system. In Chapter-1, we defined five IoT deployment levels.
Step 7: Functional View Specification
• The seventh step in the IoT design methodology is to define the
Functional View. The Functional View (FV) defines the functions of
the IoT systems grouped into various Functional Groups (FGs). Each
Functional Group either provides functionalities for interacting with
instances of concepts defined in the Domain Model or provides
information related to these concepts.
Step 8: Operational View Specification
• The eighth step in the IoT design methodology is to define the
Operational View Specifications. In this step, various options
pertaining to the IoT system deployment and operation are defined,
such as, service hosting options, storage options, device options,
application hosting options, etc
Step 9: Device & Component Integration
• The ninth step in the IoT design methodology is the integration of the
devices and components.
Step 10: Application Development
• The final step in the IoT design methodology is to develop the IoT
application.
Home Automation Case Study
Step:1 - Purpose & Requirements
• Applying this to our example of a smart home automation system, the
purpose and requirements for the system may be described as follows:
• Purpose : A home automation system that allows controlling of the lights in a home
remotely using a web application.
• Behavior : The home automation system should have auto and manual modes. In
auto mode, the system measures the light level in the room and switches on the
light when it gets dark. In manual mode, the system provides the option of manually
and remotely switching on/off the light.
• System Management Requirement : The system should provide remote monitoring
and control functions.
• Data Analysis Requirement : The system should perform local analysis of the data.
• Application Deployment Requirement : The application should be deployed locally
on the device, but should be accessible remotely.
• Security Requirement : The system should have basic user authentication capability.
Step:2 - Process Specification
Step 3: Domain Model Specification
Step 4: Information Model Specification
Step 5: Service Specifications
Step 5: Service Specifications
Step 6: IoT Level Specification
Step 7: Functional View Specification
Step 8: Operational View Specification
Step 9: Device & Component Integration
Step 10: Application Development
• Auto
• Controls the light appliance automatically based on the lighting
conditions in the room
• Light
• When Auto mode is off, it is used for manually controlling the
light appliance.
• When Auto mode is on, it reflects the current state of the light
appliance.
Implementation: RESTful Web Services
# Models – models.py
from django.db import models
class Mode(models.Model):
name = models.CharField(max_length=50)
class State(models.Model):
name = models.CharField(max_length=50)
# Serializers – serializers.py
from myapp.models import Mode, State
from rest_framework import serializers
class ModeSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Mode
fields = ('url', 'name')
class StateSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = State
fields = ('url', 'name')
REST services implemented with Django REST Framework
1. Map services to models. Model
fields store the states (on/off,
auto/manual)
2. Write Model serializers. Serializers allow
complex data (such as model instances) to be
converted to native Python datatypes that can
then be easily rendered into JSON, XML or
other content types.
Implementation: RESTful Web Services
# Views – views.py
from myapp.models import Mode, State
from rest_framework import viewsets
from myapp.serializers import ModeSerializer, StateSerializer
class ModeViewSet(viewsets.ModelViewSet):
queryset = Mode.objects.all()
serializer_class = ModeSerializer
class StateViewSet(viewsets.ModelViewSet):
queryset = State.objects.all()
serializer_class = StateSerializer
3. Write ViewSets for the Models which
combine the logic for a set of related views in
a single class.
# Models – models.py
from django.db import models
class Mode(models.Model):
name = models.CharField(max_length=50)
class State(models.Model):
name = models.CharField(max_length=50)
4. Write URL patterns for the services.
Since ViewSets are used instead of views, we
can automatically generate the URL conf by
simply registering the viewsets with a router
class.
Routers automatically determining how the
URLs for an application should be mapped to
the logic that deals with handling incoming
requests.
# URL Patterns – urls.py
from django.conf.urls import patterns, include, url
from django.contrib import admin
from rest_framework import routers
from myapp import views
admin.autodiscover()
router = routers.DefaultRouter()
router.register(r'mode', views.ModeViewSet)
router.register(r'state', views.StateViewSet)
urlpatterns = patterns('',
url(r'^', include(router.urls)),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
url(r'^admin/', include(admin.site.urls)),
url(r'^home/', 'myapp.views.home'),
)
Implementation: RESTful Web Services
Screenshot of browsable
State REST API
Screenshot of browsable
Mode REST API
Implementation: Controller Native Service
#Controller service
import RPi.GPIO as GPIO
import time
import sqlite3 as lite
import sys
con = lite.connect('database.sqlite')
cur = con.cursor()
GPIO.setmode(GPIO.BCM)
threshold = 1000
LDR_PIN = 18
LIGHT_PIN = 25
def readldr(PIN):
reading=0
GPIO.setup(PIN, GPIO.OUT)
GPIO.output(PIN, GPIO.LOW)
time.sleep(0.1)
GPIO.setup(PIN, GPIO.IN)
while (GPIO.input(PIN)==GPIO.LOW):
reading=reading+1
return reading
def switchOnLight(PIN):
GPIO.setup(PIN, GPIO.OUT)
GPIO.output(PIN, GPIO.HIGH)
def switchOffLight(PIN):
GPIO.setup(PIN, GPIO.OUT)
GPIO.output(PIN, GPIO.LOW)
def runAutoMode():
ldr_reading = readldr(LDR_PIN)
if ldr_reading < threshold:
switchOnLight(LIGHT_PIN)
setCurrentState('on')
else:
switchOffLight(LIGHT_PIN)
setCurrentState('off')
def runManualMode():
state = getCurrentState()
if state=='on':
switchOnLight(LIGHT_PIN)
setCurrentState('on')
elif state=='off':
switchOffLight(LIGHT_PIN)
setCurrentState('off')
def getCurrentMode():
cur.execute('SELECT * FROM myapp_mode')
data = cur.fetchone() #(1, u'auto')
return data[1]
def getCurrentState():
cur.execute('SELECT * FROM myapp_state')
data = cur.fetchone() #(1, u'on')
return data[1]
def setCurrentState(val):
query='UPDATE myapp_state set name="'+val+'"'
cur.execute(query)
while True:
currentMode=getCurrentMode()
if currentMode=='auto':
runAutoMode()
elif currentMode=='manual':
runManualMode()
time.sleep(5)
Native service deployed locally
1. Implement the native service in
Python and run on the device
Implementation: Application
# Views – views.py
def home(request):
out=‘’
if 'on' in request.POST:
values = {"name": "on"}
r=requests.put('http://127.0.0.1:8000/state/1/', data=values, auth=(‘username', ‘password'))
result=r.text
output = json.loads(result)
out=output['name']
if 'off' in request.POST:
values = {"name": "off"}
r=requests.put('http://127.0.0.1:8000/state/1/', data=values, auth=(‘username', ‘password'))
result=r.text
output = json.loads(result)
out=output['name']
if 'auto' in request.POST:
values = {"name": "auto"}
r=requests.put('http://127.0.0.1:8000/mode/1/', data=values, auth=(‘username', ‘password'))
result=r.text
output = json.loads(result)
out=output['name']
if 'manual' in request.POST:
values = {"name": "manual"}
r=requests.put('http://127.0.0.1:8000/mode/1/', data=values, auth=(‘username', ‘password'))
result=r.text
output = json.loads(result)
out=output['name']
r=requests.get('http://127.0.0.1:8000/mode/1/', auth=(‘username', ‘password'))
result=r.text
output = json.loads(result)
currentmode=output['name']
r=requests.get('http://127.0.0.1:8000/state/1/', auth=(‘username', ‘password'))
result=r.text
output = json.loads(result)
currentstate=output['name']
return render_to_response('lights.html',{'r':out, 'currentmode':currentmode, 'currentstate':currentstate},
context_instance=RequestContext(request))
1. Implement Django Application View
Implementation: Application
<div class="app-content-inner">
<fieldset>
<div class="field clearfix">
<label class="input-label icon-lamp" for="lamp-state">Auto</label>
<input id="lamp-state" class="input js-lamp-state hidden" type="checkbox">
{% if currentmode == 'auto' %}
<div class="js-lamp-state-toggle ui-toggle " data-toggle=".js-lamp-state">
{% else %}
<div class="js-lamp-state-toggle ui-toggle js-toggle-off" data-toggle=".js-lamp-state">
{% endif %}
<span class="ui-toggle-slide clearfix">
<form id="my_form11" action="" method="post">{% csrf_token %}
<input name="auto" value="auto" type="hidden" />
<a href="#" onclick="$(this).closest('form').submit()"><strong class="ui-toggle-off">OFF</strong></a>
</form>
<strong class="ui-toggle-handle brushed-metal"></strong>
<form id="my_form13" action="" method="post">{% csrf_token %}
<input name="manual" value="manual" type="hidden" />
<a href="#" onclick="$(this).closest('form').submit()"><strong class="ui-toggle-on">ON</strong></a>
</form></span>
</div></div>
<div class="field clearfix">
<label class="input-label icon-lamp" for="tv-state">Light</label>
<input id="tv-state" class="input js-tv-state hidden" type="checkbox">
{% if currentstate == 'on' %}
<div class="js-tv-state-toggle ui-toggle " data-toggle=".js-tv-state">
{% else %}
<div class="js-tv-state-toggle ui-toggle js-toggle-off" data-toggle=".js-tv-state">
{% endif %}
{% if currentmode == 'manual' %}
<span class="ui-toggle-slide clearfix">
<form id="my_form2" action="" method="post">{% csrf_token %}
<input name="on" value="on" type="hidden" />
<a href="#" onclick="$(this).closest('form').submit()"><strong class="ui-toggle-off">OFF</strong></a>
</form>
<strong class="ui-toggle-handle brushed-metal"></strong>
<form id="my_form3" action="" method="post">{% csrf_token %}
<input name="off" value="off" type="hidden" />
<a href="#" onclick="$(this).closest('form').submit()"><strong class="ui-toggle-on">ON</strong></a>
</form>
</span>
{% endif %}
{% if currentmode == 'auto' %}
{% if currentstate == 'on' %}
<strong class="ui-toggle-on">&nbsp;&nbsp;&nbsp;&nbsp;ON</strong>
{% else %}
<strong class="ui-toggle-on">&nbsp;&nbsp;&nbsp;&nbsp;OFF</strong>
{% endif %}{% endif %}
</div>
</div>
</fieldset></div></div></div>
2. Implement Django Application
Template
Finally - Integrate the System
Django Application
REST services implemented with Django-REST framework
Native service implemented in Python
SQLite Database
Raspberry Pi device to which sensors and actuators are connected
OS running on Raspberry Pi
• Setup the device
• Deploy and run the REST and Native services
• Deploy and run the Application
• Setup the database

Contenu connexe

Tendances

RFID based Attendance System
RFID based Attendance SystemRFID based Attendance System
RFID based Attendance System
Edgefxkits & Solutions
 
Domain specific IoT
Domain specific IoTDomain specific IoT
Domain specific IoT
Lippo Group Digital
 
IOT Platform Design Methodology
IOT Platform Design Methodology IOT Platform Design Methodology
IOT Platform Design Methodology
poonam kumawat
 
Iot based health monitoring system
Iot based health monitoring systemIot based health monitoring system
Iot based health monitoring system
ShaswataMohanta
 
CoAP - Web Protocol for IoT
CoAP - Web Protocol for IoTCoAP - Web Protocol for IoT
CoAP - Web Protocol for IoT
Aniruddha Chakrabarti
 
Tutorial on IEEE 802.15.4e standard
Tutorial on IEEE 802.15.4e standardTutorial on IEEE 802.15.4e standard
Tutorial on IEEE 802.15.4e standard
Giuseppe Anastasi
 
IoT Cloud architecture
IoT Cloud architectureIoT Cloud architecture
IoT Cloud architecture
MachinePulse
 
Smart Home Using IOT simulation In cisco packet tracer
Smart Home Using IOT simulation In cisco packet tracerSmart Home Using IOT simulation In cisco packet tracer
Smart Home Using IOT simulation In cisco packet tracer
KhyathiNandankumar
 
Chapter 3 Charateristics and Quality Attributes of Embedded System
Chapter 3 Charateristics and Quality Attributes of Embedded SystemChapter 3 Charateristics and Quality Attributes of Embedded System
Chapter 3 Charateristics and Quality Attributes of Embedded System
Moe Moe Myint
 
Introduction to IoT Architectures and Protocols
Introduction to IoT Architectures and ProtocolsIntroduction to IoT Architectures and Protocols
Introduction to IoT Architectures and Protocols
Abdullah Alfadhly
 
Embedded Systems and IoT
Embedded Systems and IoTEmbedded Systems and IoT
Embedded Systems and IoT
Dr. Shivananda Koteshwar
 
SDN( Software Defined Network) and NFV(Network Function Virtualization) for I...
SDN( Software Defined Network) and NFV(Network Function Virtualization) for I...SDN( Software Defined Network) and NFV(Network Function Virtualization) for I...
SDN( Software Defined Network) and NFV(Network Function Virtualization) for I...
Sagar Rai
 
IoT sensing and actuation
IoT sensing and actuationIoT sensing and actuation
IoT sensing and actuation
Hitesh Mohapatra
 
IOT PROTOCOLS.pptx
IOT PROTOCOLS.pptxIOT PROTOCOLS.pptx
IOT PROTOCOLS.pptx
DRREC
 
Internet of Things and its applications
Internet of Things and its applicationsInternet of Things and its applications
Internet of Things and its applications
Pasquale Puzio
 
Lecture 15
Lecture 15Lecture 15
Lecture 15
vishal choudhary
 
Cloud of things (IoT + Cloud Computing)
Cloud of things (IoT + Cloud Computing)Cloud of things (IoT + Cloud Computing)
Cloud of things (IoT + Cloud Computing)
Zakaria Hossain
 
netconf and yang
netconf and yangnetconf and yang
netconf and yang
pavan penugonda
 
LoRaWAN in Depth
LoRaWAN in DepthLoRaWAN in Depth
LoRaWAN in Depth
APNIC
 
Chapter 7
Chapter 7Chapter 7
Chapter 7
pavan penugonda
 

Tendances (20)

RFID based Attendance System
RFID based Attendance SystemRFID based Attendance System
RFID based Attendance System
 
Domain specific IoT
Domain specific IoTDomain specific IoT
Domain specific IoT
 
IOT Platform Design Methodology
IOT Platform Design Methodology IOT Platform Design Methodology
IOT Platform Design Methodology
 
Iot based health monitoring system
Iot based health monitoring systemIot based health monitoring system
Iot based health monitoring system
 
CoAP - Web Protocol for IoT
CoAP - Web Protocol for IoTCoAP - Web Protocol for IoT
CoAP - Web Protocol for IoT
 
Tutorial on IEEE 802.15.4e standard
Tutorial on IEEE 802.15.4e standardTutorial on IEEE 802.15.4e standard
Tutorial on IEEE 802.15.4e standard
 
IoT Cloud architecture
IoT Cloud architectureIoT Cloud architecture
IoT Cloud architecture
 
Smart Home Using IOT simulation In cisco packet tracer
Smart Home Using IOT simulation In cisco packet tracerSmart Home Using IOT simulation In cisco packet tracer
Smart Home Using IOT simulation In cisco packet tracer
 
Chapter 3 Charateristics and Quality Attributes of Embedded System
Chapter 3 Charateristics and Quality Attributes of Embedded SystemChapter 3 Charateristics and Quality Attributes of Embedded System
Chapter 3 Charateristics and Quality Attributes of Embedded System
 
Introduction to IoT Architectures and Protocols
Introduction to IoT Architectures and ProtocolsIntroduction to IoT Architectures and Protocols
Introduction to IoT Architectures and Protocols
 
Embedded Systems and IoT
Embedded Systems and IoTEmbedded Systems and IoT
Embedded Systems and IoT
 
SDN( Software Defined Network) and NFV(Network Function Virtualization) for I...
SDN( Software Defined Network) and NFV(Network Function Virtualization) for I...SDN( Software Defined Network) and NFV(Network Function Virtualization) for I...
SDN( Software Defined Network) and NFV(Network Function Virtualization) for I...
 
IoT sensing and actuation
IoT sensing and actuationIoT sensing and actuation
IoT sensing and actuation
 
IOT PROTOCOLS.pptx
IOT PROTOCOLS.pptxIOT PROTOCOLS.pptx
IOT PROTOCOLS.pptx
 
Internet of Things and its applications
Internet of Things and its applicationsInternet of Things and its applications
Internet of Things and its applications
 
Lecture 15
Lecture 15Lecture 15
Lecture 15
 
Cloud of things (IoT + Cloud Computing)
Cloud of things (IoT + Cloud Computing)Cloud of things (IoT + Cloud Computing)
Cloud of things (IoT + Cloud Computing)
 
netconf and yang
netconf and yangnetconf and yang
netconf and yang
 
LoRaWAN in Depth
LoRaWAN in DepthLoRaWAN in Depth
LoRaWAN in Depth
 
Chapter 7
Chapter 7Chapter 7
Chapter 7
 

Similaire à [PPT] _ Unit 2 _ 9.0 _ Domain Specific IoT _Home Automation.pdf

IoT Methodology.pptx
IoT Methodology.pptxIoT Methodology.pptx
IOT Unit 3 for engineering second year .pptx
IOT Unit 3 for engineering second year .pptxIOT Unit 3 for engineering second year .pptx
IOT Unit 3 for engineering second year .pptx
neelamsanjeevkumar
 
iot_application_casestudies.pptx
iot_application_casestudies.pptxiot_application_casestudies.pptx
iot_application_casestudies.pptx
jainam bhavsar
 
IoTES Unit 3 ppt.pptx
IoTES Unit 3 ppt.pptxIoTES Unit 3 ppt.pptx
IoTES Unit 3 ppt.pptx
samdamfa
 
Asp.Net MVC 5 in Arabic
Asp.Net MVC 5 in ArabicAsp.Net MVC 5 in Arabic
Asp.Net MVC 5 in Arabic
Haitham Shaddad
 
Unit 4 -IOT2.pptx
Unit 4 -IOT2.pptxUnit 4 -IOT2.pptx
Unit 4 -IOT2.pptx
NutanBhor
 
IRJET- MVC Framework: A Modern Web Application Development Approach and Working
IRJET- MVC Framework: A Modern Web Application Development Approach and WorkingIRJET- MVC Framework: A Modern Web Application Development Approach and Working
IRJET- MVC Framework: A Modern Web Application Development Approach and Working
IRJET Journal
 
Spring
SpringSpring
Spring
Janu Jahnavi
 
IoT.pptx
IoT.pptxIoT.pptx
IoT.pptx
sateeshka
 
Chapter 1 updated.pdf
Chapter 1 updated.pdfChapter 1 updated.pdf
Chapter 1 updated.pdf
YashWaghmare20
 
PPT-UEU-CSI-421-IOT-Pertemuan-3.pptx
PPT-UEU-CSI-421-IOT-Pertemuan-3.pptxPPT-UEU-CSI-421-IOT-Pertemuan-3.pptx
PPT-UEU-CSI-421-IOT-Pertemuan-3.pptx
shahid sultan
 
Chapter - 1.pptx
Chapter - 1.pptxChapter - 1.pptx
Chapter - 1.pptx
DrFaridaAshrafAli
 
spatial data infrastructure : data modelling and web services for data access
spatial data infrastructure : data modelling and web services for data accessspatial data infrastructure : data modelling and web services for data access
spatial data infrastructure : data modelling and web services for data access
Desconnets Jean-Christophe
 
IoT heap 1
IoT heap 1IoT heap 1
IoT heap 1
SushrutaMishra1
 
Get things done with Yii - quickly build webapplications
Get things done with Yii - quickly build webapplicationsGet things done with Yii - quickly build webapplications
Get things done with Yii - quickly build webapplications
Giuliano Iacobelli
 
Presenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View ControlPresenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View Control
Teamstudio
 
.NET Core, ASP.NET Core Course, Session 9
.NET Core, ASP.NET Core Course, Session 9.NET Core, ASP.NET Core Course, Session 9
.NET Core, ASP.NET Core Course, Session 9
aminmesbahi
 
ASP.NET MVC_Routing_Authentication_Aurhorization.pdf
ASP.NET MVC_Routing_Authentication_Aurhorization.pdfASP.NET MVC_Routing_Authentication_Aurhorization.pdf
ASP.NET MVC_Routing_Authentication_Aurhorization.pdf
setit72024
 
ASP.NET MVC 2.0
ASP.NET MVC 2.0ASP.NET MVC 2.0
ASP.NET MVC 2.0
Buu Nguyen
 
SAM-IoT: Model Based Methodology and Framework for Design and Management of N...
SAM-IoT: Model Based Methodology and Framework for Design and Management of N...SAM-IoT: Model Based Methodology and Framework for Design and Management of N...
SAM-IoT: Model Based Methodology and Framework for Design and Management of N...
Brain IoT Project
 

Similaire à [PPT] _ Unit 2 _ 9.0 _ Domain Specific IoT _Home Automation.pdf (20)

IoT Methodology.pptx
IoT Methodology.pptxIoT Methodology.pptx
IoT Methodology.pptx
 
IOT Unit 3 for engineering second year .pptx
IOT Unit 3 for engineering second year .pptxIOT Unit 3 for engineering second year .pptx
IOT Unit 3 for engineering second year .pptx
 
iot_application_casestudies.pptx
iot_application_casestudies.pptxiot_application_casestudies.pptx
iot_application_casestudies.pptx
 
IoTES Unit 3 ppt.pptx
IoTES Unit 3 ppt.pptxIoTES Unit 3 ppt.pptx
IoTES Unit 3 ppt.pptx
 
Asp.Net MVC 5 in Arabic
Asp.Net MVC 5 in ArabicAsp.Net MVC 5 in Arabic
Asp.Net MVC 5 in Arabic
 
Unit 4 -IOT2.pptx
Unit 4 -IOT2.pptxUnit 4 -IOT2.pptx
Unit 4 -IOT2.pptx
 
IRJET- MVC Framework: A Modern Web Application Development Approach and Working
IRJET- MVC Framework: A Modern Web Application Development Approach and WorkingIRJET- MVC Framework: A Modern Web Application Development Approach and Working
IRJET- MVC Framework: A Modern Web Application Development Approach and Working
 
Spring
SpringSpring
Spring
 
IoT.pptx
IoT.pptxIoT.pptx
IoT.pptx
 
Chapter 1 updated.pdf
Chapter 1 updated.pdfChapter 1 updated.pdf
Chapter 1 updated.pdf
 
PPT-UEU-CSI-421-IOT-Pertemuan-3.pptx
PPT-UEU-CSI-421-IOT-Pertemuan-3.pptxPPT-UEU-CSI-421-IOT-Pertemuan-3.pptx
PPT-UEU-CSI-421-IOT-Pertemuan-3.pptx
 
Chapter - 1.pptx
Chapter - 1.pptxChapter - 1.pptx
Chapter - 1.pptx
 
spatial data infrastructure : data modelling and web services for data access
spatial data infrastructure : data modelling and web services for data accessspatial data infrastructure : data modelling and web services for data access
spatial data infrastructure : data modelling and web services for data access
 
IoT heap 1
IoT heap 1IoT heap 1
IoT heap 1
 
Get things done with Yii - quickly build webapplications
Get things done with Yii - quickly build webapplicationsGet things done with Yii - quickly build webapplications
Get things done with Yii - quickly build webapplications
 
Presenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View ControlPresenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View Control
 
.NET Core, ASP.NET Core Course, Session 9
.NET Core, ASP.NET Core Course, Session 9.NET Core, ASP.NET Core Course, Session 9
.NET Core, ASP.NET Core Course, Session 9
 
ASP.NET MVC_Routing_Authentication_Aurhorization.pdf
ASP.NET MVC_Routing_Authentication_Aurhorization.pdfASP.NET MVC_Routing_Authentication_Aurhorization.pdf
ASP.NET MVC_Routing_Authentication_Aurhorization.pdf
 
ASP.NET MVC 2.0
ASP.NET MVC 2.0ASP.NET MVC 2.0
ASP.NET MVC 2.0
 
SAM-IoT: Model Based Methodology and Framework for Design and Management of N...
SAM-IoT: Model Based Methodology and Framework for Design and Management of N...SAM-IoT: Model Based Methodology and Framework for Design and Management of N...
SAM-IoT: Model Based Methodology and Framework for Design and Management of N...
 

Plus de Selvaraj Seerangan

Unit 2,3,4 _ Internet of Things A Hands-On Approach (Arshdeep Bahga, Vijay Ma...
Unit 2,3,4 _ Internet of Things A Hands-On Approach (Arshdeep Bahga, Vijay Ma...Unit 2,3,4 _ Internet of Things A Hands-On Approach (Arshdeep Bahga, Vijay Ma...
Unit 2,3,4 _ Internet of Things A Hands-On Approach (Arshdeep Bahga, Vijay Ma...
Selvaraj Seerangan
 
Unit 5 _ Fog Computing .pdf
Unit 5 _ Fog Computing .pdfUnit 5 _ Fog Computing .pdf
Unit 5 _ Fog Computing .pdf
Selvaraj Seerangan
 
CAT III Answer Key.pdf
CAT III Answer Key.pdfCAT III Answer Key.pdf
CAT III Answer Key.pdf
Selvaraj Seerangan
 
END SEM _ Design Thinking _ 16 Templates.pptx
END SEM _ Design Thinking _ 16 Templates.pptxEND SEM _ Design Thinking _ 16 Templates.pptx
END SEM _ Design Thinking _ 16 Templates.pptx
Selvaraj Seerangan
 
Design Thinking _ Complete Templates.pptx
Design Thinking _ Complete Templates.pptxDesign Thinking _ Complete Templates.pptx
Design Thinking _ Complete Templates.pptx
Selvaraj Seerangan
 
CAT 3 _ List of Templates.pptx
CAT 3 _ List of Templates.pptxCAT 3 _ List of Templates.pptx
CAT 3 _ List of Templates.pptx
Selvaraj Seerangan
 
[PPT] _ Unit 5 _ Evolve.pptx
[PPT] _ Unit 5 _ Evolve.pptx[PPT] _ Unit 5 _ Evolve.pptx
[PPT] _ Unit 5 _ Evolve.pptx
Selvaraj Seerangan
 
[PPT] _ Unit 4 _ Engage.pptx
[PPT] _ Unit 4 _ Engage.pptx[PPT] _ Unit 4 _ Engage.pptx
[PPT] _ Unit 4 _ Engage.pptx
Selvaraj Seerangan
 
[PPT] _ Unit 3 _ Experiment.pptx
[PPT] _ Unit 3 _ Experiment.pptx[PPT] _ Unit 3 _ Experiment.pptx
[PPT] _ Unit 3 _ Experiment.pptx
Selvaraj Seerangan
 
CAT 2 _ List of Templates.pptx
CAT 2 _ List of Templates.pptxCAT 2 _ List of Templates.pptx
CAT 2 _ List of Templates.pptx
Selvaraj Seerangan
 
Design Thinking - Empathize Phase
Design Thinking - Empathize PhaseDesign Thinking - Empathize Phase
Design Thinking - Empathize Phase
Selvaraj Seerangan
 
CAT-II Answer Key.pdf
CAT-II Answer Key.pdfCAT-II Answer Key.pdf
CAT-II Answer Key.pdf
Selvaraj Seerangan
 
PSP LAB MANUAL.pdf
PSP LAB MANUAL.pdfPSP LAB MANUAL.pdf
PSP LAB MANUAL.pdf
Selvaraj Seerangan
 
18CSL51 - Network Lab Manual.pdf
18CSL51 - Network Lab Manual.pdf18CSL51 - Network Lab Manual.pdf
18CSL51 - Network Lab Manual.pdf
Selvaraj Seerangan
 
DS LAB MANUAL.pdf
DS LAB MANUAL.pdfDS LAB MANUAL.pdf
DS LAB MANUAL.pdf
Selvaraj Seerangan
 
CAT 1 _ List of Templates.pptx
CAT 1 _ List of Templates.pptxCAT 1 _ List of Templates.pptx
CAT 1 _ List of Templates.pptx
Selvaraj Seerangan
 
[PPT] _ UNIT 1 _ COMPLETE.pptx
[PPT] _ UNIT 1 _ COMPLETE.pptx[PPT] _ UNIT 1 _ COMPLETE.pptx
[PPT] _ UNIT 1 _ COMPLETE.pptx
Selvaraj Seerangan
 
CAT-1 Answer Key.doc
CAT-1 Answer Key.docCAT-1 Answer Key.doc
CAT-1 Answer Key.doc
Selvaraj Seerangan
 
Unit 3 Complete.pptx
Unit 3 Complete.pptxUnit 3 Complete.pptx
Unit 3 Complete.pptx
Selvaraj Seerangan
 
[PPT] _ Unit 2 _ Complete PPT.pptx
[PPT] _ Unit 2 _ Complete PPT.pptx[PPT] _ Unit 2 _ Complete PPT.pptx
[PPT] _ Unit 2 _ Complete PPT.pptx
Selvaraj Seerangan
 

Plus de Selvaraj Seerangan (20)

Unit 2,3,4 _ Internet of Things A Hands-On Approach (Arshdeep Bahga, Vijay Ma...
Unit 2,3,4 _ Internet of Things A Hands-On Approach (Arshdeep Bahga, Vijay Ma...Unit 2,3,4 _ Internet of Things A Hands-On Approach (Arshdeep Bahga, Vijay Ma...
Unit 2,3,4 _ Internet of Things A Hands-On Approach (Arshdeep Bahga, Vijay Ma...
 
Unit 5 _ Fog Computing .pdf
Unit 5 _ Fog Computing .pdfUnit 5 _ Fog Computing .pdf
Unit 5 _ Fog Computing .pdf
 
CAT III Answer Key.pdf
CAT III Answer Key.pdfCAT III Answer Key.pdf
CAT III Answer Key.pdf
 
END SEM _ Design Thinking _ 16 Templates.pptx
END SEM _ Design Thinking _ 16 Templates.pptxEND SEM _ Design Thinking _ 16 Templates.pptx
END SEM _ Design Thinking _ 16 Templates.pptx
 
Design Thinking _ Complete Templates.pptx
Design Thinking _ Complete Templates.pptxDesign Thinking _ Complete Templates.pptx
Design Thinking _ Complete Templates.pptx
 
CAT 3 _ List of Templates.pptx
CAT 3 _ List of Templates.pptxCAT 3 _ List of Templates.pptx
CAT 3 _ List of Templates.pptx
 
[PPT] _ Unit 5 _ Evolve.pptx
[PPT] _ Unit 5 _ Evolve.pptx[PPT] _ Unit 5 _ Evolve.pptx
[PPT] _ Unit 5 _ Evolve.pptx
 
[PPT] _ Unit 4 _ Engage.pptx
[PPT] _ Unit 4 _ Engage.pptx[PPT] _ Unit 4 _ Engage.pptx
[PPT] _ Unit 4 _ Engage.pptx
 
[PPT] _ Unit 3 _ Experiment.pptx
[PPT] _ Unit 3 _ Experiment.pptx[PPT] _ Unit 3 _ Experiment.pptx
[PPT] _ Unit 3 _ Experiment.pptx
 
CAT 2 _ List of Templates.pptx
CAT 2 _ List of Templates.pptxCAT 2 _ List of Templates.pptx
CAT 2 _ List of Templates.pptx
 
Design Thinking - Empathize Phase
Design Thinking - Empathize PhaseDesign Thinking - Empathize Phase
Design Thinking - Empathize Phase
 
CAT-II Answer Key.pdf
CAT-II Answer Key.pdfCAT-II Answer Key.pdf
CAT-II Answer Key.pdf
 
PSP LAB MANUAL.pdf
PSP LAB MANUAL.pdfPSP LAB MANUAL.pdf
PSP LAB MANUAL.pdf
 
18CSL51 - Network Lab Manual.pdf
18CSL51 - Network Lab Manual.pdf18CSL51 - Network Lab Manual.pdf
18CSL51 - Network Lab Manual.pdf
 
DS LAB MANUAL.pdf
DS LAB MANUAL.pdfDS LAB MANUAL.pdf
DS LAB MANUAL.pdf
 
CAT 1 _ List of Templates.pptx
CAT 1 _ List of Templates.pptxCAT 1 _ List of Templates.pptx
CAT 1 _ List of Templates.pptx
 
[PPT] _ UNIT 1 _ COMPLETE.pptx
[PPT] _ UNIT 1 _ COMPLETE.pptx[PPT] _ UNIT 1 _ COMPLETE.pptx
[PPT] _ UNIT 1 _ COMPLETE.pptx
 
CAT-1 Answer Key.doc
CAT-1 Answer Key.docCAT-1 Answer Key.doc
CAT-1 Answer Key.doc
 
Unit 3 Complete.pptx
Unit 3 Complete.pptxUnit 3 Complete.pptx
Unit 3 Complete.pptx
 
[PPT] _ Unit 2 _ Complete PPT.pptx
[PPT] _ Unit 2 _ Complete PPT.pptx[PPT] _ Unit 2 _ Complete PPT.pptx
[PPT] _ Unit 2 _ Complete PPT.pptx
 

Dernier

Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
AjmalKhan50578
 
Data Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptxData Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptx
ramrag33
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
GauravCar
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
RamonNovais6
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
LAXMAREDDY22
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
Anant Corporation
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
riddhimaagrawal986
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
SakkaravarthiShanmug
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
bjmsejournal
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 

Dernier (20)

Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
 
Data Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptxData Control Language.pptx Data Control Language.pptx
Data Control Language.pptx Data Control Language.pptx
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 

[PPT] _ Unit 2 _ 9.0 _ Domain Specific IoT _Home Automation.pdf

  • 1. Chapter 5 IoT Design Methodology Bahga & Madisetti, © 2015 Book website: http://www.internet-of-things-book.com
  • 2. Outline • IoT Design Methodology that includes: • Purpose & Requirements Specification • Process Specification • Domain Model Specification • Information Model Specification • Service Specifications • IoT Level Specification • Functional View Specification • Operational View Specification • Device & Component Integration • Application Development Bahga & Madisetti, © 2015 Book website: http://www.internet-of-things-book.com
  • 4. Step 1: Purpose & Requirements Specification • The first step in IoT system design methodology is to define the purpose and requirements of the system. In this step, the system purpose, behavior and requirements (such as data collection requirements, data analysis requirements, system management requirements, data privacy and security requirements, user interface requirements, ...) are captured.
  • 5. Step 2: Process Specification • The second step in the IoT design methodology is to define the process specification. In this step, the use cases of the IoT system are formally described based on and derived from the purpose and requirement specifications.
  • 6. Step 3: Domain Model Specification • The third step in the IoT design methodology is to define the Domain Model. The domain model describes the main concepts, entities and objects in the domain of IoT system to be designed. Domain model defines the attributes of the objects and relationships between objects. Domain model provides an abstract representation of the concepts, objects and entities in the IoT domain, independent of any specific technology or platform. With the domain model, the IoT system designers can get an understanding of the IoT domain for which the system is to be designed.
  • 7. Step 4: Information Model Specification • The fourth step in the IoT design methodology is to define the Information Model. Information Model defines the structure of all the information in the IoT system, for example, attributes of Virtual Entities, relations, etc. Information model does not describe the specifics of how the information is represented or stored. To define the information model, we first list the Virtual Entities defined in the Domain Model. Information model adds more details to the Virtual Entities by defining their attributes and relations.
  • 8. Step 5: Service Specifications • The fifth step in the IoT design methodology is to define the service specifications. Service specifications define the services in the IoT system, service types, service inputs/output, service endpoints, service schedules, service preconditions and service effects.
  • 9. Step 6: IoT Level Specification • The sixth step in the IoT design methodology is to define the IoT level for the system. In Chapter-1, we defined five IoT deployment levels.
  • 10. Step 7: Functional View Specification • The seventh step in the IoT design methodology is to define the Functional View. The Functional View (FV) defines the functions of the IoT systems grouped into various Functional Groups (FGs). Each Functional Group either provides functionalities for interacting with instances of concepts defined in the Domain Model or provides information related to these concepts.
  • 11. Step 8: Operational View Specification • The eighth step in the IoT design methodology is to define the Operational View Specifications. In this step, various options pertaining to the IoT system deployment and operation are defined, such as, service hosting options, storage options, device options, application hosting options, etc
  • 12. Step 9: Device & Component Integration • The ninth step in the IoT design methodology is the integration of the devices and components.
  • 13. Step 10: Application Development • The final step in the IoT design methodology is to develop the IoT application.
  • 15. Step:1 - Purpose & Requirements • Applying this to our example of a smart home automation system, the purpose and requirements for the system may be described as follows: • Purpose : A home automation system that allows controlling of the lights in a home remotely using a web application. • Behavior : The home automation system should have auto and manual modes. In auto mode, the system measures the light level in the room and switches on the light when it gets dark. In manual mode, the system provides the option of manually and remotely switching on/off the light. • System Management Requirement : The system should provide remote monitoring and control functions. • Data Analysis Requirement : The system should perform local analysis of the data. • Application Deployment Requirement : The application should be deployed locally on the device, but should be accessible remotely. • Security Requirement : The system should have basic user authentication capability.
  • 16. Step:2 - Process Specification
  • 17. Step 3: Domain Model Specification
  • 18. Step 4: Information Model Specification
  • 19. Step 5: Service Specifications
  • 20. Step 5: Service Specifications
  • 21. Step 6: IoT Level Specification
  • 22. Step 7: Functional View Specification
  • 23. Step 8: Operational View Specification
  • 24. Step 9: Device & Component Integration
  • 25. Step 10: Application Development • Auto • Controls the light appliance automatically based on the lighting conditions in the room • Light • When Auto mode is off, it is used for manually controlling the light appliance. • When Auto mode is on, it reflects the current state of the light appliance.
  • 26. Implementation: RESTful Web Services # Models – models.py from django.db import models class Mode(models.Model): name = models.CharField(max_length=50) class State(models.Model): name = models.CharField(max_length=50) # Serializers – serializers.py from myapp.models import Mode, State from rest_framework import serializers class ModeSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Mode fields = ('url', 'name') class StateSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = State fields = ('url', 'name') REST services implemented with Django REST Framework 1. Map services to models. Model fields store the states (on/off, auto/manual) 2. Write Model serializers. Serializers allow complex data (such as model instances) to be converted to native Python datatypes that can then be easily rendered into JSON, XML or other content types.
  • 27. Implementation: RESTful Web Services # Views – views.py from myapp.models import Mode, State from rest_framework import viewsets from myapp.serializers import ModeSerializer, StateSerializer class ModeViewSet(viewsets.ModelViewSet): queryset = Mode.objects.all() serializer_class = ModeSerializer class StateViewSet(viewsets.ModelViewSet): queryset = State.objects.all() serializer_class = StateSerializer 3. Write ViewSets for the Models which combine the logic for a set of related views in a single class. # Models – models.py from django.db import models class Mode(models.Model): name = models.CharField(max_length=50) class State(models.Model): name = models.CharField(max_length=50) 4. Write URL patterns for the services. Since ViewSets are used instead of views, we can automatically generate the URL conf by simply registering the viewsets with a router class. Routers automatically determining how the URLs for an application should be mapped to the logic that deals with handling incoming requests. # URL Patterns – urls.py from django.conf.urls import patterns, include, url from django.contrib import admin from rest_framework import routers from myapp import views admin.autodiscover() router = routers.DefaultRouter() router.register(r'mode', views.ModeViewSet) router.register(r'state', views.StateViewSet) urlpatterns = patterns('', url(r'^', include(router.urls)), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), url(r'^admin/', include(admin.site.urls)), url(r'^home/', 'myapp.views.home'), )
  • 28. Implementation: RESTful Web Services Screenshot of browsable State REST API Screenshot of browsable Mode REST API
  • 29. Implementation: Controller Native Service #Controller service import RPi.GPIO as GPIO import time import sqlite3 as lite import sys con = lite.connect('database.sqlite') cur = con.cursor() GPIO.setmode(GPIO.BCM) threshold = 1000 LDR_PIN = 18 LIGHT_PIN = 25 def readldr(PIN): reading=0 GPIO.setup(PIN, GPIO.OUT) GPIO.output(PIN, GPIO.LOW) time.sleep(0.1) GPIO.setup(PIN, GPIO.IN) while (GPIO.input(PIN)==GPIO.LOW): reading=reading+1 return reading def switchOnLight(PIN): GPIO.setup(PIN, GPIO.OUT) GPIO.output(PIN, GPIO.HIGH) def switchOffLight(PIN): GPIO.setup(PIN, GPIO.OUT) GPIO.output(PIN, GPIO.LOW) def runAutoMode(): ldr_reading = readldr(LDR_PIN) if ldr_reading < threshold: switchOnLight(LIGHT_PIN) setCurrentState('on') else: switchOffLight(LIGHT_PIN) setCurrentState('off') def runManualMode(): state = getCurrentState() if state=='on': switchOnLight(LIGHT_PIN) setCurrentState('on') elif state=='off': switchOffLight(LIGHT_PIN) setCurrentState('off') def getCurrentMode(): cur.execute('SELECT * FROM myapp_mode') data = cur.fetchone() #(1, u'auto') return data[1] def getCurrentState(): cur.execute('SELECT * FROM myapp_state') data = cur.fetchone() #(1, u'on') return data[1] def setCurrentState(val): query='UPDATE myapp_state set name="'+val+'"' cur.execute(query) while True: currentMode=getCurrentMode() if currentMode=='auto': runAutoMode() elif currentMode=='manual': runManualMode() time.sleep(5) Native service deployed locally 1. Implement the native service in Python and run on the device
  • 30. Implementation: Application # Views – views.py def home(request): out=‘’ if 'on' in request.POST: values = {"name": "on"} r=requests.put('http://127.0.0.1:8000/state/1/', data=values, auth=(‘username', ‘password')) result=r.text output = json.loads(result) out=output['name'] if 'off' in request.POST: values = {"name": "off"} r=requests.put('http://127.0.0.1:8000/state/1/', data=values, auth=(‘username', ‘password')) result=r.text output = json.loads(result) out=output['name'] if 'auto' in request.POST: values = {"name": "auto"} r=requests.put('http://127.0.0.1:8000/mode/1/', data=values, auth=(‘username', ‘password')) result=r.text output = json.loads(result) out=output['name'] if 'manual' in request.POST: values = {"name": "manual"} r=requests.put('http://127.0.0.1:8000/mode/1/', data=values, auth=(‘username', ‘password')) result=r.text output = json.loads(result) out=output['name'] r=requests.get('http://127.0.0.1:8000/mode/1/', auth=(‘username', ‘password')) result=r.text output = json.loads(result) currentmode=output['name'] r=requests.get('http://127.0.0.1:8000/state/1/', auth=(‘username', ‘password')) result=r.text output = json.loads(result) currentstate=output['name'] return render_to_response('lights.html',{'r':out, 'currentmode':currentmode, 'currentstate':currentstate}, context_instance=RequestContext(request)) 1. Implement Django Application View
  • 31. Implementation: Application <div class="app-content-inner"> <fieldset> <div class="field clearfix"> <label class="input-label icon-lamp" for="lamp-state">Auto</label> <input id="lamp-state" class="input js-lamp-state hidden" type="checkbox"> {% if currentmode == 'auto' %} <div class="js-lamp-state-toggle ui-toggle " data-toggle=".js-lamp-state"> {% else %} <div class="js-lamp-state-toggle ui-toggle js-toggle-off" data-toggle=".js-lamp-state"> {% endif %} <span class="ui-toggle-slide clearfix"> <form id="my_form11" action="" method="post">{% csrf_token %} <input name="auto" value="auto" type="hidden" /> <a href="#" onclick="$(this).closest('form').submit()"><strong class="ui-toggle-off">OFF</strong></a> </form> <strong class="ui-toggle-handle brushed-metal"></strong> <form id="my_form13" action="" method="post">{% csrf_token %} <input name="manual" value="manual" type="hidden" /> <a href="#" onclick="$(this).closest('form').submit()"><strong class="ui-toggle-on">ON</strong></a> </form></span> </div></div> <div class="field clearfix"> <label class="input-label icon-lamp" for="tv-state">Light</label> <input id="tv-state" class="input js-tv-state hidden" type="checkbox"> {% if currentstate == 'on' %} <div class="js-tv-state-toggle ui-toggle " data-toggle=".js-tv-state"> {% else %} <div class="js-tv-state-toggle ui-toggle js-toggle-off" data-toggle=".js-tv-state"> {% endif %} {% if currentmode == 'manual' %} <span class="ui-toggle-slide clearfix"> <form id="my_form2" action="" method="post">{% csrf_token %} <input name="on" value="on" type="hidden" /> <a href="#" onclick="$(this).closest('form').submit()"><strong class="ui-toggle-off">OFF</strong></a> </form> <strong class="ui-toggle-handle brushed-metal"></strong> <form id="my_form3" action="" method="post">{% csrf_token %} <input name="off" value="off" type="hidden" /> <a href="#" onclick="$(this).closest('form').submit()"><strong class="ui-toggle-on">ON</strong></a> </form> </span> {% endif %} {% if currentmode == 'auto' %} {% if currentstate == 'on' %} <strong class="ui-toggle-on">&nbsp;&nbsp;&nbsp;&nbsp;ON</strong> {% else %} <strong class="ui-toggle-on">&nbsp;&nbsp;&nbsp;&nbsp;OFF</strong> {% endif %}{% endif %} </div> </div> </fieldset></div></div></div> 2. Implement Django Application Template
  • 32. Finally - Integrate the System Django Application REST services implemented with Django-REST framework Native service implemented in Python SQLite Database Raspberry Pi device to which sensors and actuators are connected OS running on Raspberry Pi • Setup the device • Deploy and run the REST and Native services • Deploy and run the Application • Setup the database