Iot Step Material
Iot Step Material
UNIT I
Short Answer
1. Define Iot?
The internet of things (IoT) is a computing concept that describes the idea of everyday physical objects being
connected to the internet and being able to identify themselves to other devices. It has dynamic global network
infrastructure with self-configuring capabilities based on standard and interoperable communication protocols where
physical and virtual “things” have identities, physical attributes and virtual network and use intelligent interfaces.
2. List of Iot protocols?
Link Layer
802.3 – Ethernet,802.11 – WiFi ,802.16 – WiMax ,802.15.4 – LR-WPAN,2G/3G/4G
Network/Internet Layer
IPv4,IPv6,6LoWPAN
Transport Layer
TCP,UDP
Application Layer
HTTP, CoAP ,WebSocket ,MQTT,XMPP,DDS,AMQP
Dynamic and Self-Adapting:- IoT devices and system may have the capability to change dynamically depending upon the
system and operating conditions or sensed environment. For example, the surveillance cameras can change their modes
based on day or night
Self-configuring:- IoT devices have self-configuring capability which allows large number of devices to work together to
work provide certain functionality they can change their networking and update the software automatically.
Interoperable Communication Protocol: - IoT devices can communicate with number of interoperable (communicate
with other devices without special effort) communication protocols.
Unique ID: - IoT devices have a unique identity differentiated with unique IP address.
Integrated into Information Network: - IoT devices are integrated into the information network that allows them to
communicate and exchange data with other devices and system.
An IoT device may consist of several interfaces for connections to other devices, both wired and wireless.
1. I/O interfaces for sensors
2. Interfaces for Internet connectivity
3. Memory and storage interfaces
4. Audio/video interfaces
2.List Iot communication model with diagrams?
1. Request-Response communication model
2. Publish-Subscribe communication model
3. Push-Pull communication model
4. Exclusive Pair communication model
Request-response communication model
Request-Response is a communication model in which the client sends requests to the server and the server
responds to the requests.
When the server receives a request, it decides how to respond, fetches the data, retrieves resource
representations, prepares the response, and then sends the response to the client.
Push-Pull is a communication model in which the data producers push the data to queues and the consumers
pull the data from the queues. Producers do not need to be aware of the consumers.
Queues help in decoupling the messaging between the producers and consumers.
Queues also act as a buffer which helps in situations when there is a mismatch between the rate at which the
producers push data and the rate rate at which the consumers pull data
Exclusive Pair communication model
Exclusive Pair is a bidirectional, fully duplex communication model that uses a persistent connection between
the client and server.
Once the connection is setup it remains open until the client sends a request to close the connection.
Client and server can send messages to each other after connection setup.
1. Database: Database can be either local or in the cloud and stores the data generated by the IoT device.
2. Web Service: Web services serve as a link between the IoT device, application, database and analysis components.
Web service can be either implemented using HTTP and REST principles (REST service) or using WebSocket
protocol (Web Socket service).
3. Analysis Component: The Analysis Component is responsible for analyzing the IoT data and generate results in
a form which are easy for the user to understand.
4. Application: IoT applications provide an interface that the users can use to control and monitor various aspects of
the IoT system. Applications also allow users to view the system status and view the processed data.
level-1
1. A level-1 IoT system has a single node/device that performs sensing and/or actuation, stores data, performs
analysis and hosts the application
2. Level-1 IoT systems are suitable for modeling low-cost and low-complexity solutions where the data
involved is not big and the analysis requirements are not computationally intensive.
Iot level-2
A level-2 IoT system has a single node that performs sensing and/or actuation and local analysis.
Data is stored in the cloud and application is usually cloud-based.
Level-2 IoT systems are suitable for solutions where the data involved is big, however, the primary analysis
requirement is not computationally intensive and can be done locally itself.
Iot level-3
A level-3 IoT system has a single node. Data is stored and analyzed in the cloud and application is cloud-
based.
Level-3 IoT systems are suitable for solutions where the data involved is big and the analysis requirements
are computationally intensive.
Iot level-4
A level-4 IoT system has multiple nodes that perform local analysis. Data is stored in the cloud and application
is cloud-based.
Level-4 contains local and cloud-based observer nodes which can subscribe to and receive information
collected in the cloud from IoT devices.
Level-4 IoT systems are suitable for solutions where multiple nodes are required, the data involved is big and
the analysis requirements are computationally intensive.
Iot level-5
A level-5 IoT system has multiple end nodes and one coordinator node.
The end nodes that perform sensing and/or actuation.
Coordinator node collects data from the end nodes and sends to the cloud.
Data is stored and analyzed in the cloud and application is cloud-based.
Level-5 IoT systems are suitable for solutions based on wireless sensor networks, in which the data involved
is big and the analysis requirements are computationally intensive.
IoT Level-6
A level-6 IoT system has multiple independent end nodes that perform sensing and/or actuation and send data
to the cloud.
Data is stored in the cloud and application is cloud-based.
The analytics component analyzes the data and stores the results in the cloud database.
The results are visualized with the cloud-based application.
The centralized controller is aware of the status of all the end nodes and sends control commands to the nodes.
Home Automation Smart Lighting : Smart lighting achieve energy savings by sensing the human movements
and their environments and controlling the lights accordingly.
Key enabling technologies for smart lighting include :
- Solid state lighting (such as LED lights) - IP-enabled lights Wireless-enabled and Internet connected lights can
be controlled remotely from IoT applications such as a mobile or web application.
Home Automation Smart Appliances :
Smart appliances make the management easier and provide status information of appliances to the users remotely.
E.g: smart washer/dryer that can be controlled remotely and notify when the washing/drying cycle is complete. •
OpenRemote is an open source automation platform for smart home and building that can control various
appliances using mobile and web applications.
It comprises of three components: - a Controller manages scheduling and runtime integration between
devices. - a Designer allows to create both configuration for the controller and user interface designs. - Control
Panel allows to interact with devices and control them.
Home Automation Intrusion Detection : Home intrusion detection systems use security cameras and sensors to
detect intrusions and raise alerts. The form of the alerts can be in form: - SMS - Email - Image grab or a short
video clip as an email attachment .
Home Automation Smoke / Gas Detectors : Smoke detectors are installed in homes and buildings to detect
smoke that is typically an early sign of fire. It uses optical detection, ionization or air sampling techniques to
detect smoke .
The form of the alert can be in form : Signals that send to a fire alarm system .Gas detector can detect the presence
of harmful gases such as carbon monoxide (CO), liquid petroleum gas (LPG), etc. . Cities IoT applications for
smart cities:
1. Smart Parking
2. Smart Lighting for Road
3. Smart Road
4. Structural Health Monitoring
5. Surveillance
6. Emergency Response
Cities Smart Parking :
Finding the parking space in the crowded city can be time consuming and frustrating • Smart parking makes the
search for parking space easier and convenient for driver. • It can detect the number of empty parking slots and
send the information over the Internet to the smart parking applications which can be accessed by the drivers using
their smartphones, tablets, and in car navigation systems. Sensors are used for each parking slot to detect whether
the slot is empty or not, and this information is aggregated by local controller and then sent over the Internet to
database.
Cities Smart Lighting for Roads :
It can help in saving energy Smart lighting for roads allows lighting to be dynamically controlled and also
adaptive to ambient conditions. Smart light connected to the Internet can be controlled remotely to configure
lighting schedules and lighting intensity. Custom lighting configurations can be set for different situations such as
a foggy day, a festival, etc.
Cities Smart Roads : Smart Roads provides information on driving conditions, travel .time estimates and alerts in
case of poor driving conditions, traffic congestions and accidents. Such information can help in making the roads
safer and help in reducing traffic jams . Information sensed from the roads can be communicated via internet to
cloud-based applications and social media and disseminated to the drivers who subscribe to such applications.
Cities Structural Health Monitoring :
It uses a network of sensors to monitor the vibration levels in the structures such as bridges and buildings. The
data collected from these sensors is analyzed to assess the health of the structures. By analyzing the data it is
possible to detect cracks and mechanical breakdowns, locate the damages to a structure and also calculate the
remaining life of the structure. Using such systems, advance warnings can be given in the case of imminent failure
of the structure
Cities Surveillance:
Surveillance of infrastructure, public transport and events in cities is required to ensure safety and security. City
wide surveillance infrastructure comprising of large number of distributed and Internet connected video
surveillance cameras can be created. The video feeds from surveillance cameras can be aggregated in cloud-based
scalable storage solutions. Cloud-based video analytics applications can be developed to search for patterns of
specific events from the video feeds.
Cities Emergency Response : IoT systems can be used for monitoring the critical infrastructure cities such as
buildings, gas, and water pipelines, public transport and power substations. IoT systems for critical infrastructure
monitoring enable aggregation and sharing of information collected from lager number of sensors. Using cloud-
based architectures, multi-modal information such as sensor data, audio, video feeds can be analyzed I near real-
time to detect adverse events. The alert can be in the form : Alerts sent to the public. Re-rerouting of traffic
.Evacuations of the affected area.
Environment IoT applications for smart environments:
1. Weather Monitoring
2. Air Pollution Monitoring
3. Noise Pollution Monitoring
4. Forest Fire Detection
5. River Flood Detection
UNIT-II
2 Mark Questions
1.What is M2M?
Machine-to-Machine (M2M) • An M2M area network comprises of machines (or M2M nodes) which have
embedded hardware modules for sensing, actuation and communication. Various communication protocols can be
used for M2M local area networks such as ZigBee, Bluetooh, ModBus, M-Bus, Wirless M-Bus, Power Line
Communication (PLC), 6LoWPAN, IEEE 802.15.4, etc.
2.Difference between M2M and Iot?
Difference between IoT and M2M :
Hardware vs Software Emphasis
• While the emphasis of M2M is more on hardware with embedded modules, the emphasis of IoT is more on software.
• Data Collection & Analysis :
M2M data is collected in point solutions and often in on-premises storage infrastructure. In contrast to M2M, the data
in IoT is collected in the cloud (can be public, private or hybrid cloud).
Applications: M2M data is collected in point solutions and can be accessed by on-premises applications such as
diagnosis applications, service management applications, and on- premisis enterprise applications.
• IoT data is collected in the cloud and can be accessed by cloud applications such as analytics applications, enterprise
applications, remote diagnosis and management applications, etc.
3.What are the two types of networking software?
1. SDN- Software-Defined Networking
2. NFV- Network Function Virtualization.
4. Need for IoT Systems Management?
• Automating Configuration
• Monitoring Operational & Statistical Data
• Improved Reliability
• System Wide Configurations
• Multiple System Configurations
• Retrieving & Reusing Configurations
5.Discuss about SNMP?
Simple Network Management Protocol (SNMP) • SNMP is a well-known and widely used network management
protocol that allows monitoring and configuring network devices such as routers, switches, servers, printers, etc.
6.Network Operator Requirements ?
• Ease of use • Distinction between configuration and state data • Fetch configuration and state data separately •
Configuration of the network as a whole • Configuration transactions across devices • Configuration deltas • Dump and restore
configurations • Configuration validation • Configuration database schemas • Comparing configurations • Role-based access
control • Consistency of access control lists: • Multiple configuration sets • Support for both data-oriented and task- oriented
access control.
7.About NETCONF ?
8.About YANG ?
YANG is a data modeling language used to model configuration and state data manipulated by the NETCONF
protocol ,YANG modules contain the definitions of the configuration data, state data, RPC calls that can be issued and the
format of the notifications.
Long Answers
• Software-Defined Networking (SDN) is a networking architecture that separates the control plane from the data
plane and centralizes the network controller.
• Software-based SDN controllers maintain a unified view of the network and make confi guration, management
and provisioning simpler. • The underlying infrastructure in SDN uses simple packet forwarding hardware as
opposed to specialized hardware in conventional networks.
Key elements of SDN : Centralized Network Controller With decoupled control and data planes and centralized
network controller, the network administrators can rapidly configure the network. , Programmable Open APIs
• SDN architecture supports programmable open APIs for interface between the SDN application and control layers
(Northbound interface). Standard Communication Interface (OpenFlow) SDN architecture uses a standard
communication interface between the control and infrastructure layers (Southbound interface). • OpenFlow, which
is defined by the Open Networking Foundation (ONF) is the broadly accepted SDN protocol for the Southbound
interface.
NFV:
NFV • Network Function Virtualization (NFV) is a technology that leverages virtualization to consolidate the
heterogeneous network devices onto industry standard high volume servers, switches and storage. • NFV is
complementary to SDN as NFV can provide the infrastructure on which SDN can run.
Key elements of NFV • Virtualized Network Function (VNF): • VNF is a software implementation of a network
function which is capable of running over the NFV Infrastructure (NFVI). •
NFV Infrastructure (NFVI): • NFVI includes compute, network and storage resources that are virtualized. • NFV
Management and Orchestration: • NFV Management and Orchestration focuses on all virtualization-specific
management tasks and covers the orchestration and life-cycle management of physical and/or software resources
that support the infrastructure virtualization, and the life-cycle management of VNFs.
3. Explain about NETCONF in detail with diagram?
NETCONF • NETCONF works on SSH transport protocol. • Transport layer provides end-to-end connectivity and
ensure reliable delivery of messages. • NETCONF uses XML-encoded Remote Procedure Calls (RPCs) for framing
request and response messages. • The RPC layer provides mechanism for encoding of RPC calls and notifications. •
NETCONF provides various operations to retrieve and edit configuration data from network devices. • The Content
Layer consists of configuration and state data which is XML-encoded. • The schema of the configuration and state
data is defined in a data modeling language called YANG. • NETCONF provides a clear separation of the
configuration and state data. • The configuration data resides within a NETCONF configuration datastore on the
server.
YANG is a data modeling language used to model configuration and state data manipulated by the NETCONF
protocol • YANG modules contain the definitions of the configuration data, state data, RPC calls that can be issued
and the format of the notifications. • YANG modules defines the data exchanged between the NETCONF client
and server. • A module comprises of a number of 'leaf' nodes which are organized into a hierarchical tree structure.
• The 'leaf' nodes are specified using the 'leaf' or 'leaf-list' constructs. • Leaf nodes are organized using 'container'
or 'list' constructs. • A YANG module can import definitions from other modules. • Constraints can be defined on
the data nodes, e.g. allowed values. • YANG can model both configuration data and state data using the 'config'
statement.
YANG Module Example : This YANG module is a YANG version of the toaster MIB • The toaster YANG
module begins with the header information followed by identity declarations which define various bread types. •
The leaf nodes (‘toasterManufacturer’, ‘toasterModelNumber’ and oasterStatus’) are defined in the ‘toaster’
container. • Each leaf node definition has a type and optionally a description and default value. • The module has
make-toast’ and ‘cancel-toast’.
Unit-3
Short Answers
Python is a general-purpose high level programming language and suitable for providing a solid foundation to
thereader in the area of cloud computing.
Multi-paradigm programming language , Python supports more than one programming paradigms including object-
oriented programming and structured programming , Interpreted Language , Python is an interpreted language and
does not require an explicit compilation step. The Python interpreter executes the program source code directly,
statement by statement, as a processor or scripting engine does. , Interactive Language , Python provides an
interactive mode in which the user can submit commands at the Python prompt and interact with the interpreter
directly.
2. List the benefits of python?
• Easy-to-learn, read and maintain , Python is a minimalistic language with relatively few keywords, uses English
keywords and has fewer syntactical constructions as compared to other languages. Reading Python programs feels
like English with pseudo-code like constructs. Python is easy to learn yet an extremely powerful language for a
wide range of applications. , Object and Procedure Oriented , Python supports both procedure-oriented
programming and object-oriented programming. Procedure oriented paradigm allows programs to be written around
procedures or functions that allow reuse of code.
1)Windows
http://www.python.org/getit . • For the examples and exercise in this book, you would require Python 2.7 which
can be directly downloaded from: http://www.python.org/ftp/python/2.7.5/python-2.7.5.msi .
Once the python binary is installed you can run the python shell at the command prompt using > python
#Download Python
Python-2.7.5.tgz cd Python-2.7.5
#Install Python
Type Conversions :Convert one data type to another data type is called Type conversion.
#Convert to string
>>>a=10000 >>>
str(a) ’10000’
#Convert to int
>>>b="2013"
>>>int(b) 2013
#Convert to float
>>>float(b) 2013.0
#Convert to long
>>>long(b) 2013L
#Convert to list
>>>s="aeiou"
#Convert to set
• Python allows organizing the program code into different modules which improves the code readability and
management. A module is a Python file that defines some functionality in the form of functions or classes.
Modules can be imported using the import keyword.
1)Numbers :
Number data type is used to store numeric values. Numbers are immutable data types, therefore
changing the value of a number data type results in a newly allocated object. #Integer
>>>a=5
#Floating Point
>>>b=2.5 >>>
#Long
>>>x=9898878787676L
#Complex
>>>y.real 2 >>>y.imag 5
#Addition
>>>c=a+b
>>>c 7.5
>>>type(c)
<type ’float’>
#Subtraction
>>>type(d)
<type ’float’>
#Multiplication
>>>e=a*b
>>>e 12.5
>>>type(e)
<type ’float’>
#Division
>>>type(f)
<type float’>
#Power
>>>g=a**2
>>>g 25
2.Strings
• A string is simply a list of characters in order. There are no limits to the number of characters
you can have in a string.
#Create string
>>>s="Hello World!"
#String concatenation
>>>len(s) 12
>>>x="100"
>>>type(s)
<type ’str’>
>>>y=int(x)
>>>y 100
#Print string
#Formatting output
#Accessing sub-strings
>>>s[6:-1] ’World’
#strip:
3.Lists
List a compound data type used to group together other values. List items need not all have the
same type. A list contains items separated by commas and enclosed within square brackets
. #Create List
>>>fruits=[’apple’,’orange’,’banana’,’mango’]
>>>type(fruits) <type ’list’>
>>>len(fruits) 4
>>>fruits[1] ’orange’
>>>fruits.append(’pear’)
>>>fruits.remove(’mango’)
>>>fruits.insert(1,’mango’)
#Combining lists
>>>vegetables=[’potato’,’carrot’,’onion’,’beans’,’r adish’]
>>>eatables=fruits+vegetables
>>>eatables [’appl e’, ’mang o’, ’orang e’, ’banan a’, ’pear’, ’potato’, ’carrot’, ’onion’, ’beans’,
’radish’]
>>>mixed=[’data’,5,100.1,8287398L]
>>>type(mixed[2])
<type ’float’>
>>>type(mixed[3]) <type ’long’>
>>>mixed[0]=mixed[0]+" items"
>>>mixed[1]=mixed[1]+1
>>>mixed[2]=mixed[2]+0.05
>>>nested=[fruits,vegetables]
4.Tuples
A tuple is a sequence data type that is similar to the list. A tuple consists of a number of values
separated by commas and enclosed within parentheses. Unlike lists, the elements of tuples cannot
be changed, so tuples can be thought of as read -only lists.
#Create a Tuple
>>>fruits=("apple","mango","banana","pineapple")
>>>len(fruits) 4
>>>fruits[0] ’apple’
#Combining tuples
>>>vegetables=(’potato’,’carrot’,’onion’,’radish’)
>>>eatables=fruits+vegetables
4.Dictionaries
Dictionary is a mapping data type or a kind of hash table that maps keys to values. Keys in a
dictionary can be of any data type, though numbers and strings are commonly used for keys. Values
in a dictionary can be any data type or object. #Create a dictionary
>>>student={’name’:’Mary’,’id’:’8776’,’major’:’CS’}
>>>len(student) 3
>>>student[’name’] ’Mary’
>>>student.items() [(’gender’, ’female’), (’major’, ’CS’), (’name’, ’Mary’), (’id’, ’8776’)] #Get all
keys in a dictionary
>>>student[’gender’]=’female’
>>>student {’gende r’: ’female’, ’major’: ’CS’, ’name’: ’Mary’, ’id’: ’8776’}
>>>students={’1’: student,’2’:student1}
>>>students {’1’: {’gende r’: ’female’, ’major’: ’CS’, ’name’: ’Mary’, ’id’: ’8776’}, ’2’: {’
major’: ’ECE’, ’name’: ’David’, ’id’: ’9876’}}
>>>student.has_key(’name’) True
>>>student.has_key(’grade’) False
Modules :
• Python allows organizing the program code into different modules which improves the code readability and
management. A module is a Python file that defines some functionality in the form of functions or classes. Modules
can be imported using the import keyword. Modules to be imported must be present in the search path.
>>>import student
>>>students = '1': 'name': 'Bob', 'grade': 2.5, '2': 'name': 'Mary', 'grade': 3.5, '3': 'name': 'David', 'grade': 4.2, '4':
'name': 'John', 'grade': 4.1, '5': 'name': 'Alex', 'grade': 3.8
>>>student.print Records(students)
There are 5 students Student-1: Name: Bob Grade: 2.5 Student-2: Name: David Grade: 4.2 Student-3: Name: Mary
Grade: 3.5 Student-4: Name: Alex Grade: 3.8 Student-5: Name: John Grade: 4.1
>>>avg = student. Average Grade(students)
>>>print "The average garde is: %0.2f" % (avg) 3.62
# Importing a specific function from a module
>>>from student import average Grade
# Listing all names defines in a module
>>>dir(student)
File Handling :
Python allows reading and writing to files using the file object.
The open(filename, mode) function is used to get a file object.
The mode can be read (r), write (w), append (a), read and write (r+ or w+), read-binary (rb), write-binary (wb), etc.
After the file contents have been read the close function is called which closes the file object.
• JSON :
JavaScript Object Notation (JSON) is an easy to read and write data-interchange format.
JSON is used as an alternative to XML and is is easy for machines to parse and generate.
JSON is built on two structures - a collection of name-value pairs (e.g. a Python dictionary) and ordered lists of
values (e.g.. a Python list).
• XML :
XML (Extensible Markup Language) is a data format for structured document interchange.
The Python minidom library provides a minimal implementation of the Document Object Model interface and has
an API similar to that in other languages.
SMTPLib : Simple Mail Transfer Protocol (SMTP) is a protocol which handles sending email and routing e-mail
between mail servers.
The Python smtplib module provides an SMTP client session object that can be used to send email.
NumPy :
NumPy is a package for scientific computing in Python. NumPy provides support for large multi-dimensional
arrays and matrices • Scikit-learn • Scikit-learn is an open source machine learning library for Python that provides
implementations of various machine learning algorithms for classification, clustering, regression and dimension
reduction problems.
Unit-4
Short Questions
A "Thing" in Internet of Things (IoT) can be any object that has a unique identifier and which can send/receive data
(including user data) over a network (e.g., smart phone, smart TV, computer, refrigerator, car, etc. ). IoT devices
are connected to the Internet and send information about themselves or about their surroundings (e.g. information
sensed by the connected sensors) over a network (to other devices or servers/storage) or allow actuation upon the
physical entities/environment around them remotely.
2. Basic building blocks of an IoT Device ?
• Sensing • Sensors can be either on-board the IoT device or attached to the device. • Actuation • IoT devices can
have various types of actuators attached that allow taking • actions upon the physical entities in the vicinity of the
device. • Communication • Communication modules are responsible for sending collected data to other devices or
cloud-based servers/storage and receiving data from other devices and commands from remote applications. •
Analysis & Processing • Analysis and processing modules are responsible for making sense of the collected data.
Raspberry Pi is a low-cost mini-computer with the physical size of a credit card. Raspberry Pi runs various flavors
of Linux and can perform almost all tasks that a normal desktop computer can do. Raspberry Pi also allows
interfacing sensors and actuators through the general purpose I/O pins.
The serial interface on Raspberry Pi has receive (Rx) and transmit (Tx) pins for communication with serial
peripherals. • SPI • Serial Peripheral Interface (SPI) is a synchronous serial data protocol used for communicating
with one or more peripheral devices. • I2C • The I2C interface pins on Raspberry Pi allow you to connect hardware
modules. I2C interface allows synchronous data transfer with just two pins - SDA (data line) and SCL (clock line).
Long questions
1. Raspberry Pi is a low-cost mini-computer with the physical size of a credit card. Raspberry Pi runs various
flavors of Linux and can perform almost all tasks that a normal desktop computer can do. Raspberry Pi also allows
interfacing sensors and actuators through the general purpose I/O pins.
• ARM CPU/GPU -- This is a Broadcom BCM2835 System on a Chip (SoC) that's made up of an ARM
central processing unit (CPU) and a Videocore 4 graphics processing unit (GPU). The CPU handles all the
computations that make a computer work (taking input, doing calculations and producing output), and the
GPU handles graphics output.
• GPIO -- These are exposed general-purpose input/output connection points that will allow the real
hardware hobbyists the opportunity to tinker.
• RCA -- An RCA jack allows connection of analog TVs and other similar output devices.
• Audio out -- This is a standard 3.55-millimeter jack for connection of audio output devices such as
headphones or speakers. There is no audio in.
• USB -- This is a common connection port for peripheral devices of all types (including your mouse and
keyboard). Model A has one, and Model B has two. You can use a USB hub to expand the number of ports
or plug your mouse into your keyboard if it has its own USB port.
• HDMI -- This connector allows you to hook up a high-definition television or other compatible device
using an HDMI cable.
• Power -- This is a 5v Micro USB power connector into which you can plug your compatible power supply.
• SD cardslot -- This is a full-sized SD card slot. An SD card with an operating system (OS) installed is
required for booting the device. They are available for purchase from the manufacturers, but you can also
download an OS and save it to the card yourself if you have a Linux machine and the wherewithal.
• Ethernet -- This connector allows for wired network access and is only available on the Model B.
2. Write a python program Interfacing LED and switch with Raspberry Pi?
Note that each of the 40 pins has a "physical" pin number: 1, 2, 3, 4 . . . as well as a "BCM" designator like: GPI02,
GPI027, ID_SD . . . BCM refers to the Broadcom processor chip. As you will see, you can use the pins by their
physical board number or the BCM number. There are also a few specific pins reserved exclusively for power: +5v,
+3.3v and Ground (and not programmable).
The programmable pins may be referenced by either the physical pin number on the board or by the BCM number
(or simply GPIO number) at the end of the designator name (i.e. GPIO27). This choice is made in the initial
configuration during program setup.
Board vs BCM Numbering
Some examples of board vs BCM/GPIO numbering
3 GPIO2 2
5 GPIO3 3
7 GPIO4 4
8 GPIO14 14
The programmable pins may be referenced by either the physical pin number on the board or by the BCM number
(or simply GPIO number) at the end of the designator name (i.e. GPIO27). This choice is made in the initial
configuration during program setup.
It is important to understand that board numbering and BCM numbering use the same physical set of pins, but they
are numbered differently. For example, board pin number 3 is the same physical pin as BCM pin number 2 (GPIO2)
- see the GPIO Pinout image above.
Unit-5
Short Answers
5. What is API?
An API is a set of definitions and protocols for building and integrating application software. API stands for
application programming interface. APIs let your product or service communicate with other products and services
without having to know how they're implemented.
cloud computing means storing and accessing data and programs over the Internet instead of your computer's hard
drive. The cloud is just a metaphor for the Internet. When you store data on or run programs from the hard drive,
that's called local storage and computing.
Long questions
1.Explain in detail about WAMP with Diagram?
WAMP –
Transport: Transport is channel that connects two peers.
Session: Session is a conversation between two peers that runs over a transport.
Client: Clients are peers that can have one or more roles.
Publisher: Publisher publishes events (including payload) to the topic maintained by the Broker.
Subscriber: Subscriber subscribes to the topics and receives the events including the payload.
In RPC model client can have following roles.
Caller: Caller issues calls to the remote procedures along with call arguments.
Callee: Callee executes the procedures to which the calls are issued by the caller and returns the results back to the
caller.
Router: Routers are peers that perform generic call and event routing.
Application Code: Application code runs on the Clients (Publisher, Subscriber, Callee or Caller.
• Django is Model-Template-View (MTV) framework. The model acts as a definition of some stored data and
handles the interactions with the database. In a web application, the data can be stored in a relational database, non-
relational database, an XML file, etc. A Django model is a Python class that outlines the variables and methods for a
particular type of data.
Template In a typical Django web application, the template is simply an HTML page with a few extra
placeholders. Django’s template language can be used to create various forms of text files (XML, email, CSS,
Javascript, CSV, etc.) • View • The view ties the model to the template. The view is where you write the code that
actually generates the web pages. View determines what data is to be displayed, retrieves the data from the database
and passes the data to the template
.
Refer book examples add more screenshot diagrams
Amazon EC2
Python Example
Boto is a Python package that provides interfaces to Amazon Web Services (AWS)
The EC2 region, AWS access key and AWS secret key are passed to this function.
After connecting to EC2 , a new instance is launched using the conn.run_instances function.
The AMI-ID, instance type, EC2 key handle and security group are passed to this function
2. Amazon AutoScaling
Python Example
import boto.ec2.autoscale :
conn.create_launch_configuration(lc)
conn.create_auto_scaling_group(ag)
• AutoScaling Service
AutoScaling Group
After creating a launch configuration, it is then associated with a new AutoScaling group.
AutoScaling group is created by calling conn.create_auto_scaling_group. The settings for
AutoScaling group such as the maximum and minimum number of instances in th e group, the
launch configuration, availability zones, optional load balancer to use with the group, etc.
3.Amazon S3
Python Example
mybucket = conn.get_bucket(bucketname)
fullkeyname=os.path.join(path,filename)
key = mybucket.new_key(fullkeyname)