0% found this document useful (0 votes)
30 views51 pages

EIOT Unit-4

The document outlines the curriculum for the Embedded System and IoT course at Surya Group of Institutions, focusing on IoT communication models, APIs, and protocols. It details various communication models such as Request-Response, Publish-Subscribe, Push-Pull, and Exclusive Pair, along with REST and WebSocket APIs. Additionally, it discusses communication protocols like Bluetooth, WiFi, and ZigBee, highlighting their functionalities and applications in IoT systems.

Uploaded by

madhubalatn9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views51 pages

EIOT Unit-4

The document outlines the curriculum for the Embedded System and IoT course at Surya Group of Institutions, focusing on IoT communication models, APIs, and protocols. It details various communication models such as Request-Response, Publish-Subscribe, Push-Pull, and Exclusive Pair, along with REST and WebSocket APIs. Additionally, it discusses communication protocols like Bluetooth, WiFi, and ZigBee, highlighting their functionalities and applications in IoT systems.

Uploaded by

madhubalatn9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

SURYA GROUP OF INSTITUTIONS

SCHOOL OF ENGIONEERING AND TECHNOLOGY


G.S.T Road, Vikiravandi-605602. Villupuram Dist.
Ph: 04146-263221, 263122 Website: www.suryagroup.edu.in
(Approved by AICTE, New Delhi & Affiliated to Anna University, Chennai)

Subject Name : Embedded system and IOT


Subject code : CS3691
Regulation : 2021
Year / Branch : III / CSE
Semester : VI
UNIT-IV
IOT COMMUNICATION AND OPEN PLATFORMS

IoT Communication Models and APIs-IoT Communication Protocols - Bluetooth-WiFi-ZigBee- GPS


GSM modules Open Platform (like Raspberry Pi) Architecture Programming Interfacing-Accessing
GPIO Pins - Sending and Receiving Signals Using GPIO Pins-Connecting to the Cloud.

4.1 IOT COMMUNICATION MODELS AND APIs


IOT COMMUNICATION MODELS
1. Explain in detail with IOT communication models.
 IoT devices connect and communicate through their technical communication models. An
effective communication model shows how the process works and helps one understand how
communication can be done.
 The Internet of Things enables people and things (devices) to be connected wherever they are,
using any network or service they like. IoT allows to connect multiple devices (things) to
communicate with each other.
 There are four basic types of IoT communication models as given are as follows: Request-
Response Model, Publisher-Subscriber Model, Push-Pull Model and Exclusive Pair Model.
Request / Response model:
 In the Request / Response model, client requests information from the server and waits till the
response is served from the server. Fig. 4.1.1 shows Request / Response model.

Fig. 4.1.1 Request/Response model

Prepared by : T.Manochandar, AP(S.G)/ECE


 HTTP protocol is used by Request / Response model. For example, a browser client may
request a web page from the server through a "Request" and the corresponding web page will
be served by the server as a "Response".
 The client and the server can communicate one to one or one to many with more requests.
 This model is stateless communication model and each request-response pair is independent of
others.
Publish/Subscribe model:
 Publishers: Publishers generate event data and publishes them.
 Subscribers: Subscribers submit their subscriptions and process the events received.
 Publish/Subscribe service: It's the mediator/broker that filters and routes events from
publishers to interested subscribers.

Fig. 4.1.2 shows Publish/Subscribe model.


 The publishers and subscribers are autonomous, which means that they do not need to know the
presence of each other. This model is highly suited for mobile applications, ubiquitous
computing and distributed embedded systems. Failure of publishers or subscribers does not
bring down the entire system.
 No strong guarantee on broker to deliver content to subscriber. After a publisher publishes the
event, it assumes that all corresponding subscribers would receive it.
 Potential bottleneck in brokers when subscribers and publishers overload them.
Push Pull model:
Data procedure push the data to queues and consumers pull the data from the queues. Fig. 4.1.3 shows
push-pull model.

Fig. 4.1.3 Push pull model

Prepared by : T.Manochandar, AP(S.G)/ECE


 Sometimes queue act as buffer in between producer and consumer. Producer does not need to
be aware of the consumers.
Exclusive Pair model:
This communication model is full duplex, bi-directional communication model. It uses persistent
connection between client and server. Fig. 4.1.4 shows exclusive pair model.

Fig. 4.1.4 Exclusive Pair model


 Client sends request to server for opening the connection. This connection is open till the client
send request for closing the connection.
4.1.1 IOT COMMUNICATION APIs
2. Explain in detail about IOT Communication APIs.
1. REST based communication API:
 A large part of the interoperability, scale, and control for IoT can be achieved through API
management. Standards-based design patterns for Web APIs, API management, and a RESTful
architecture provide tremendous value in simplifying the task of interoperability across
heterogeneous systems handling vast amounts of data.
 Representational State Transfer (REST) APIs follow the request-response communication
model.
 Applications conforming to the REST constraints can be called RESTful. RESTful systems
typically communicate over HTTP with the same Methods (GET, POST, PUT, DELETE etc)
that browsers use to retrieve web pages and to send data to remote servers.
1. Client-Server: Requires that a service offer one or more operations and that services wait for
clients to request these operations.
2. Stateless: Requires communication between service consumer (client) and service provider
(server) to be stateless.
3. Cache: Requires responses to be clearly labeled as cacheable or non-cacheable.
4. Uniform interface: Requires all service providers and consumers within a REST-compliant
architecture to share a single common interface for all operations.

Prepared by : T.Manochandar, AP(S.G)/ECE


5. Layered system: Requires the ability to add or remove intermediaries at runtime without
disrupting the system.
6. Code-on-Demand: Allows logic within clients (such as Web browsers) to be updated
independently from server-side logic using executable code shipped from service providers to
consumers.
 Each client request and server response is a message and REST-compliant applications expect each
message to be self-descriptive. That means each message must contain all the information necessary
to complete the task. Other ways to describe this kind of message are "stateless" or "context-free."
Each message passed between client and server can have a body and metadata.
 HTTP request methods and actions:
1. GET: Return whatever information is identified by the Request-URI.
2. HEAD: Identical to GET except that the server must not return a message-body in the response,
only the metadata.
3. OPTIONS: Return information about the communication options available on the
request/response chain identified by the Request-URI
4. PUT: Requests that the enclosed entity be stored under the supplied Request-URI.
5. POST: Requests that the origin server accept the entity enclosed in the request as a new
subordinate of the resource identified by the Request-URI.
6. DELETE: Requests that the origin server delete the resource identified by the Request-URI.
• The first three are read-only operations, while the last three are write operations.
2. WebSocket based Communication API:
 WebSocket support full-duplex, two-way communication between client and server.
 WebSocket APIs reduce the network traffic and latency as there is no overhead for connection
setup and termination requests for each message.
 WebSocket uses a standard HTTP request-response sequence to establish a connection. When
the connection is established, the WebSocket API provides a read and write interface for
reading and writing data over the established connection in an asynchronous full duplex
manner.
 WebSocket also provides an interface for asynchronously closing the connection from either
side.
4.2 IOT COMMUNICATION PROTOCOLS
3. Explain in detail about IOT Communication protocols. (OR) Explain in detail about Bluetooth
and WIFI technology.
Communication protocols are used as a backbone of IoT systems. It enables network connectivity and
coupling to applications. Communication protocols allow devices to exchange data over the network.

Prepared by : T.Manochandar, AP(S.G)/ECE


Communication protocol also performs error correction and detection, flow control, data encoding,
addressing mechanism etc. Sequence control, loss of packet, retransmission are the other functions of
communication protocol.
4.2.1 Bluetooth
 Bluetooth is a wireless technology that enables a wireless device to communicate in the 2.4
GHz Industrial Scientific and Medical (ISM band).
 The number of hardware manufacturers adapting the Bluetooth technology and providing
Bluetooth modules is rapidly increasing. This has made the modules reasonably cheap and is
driving the market to provide smaller highly integrated products
 This, on the other hand, benefits adaptive markets such as the sensor market. Hopefully,
Bluetooth opens up possibilities of creating cheap, efficient, wireless sensor and control
networks
 Bluetooth is a short range, low cost and low power wireless communication standard. Today,
we can find Bluetooth chips.
 Embedded in PCs, laptops, digital cameras, GPS devices, Smart Phones and a whole range of
other electronic devices.
 Bluetooth supports point-to-point and point-to-multipoint connections. Bluetooth operates in
the 24 GHz Industrial, Scientific and Medical (ISM) band at a maximum data rate of 720 kbps.
It uses Frequency Hopping Spread Spectrum that divides the frequency band yielding 79
channels. The modulation used is a Gaussian-shaped binary Frequency Shift Keying (GFSK)
modulation scheme.

Fig. 4.2.1 shows use of Bluetooth in embedded system.


 Bluetooth uses TDD (Time Division Duplex) to perform full-duplex communication. The
master defines slots of time and allocates one slot per slave.
 Bluetooth is organized in master-slave mode. The topology supports 1 master, 7 slaves and up
to 255 slaves in parked mode. The master defines the clock and time slots for all nodes.

Prepared by : T.Manochandar, AP(S.G)/ECE


 A master can request to change his role with a slave, at which point int the slave becomes the
matter and the master becomes the slave. For example: A head phone starts the communication
as a master, but it prefers to be the slave.
 Two basic topologies are possible in Bluetooth Piconet and Scatternet Topology Bluetooth
devices have 3 modes to save power energy in transmission inactive state: sniff mode, hold
mode and parked mode.
6.2.2 WiFi
 WiFi means Wireless Fidelity. It is a wireless technology that uses radio frequency to transmit
data through the air. The standard for Wireless Local Area Networks (WLANs). It's actually
IEEE 802.11. a family of standards. Wi-Fi is based on the 802.11 standard: 802.11a, 802.11b
and 802.11g.
 IEEE created standard, but Wi-Fi Alliance certifies products. The Wireless Ethernet
Compatibility Alliance started the Wi-Fi-wireless fidelity-certification program to ensure that
equipment claiming 802.11 compliance was genuinely interoperable.
 WiFi systems are the half duplex shared media configurations, where all stations transmit and
receive on the same radio channel.
 Wi-Fi combines concepts found in CSMA/CA and MACAW, but also offers features to
preserve energy.
 The developers of the 802.11 specifications develop a collision avoidance mechanism called
the Distributed Control Function (DCF). According to DCF, a WiFi station will transmit only
when the channel is clear.
 All transmissions are acknowledged, so if a station does not receive an acknowledgement, it
assumes a collision occurred and retries.
ISM Band
 ISM stands for Industrial, Scientific, and Medical. ISM bands are set aside for equipment that
is related to industrial or scientific processes or is used by medical equipment.
 Perhaps the most familiar ISM-band device is the microwave oven, which operates in the 2.4-
GHz ISM band.
 The ISM bands are license-free, provided that devices are low-power. You don't need a license
to set up and operate a wireless network.
 WLAN architecture Ad-Hoc mode: Peer-to-peer setup where clients can connect to each other
directly. Generally, not used for business networks.
 Mobile stations communicate to each other directly. It's set up for a special purpose and for a
short period of time. For example, the participants of a meeting in a conference room may
create an ad hoc network at the beginning of the meeting and dissolve it when the meeting
ends.

Prepared by : T.Manochandar, AP(S.G)/ECE


Wi-Fi network services are as follows:
1. Distribution and integration.
2. Association, re-association and disassociation
3. Authentication and deauthentication
4. Providing privacy
Distribution: This service is used by mobile stations in an infrastructure network every time they send
data. Once a frame has been accepted by an access point, it uses the distribution service to deliver the
frame to its destination. Any communication that uses an access point travels through the distribution
service, including communications between two mobile stations associated with the same access point.
Integration: Is a service provided by the distribution system; it allows the connection of the
distribution system to a non-IEEE 802.11 network. The integration function is specific to the
distribution system used and therefore is not specified by 802.11, except in terms of the services it
must offer.
Association: Delivery of frames to mobile stations is made possible because mobile stations register,
or associate, with access points. The distribution system can then use the registration information to
determine which access point to use for any mobile station.
Reassociations: When a mobile station moves between basic service areas within a single extended
service area, it must evaluate signal strength and perhaps switch the access point with which it is
associated. Reassociations are initiated by mobile stations when signal conditions indicate that a
different association would be beneficial; they are never initiated by the access point. After the
reassociation is complete, the distribution system updates its location records to reflect the reachability
of the mobile station through a different access point.
Disassociation: To terminate an existing association, stations may use the disassociation service.
When stations invoke the disassociation service, any mobility data stored in the distribution system is
removed. Once disassociation is complete, it is as if the station is no longer attached to the network.
Disassociation is a polite task to do during the station shutdown process. The MAC is, however,
designed to accommodate stations that leave the network without formally disassociating
Authentication / deauthentication: Physical security is a major component of a wired LAN security
solution. Wired network's equipment can be locked inside offices. Wireless networks cannot offer the
same level of physical security, however and therefore must depend on additional authentication
routines to ensure that users accessing the network are authorized to do so. Authentication is a
necessary prerequisite to association because only authenticated users are authorized to use the
network
Deauthentication terminates an authenticated relationship. Because authentication is needed before
network use is authorized, a side effect of deauthentication is termination of any current association.
Each 802.11a/b/g device can operate in one of four possible modes:

Prepared by : T.Manochandar, AP(S.G)/ECE


1. Master mode (also called AP or infrastructure mode) is used to create a service that looks like a
traditional access point.
2. Managed mode is sometimes also referred to as client mode. Wireless cards in managed mode will
join a network created by a master and will automatically change their channel to match it.
3. Ad-hoc mode creates a multipoint-to-multipoint network where there is no single master node or
AP. In ad-hoc mode, each wireless card communicates directly with its neighbors.
4. Monitor mode is used by some tools to passively listen to all radio traffic on a given channel. When
in monitor mode, wireless cards transmit no data.

4.3 ZIGBEE
4. Explain in detail about ZIGBEE Architecture with neat diagram.
 ZigBee is built on top of the IEEE 802.15.4 standard. ZigBee provides routing and multi-hop
functions to the packet-based radio protocol. ZigBee is a registered trademark of the ZigBee.
Alliance.
 802.15.4M is a trademark of the Institute of Electrical and Electronics Engineers (IEEE).
802.15.4 defines the physical and MAC layers, and ZigBee defines the network and application
layers.
 ZigBee is the primary protocol which builds on the 802.15.4 standard, adding a network layer
capable of peer-to-peer multi-hop mesh networking, a security layer capable of handling
complex security situations, and an application layer for interoperable application profiles.
 The 802.15.4 specification was created and is maintained by IEEE. This specification defines
the physical (PHY) and Media Access Control (MAC) layers of a personal area, low-power,
wireless network.
 ZigBee is a wireless standard for home and commercial use developed by the ZigBee Alliance,
established in 2002. It is based on an IEEE 802.15.4 standard. The latest version of the standard
is known as ZigBee Pro and was published in 2007.
 A major feature of the ZigBee protocol is its mesh network topology that is self-healing and
auto-routing. Mesh networks do not depend on any single connection; if one link is broken,
devices search through the mesh to find another available route. This capability makes a
ZigBee-based network very reliable and flexible.
 The protocol is administered by the ZigBee Alliance, an open, non-profit association of
approximately 400 members.
 The Alliance certifies products and promotes worldwide adoption of ZigBee as the wirelessly
networked standard for sensing and control in consumer, commercial and industrial areas.
 The ZigBee specifications enhance the IEEE 802.15.4 standard by adding network and security
layers and an application framework. ZigBee is an open, global, packet-based protocol

Prepared by : T.Manochandar, AP(S.G)/ECE


designed to provide an easy-to-use architecture for secure, reliable, low power wireless
networks.
 Flow or process control equipment can be place anywhere and still communicate with the rest
of the system. It can also be moved, since the network doesn't care about the physical location
of a sensor, pump or valve. ZigBee targets the application domain of low power, low duty cycle
and low data rate requirement devices. Figure below shows the example of a ZigBee network.
 IEEE 802.15.4 supports star and peer-to-peer topologies. The ZigBee specification supports
star and two kinds of peer-to-peer topologies, mesh and cluster tree.
 ZigBee-compliant devices are sometimes specified as supporting point-to-point and point-to-
multipoint topologies.
Features
1. Stochastic addressing: A device is assigned a random address and announced. Mechanism for
address conflict resolution. Parents node doesn’t need to maintain assigned address table.
2. Link management: Each node maintains quality of links to neighbors. Link quality is used as link
cost in routing.
3. Frequency agility: Nodes experience interference report to channel manager, which then selects
another channel.
4. Asymmetric link: Each node has different transmit power and sensitivity. Paths may be
asymmetric.
5. Power management: Routers and coordinators use main power. End Devices use batteries.
Customer application
4.3.1 ZIGBEE ARCHITECTURE

Fig. 4.3.1 shows position of ZigBee and IEEE 802.15.4.


 ZigBee specifies all the layers above MAC and PHY, including the NWK (network) layer, APS,
ZDO and security layers. It's ZigBee that provides the mesh networking and multi-hop
capabilities, enhances the reliability of data packet delivery and specifies application-to-
application interoperability.
Prepared by : T.Manochandar, AP(S.G)/ECE
 ZigBee does not use all of the 802.15.4 MAC/PHY specification; only a small subset. This allows
stack vendors to offer smaller solutions by providing a limited MAC for their ZigBee stacks.
 ZigBee is asynchronous. Any node may transmit at any time. Only the CSMA/CA, a MAC-level
mechanism, prevents nodes from talking over each other.
 Application (APL) Layer: The top layer in the ZigBee protocol stack consists of the Application
Framework. ZigBee Device Object (ZDO) and Application Support (APS) Sublayer.
 Application Framework: It provides a description of how to build a profile onto the ZigBee
stack. It also specifies a range of standard data types for profiles, descriptors to assist in service
discovery, frame formats for transporting data and a key value pair construct to rapidly develop
simple attribute-based profiles.
 Software at an endpoint that controls the ZigBee device. A single ZigBee node supports up to 240
application objects. Each application object supports end points numbered between 1 and 240
(with endpoint 0 reserved for the ZigBee Device Object (ZDO).
 ZigBee Cluster Library (ZCL) is a library of clusters that can be used by any application. This
allows common clusters to be reused across a number of different functional domains, for
example, the same lighting clusters can be used for any application that requires lighting controls,
such as home automation and commercial building automation.
 Each cluster has two "ends", client and server.
Working of Zigbee
 ZigBee basically uses digital radios to allow devices to communicate with one another. A typical
ZigBee network consists of several types of devices.
 A network coordinator is a device that sets up the network, is aware of all the nodes within its
network, and manages both the information about each node as well as the information that is
being transmitted/received within the network.
 Every ZigBee network must contain a network coordinator. Other Full Function Devices (FFD's)
may be found in the network, and these devices support all of the 802.15.4 functions.
 They can serve as network coordinators, network routers or as devices that interact with the
physical world.
 The final device found in these networks is the Reduced Function Device (RFD), which usually
only serve as devices that interact with the physical world.
4.3.2 Logical Device Types

Prepared by : T.Manochandar, AP(S.G)/ECE



Fig. 4.3.3 shows Zigbee network. ZigBee Coordinators (ZCs) form networks.
 The ZigBee stack resides on a ZigBee logical device. There are three logical device types:
Coordinator, Router and End device.
 It is at the network layer that the differences in functionality among the devices are determined. It is
expected that in a ZigBee network the coordinator and the routers will be mains-powered and that
the end devices can be battery-powered.
 In a ZigBee network there is one and only one coordinator per network. The number of routers
and/or end devices. depends on the application requirements and the conditions of the physical site.
 Within networks that support Coordinator sleeping end devices, the coordinator or one of the
 routers must be designated as a Primary Discovery Cache Device. These cache devices provide
server services to upload and store discovery information, as well as respond to discovery requests,
on behalf of the sleeping end devices.
Function of ZigBee coordinator:
1. It forms a network.
2. It establishes the 802.15.4 channel on which the network will operate.
3. It establishes the extended and short PAN ID for the network.
4. It decides on the stack profile to use (compile or run-time option).
5. It acts as the Trust Center for secure applications and networks.
6. It acts as the arbiter for End-Device-Bind (a commissioning option).
7. It acts as a router for mesh routing.
8. It acts as the top of the tree, if tree routing enabled.
Function of ZigBee routers:
1. Finding and joining the" correct network
2. Perpetuating broadcasts across the network
3. Participating in routing, including discovering and maintaining routes

Prepared by : T.Manochandar, AP(S.G)/ECE


4. Allowing other devices to join the network (if permit-join enabled)
5. Storing packets on behalf of sleeping children
Functions of ZigBee end-devices:
1. Finding and joining the correct network
2. Polling their parents to see if any messages were sent to them while they were asleep.
3. Finding a new parent if the link to the old parent is lost (NWK rejoin)
4. Sleeping most of the time to conserve batteries when not in use by the application.
ZigBee Network Formation
1. Forming a Network
 The coordinator initiates network formation.
 After forming the network, the coordinator can function as a router & can accept requests from
other devices wishing to join the network.
 Depending on the stack and application profile used, the coordinator might also perform
additional duties after network formation.
2. Joining a Network
 A device finds a network by scanning channels.
 When a device finds a network with the correct stack profile that is open to joining, it can
request to join that network.
 A device sends its join request to one of the network's router nodes & the device receiving the
request can then use the callback to accept the request or deny it.
3. Network Communication
 All nodes that communicate on a network transmit and receive on the same channel, or
frequency.
 ZigBee uses a Personal Area Network Identifier (PAN ID) to identify a network this provides a
way for two networks to exist on the same channel while still maintaining separate traffic flow.
4.3.3 Network Layer
The Zigbee networking layer is probably one of the most complex layers in the protocol stack.
Network layer responsibilities:
1. Establishment of a new network.
2. New device configuration, addressing assignment, network synchronization
3. Frames security
4. Message routing.
 On the transmit side, the Application Sub Layer (APS) sends data down to the network layer via a
data request. Inside the data request, the APS specifies the destination address, whether or not
route discovery will be allowed, and the radius.

Prepared by : T.Manochandar, AP(S.G)/ECE


 The radius is the maximum hops that the frame will be allowed to travel. This is mostly used in
broadcasts. Once inside the data request, the network header is filled out and then the address is
examined.
 At this point, it's probably best to make a distinction between network addressing and MAC
addressing. There are two sets of addresses in each Zigbee frame: the 802.15.4 source/destination
addresses and the Zigbee network source/destination addresses.
 ZigBee uses two unique addresses per node a long address (MAC address) and a short address
(Network address).
 The long address, also called the IEEE or MAC address, is assigned by the manufacturer of a
device using an 802.15.4 radio), and does not change for the life of the device.
 The long address uniquely identifies the widget from all other 802.15.4 widgets in the world. In
fact, the 64 bits (8 bytes) of this address space are large enough to include 123, 853 devices for
every square meter on earth.
 The IEEE address space, surprisingly enough, is controlled by IEEE. A block of them can be
purchased by the manufacturer. Each IEEE address uniquely identifies this node from any other
node in the world.
 The top three bytes (24 bits) are called the Organizational Unique Identifier (OUT), and the
bottom five bytes (40 bits) are managed by the Original Equipment Manufacturer (OEM).
Components:
1. Network Layer Data Entity (NLDE): Makes NPDU from NSDU
2. Network Layer Management Entity (NLME): Configure new device, neighbor discovery, route
discovery, joining/leaving a network.
3. Network Layer Information Base (NIB): Capabilities (RFD/FFD), Security level, protocol
version, route discovery time, max retries for route discovery, neighbor table,

Fig. 4.3.5 ZigBee network layer frame format

Prepared by : T.Manochandar, AP(S.G)/ECE


4.3.4 Simple Tree Routing Protocol
 The tree network addresses are assigned using a distributed addressing scheme. These
addresses are unique within a particular network. As a result, a router can acquire the
relationship of two nodes through their network addresses.
 The ZC becomes the root of the tree. Every device except the ZC has a parent node, while a ZR
may also has one or more child nodes. A ZED acts as a leaf in the tree topology.

Fig. 4.3.6 shows tree architecture


 In a tree topology, the role of the ZigBee coordinator is to establish the network and configure
all parameters. During the establishment phase the ZigBee coordinator determines the
maximum number of nodes, which are (Cm) and (Rm).
 Whereas Cm is the maximum number of children and 'Rm' is the maximum number of routers a
parent may have as children. In addition, each node has an attribute called "depth" which is the
minimum number of hops to reach the coordinator using only parent-child link.
 The ZigBee coordinator itself has a depth of zero and it determines the maximum tree depth of
the network (Lm) Tree routing, also acknowledged, is only available in Stack Profile 0x01.
 Tree is just as bandwidth-efficient as mesh, and more efficient in terms of memory. But it has a
major drawback: If links between parent and children break, it has no recovery. So, ZigBee
uses mesh by default.
Advantages: No communication overhead.
Disadvantages: More transmission delay (not optimal path) and Single point of failure.

Prepared by : T.Manochandar, AP(S.G)/ECE


4.3.5 ZigBee-AODV (ZAODV)
5. Explain in detail about ZIGBEE - AODV (ZAODV) and ZigBee Applications.
 Another routing protocol in ZigBee is a route discovery protocol similar to Ad-hoc On-demand
Distance Vector Routing.
 AODV is a reactive protocol, i.e. the network stays silent until a connection is requested. If a
node wants to communicate with another one, it broadcasts a request to its neighbors who re-
route the message and safeguard the node from which they received the message.
 If a node receives a message and it has an entry corresponding to the destination in its routing
table, it returns a RREP through the reverse-path to the requesting node. So, the source sends
its data through this path to the destination with the minimum number of hops.
 In ZAODV, when a node desires to send data to another node without having the related
routing information, it buffers the data and then initiates a route discovery process to find the
optimal path for the destination.
1. Routing Table (RT)
2. Route Discovery Table (RDT)
3. Route Request Command Frame (RREQ)
4. Route Reply Command Frame (RREP)
The ZigBee routing algorithm uses a path cost metric for route comparison during route discovery and
maintenance.
RREQ
1. The source node broadcasts a route request (RREQ) packet.
2. If a intermediate router receives an new RREQ, it add RDT entry and rebroadcast the RREQ.
3. If a intermediate router receives an old RREQ, it shall compare the Forward Cost in the RREQ to
the one stored in the RDT entry.
4. If the Cost is less, the router shall update the RDT entry and rebroadcast the RREQ again.
5. Using Source Address and Route Request ID, the RREQ can be uniquely 5 identified.
RREP
1. The destination node receives the RREQ, it responds by unicasting a route reply (RREP) packet to
its neighbor from which it received the RREQ
2. The destination will choose the routing path with the lowest cost and then send a route reply.
3. Finally, when the RREP reaches the originator, the route discovery process is finished.
ZAODV can effectively reduce the transmission delay. However, the procedure of flooding RREQ
wastes significant amount of bandwidth, memory and device energy, and might cause a "broadcast
storm" problem.
4.3.6 APS Layers
Application Support Sublayer (APS) is responsible for:

Prepared by : T.Manochandar, AP(S.G)/ECE


1. Binding tables
2. Message forwarding between bound devices
3. Group address definition and management 4
4. Address mapping from 64-bit extended addresses to 16-bit NWK addresses
5. Fragmentation and reassembly of packets
6. Reliable data transport
 The key to interfacing devices at the need/service level is the concept of binding tables are kept
by the coordinator and all routers in the network.
 The binding table maps a source address and source endpoint to one or more destination
addresses and endpoints.
 The cluster ID for a bound set of devices will be the same. APS layer is responsible for
providing a data service to the application and ZigBee device profiles.
 It also provides a management service to maintain binding links and the storage of the binding
table itself. ZigBee's security services include methods for key establishment and transport.
device management, and frame protection.
 The ZigBee specification defines security for the MAC, network and APS layers. Security for
applications is typically provided through Application Profiles.
 The APS layer allows frame security to be based on link keys or the network key. Encryption
can be applied at three different levels, the MAC layer, Network layer and the Application
Support (APS) layer.
 A ZigBee frame will contain fields from all of these layers encapsulated within one another,
and each later can encrypt its data payload.
 The APS layer is also responsible for providing applications and the ZDO with key
establishment, key transport, and device management services.
 The APS sublayer is key establishment services provide the mechanism by which a ZigBee
device may derive a shared secret key, with another ZigBee device. Key establishment involves
two entities, an initiator device and a responder device, and is prefaced by a trust-provisioning
step.

Fig. 4.3.7 Zigbee frame with security on the APS level

Prepared by : T.Manochandar, AP(S.G)/ECE


4.3.7 ZigBee Applications
There are numerous applications that are ideal for the redundant, self-configuring and self-healing
capabilities of ZigBee wireless mesh networks. Key ones include:
1. Energy management and efficiency: To provide greater information and control of energy usage,
provide customers with better service and more choice, better manage resources, and help to reduce
environmental impact.
2. Home automation: To provide more flexible management of lighting, heating and cooling,
security, and home entertainment systems from anywhere in the home.
3. Building automation: To integrate and centralize management of lighting, heating, cooling and
security.
4. Industrial automation: To extend existing manufacturing and process control systema reliability.

4.4 GLOBAL POSITIONING SYSTEM (GPS)


6. Explain in detail about Global Positioning System (GPS).
 The Global Positioning System (GPS) is a space-based radio-navigation system consisting of a
constellation of satellites broadcasting navigation signals and a network of ground stations and
satellite control stations used for monitoring and control.
 GPS system time is associated with Coordinated Universal Time or UTC as observed by the
US Naval Observatory.
 The accuracy of GPS is based on the clear and fine visibility of the sky, and any obstructions
by means of tree branches or building density may lead to limited accuracy in the forest and
urban areas.
 GPS satellites transmit signals to provide accurate PVT information to an unlimited number of
users on the Earth.
 GPS satellites broadcast a signal that encodes position and time with a high accuracy derived
from the satellite's atomic clock time standard.
 The GPS receivers use the time-of-arrival ranging to generate pseudo range to determine the
user's position.
 Currently 31 GPS satellites orbit the Earth at an altitude of approximately 11,000 miles
providing users with accurate information on position, velocity and time anywhere in the world
and in all weather conditions.
 GPS includes three main segments: The space segment, control segment and user segment.
 GPS space segment includes over 30 satellites in orbit operated and maintained by the US.
Space Force These satellites broadcast radio signals to control and monitoring stations on Earth
and directly to users requiring highly precise satellite positioning.

Prepared by : T.Manochandar, AP(S.G)/ECE


 The U.S. Space Force also oversees the GPS control segment. It includes master control and
backup control stations, dedicated ground antennas and several monitor stations located
worldwide.
 These stations work to ensure GPS satellites are healthy, orbiting in the correct locations and
have accurate atomic clocks on board. These stations are integral to the overall health and
accuracy of the GPS constellation.
 The user segment includes everyone relying upon GPS satellites for PNT measurements. From
a mobile phone providing directions to autonomous vehicles requiring lane-level positioning
accuracy; from a farmer tracking planting and harvesting routes year-over-year to a UAV
mapping a rainforest, many applications use GPS for high precision positioning and accuracy
around the world.

Fig. 4.4.1 GPS system


4.5 GSM MODULES
7. Explain in detail about GSM Modules with neat diagram.
 GSM stands for Global System for Mobile communication. It is widely used for digital cellular
radio. It is a second generation cellular standard developed to cater voice services and data
delivery using digital modulation.
 GSM support 200 full duplex channels per cell. Each channel uses different uplink and
downlink frequency.
 GSM handles channel access using a combination of FDM, TDM and slotted ALOHA. GSM is
an open source system and it allows access to code.

Prepared by : T.Manochandar, AP(S.G)/ECE


 GSM comes in three flavours (frequency bands): 900, 1800, 1900 MHz. Frequency band 900
is the orange flavour in Israel. Voice is digitized using full-rate coding.
 Maximum distance the GSM supports is 35 kilometers. Most 2G GSM networks operate in the
900 MHz or 1800 MHz bands while 3G GSM in the 2100 MHz frequency band.
 The physical channel in GSM is the timeslot. The logical channel is the information which goes
through the physical channel. Both user data and signaling are logical channels.
 User data is carried on the traffic channel (TCH), which is defined as 26 TDMA frames. There
are lots of control channels for signaling, base station to mobile, mobile to base station
Performance characteristics of GSM:
a) Communication: Mobile, wireless digital communication; support for voice and data services.
b) Total mobility: International access, chip-card enables use of access points of different providers.
c) Worldwide connectivity: One number, the network handles localization.
d) High capacity: Better frequency efficiency, smaller cells, more customers per cell.
e) High transmission quality: High audio quality and uninterrupted phone calls at higher speeds
f) Security functions: Access control, authentication via chip-card and PIN
GSM architecture consists of three subsystems:
1. Base Station Subsystem (BSS)
2. Network Switching Subsystem (NSS)
3. Mobile station (Cell phone)

Fig. 4.5.1 GSM architecture


Advantages of GSM over analog system:
 Capacity increases
 Reduced RF transmission power and longer battery life
 International roaming capability

Prepared by : T.Manochandar, AP(S.G)/ECE


 Encryption capability for information security and privacy
 Compatibility with ISDN, leading to wider range of services
 Better security against fraud (through terminal validation and user authentication)
4.5.1 Base Station Subsystem
 Base Station Subsystem (BSS) consists of Base Transceiver Station (BTS) and Base Station
Controller (BSC).
 The Base Station Controller (BSC) is in control of and supervises a number of Base
Transceiver Stations (BTS).
 The BSC is responsible for the allocation of radio resources to a mobile call and for the
handovers that are made between base stations under his control. Other handovers are under
control of the MSC.
 Each BSC connects to a number of Base Transceiver Stations (BTS) which, in turn, provide
radio interfaces for mobile devices.
 BSC manages the radio resources for one or more BTSs. It handles radio channel setup,
frequency hopping and handovers.
 The BSC also translates the 13 kbps voice channel used over the radio link to the standard 64
kbps channel used by the Public Switched Telephone Network or ISDN.
Functions performed by the BSC
1. Processing of signals
2. Controlling signals to the connected BTSs and control of handover of signals from one BTS to
another within a BSS
3. Control and handover of the signals from BSC to MSC
4. Traffic control by continuous measurement of the frequency channel spectrum being used at a
given instant
5. Authentication, encryption and decryption of data
6. Updating location registry for the MSs
 Base transceiver station houses the radio transceivers that define a cell and handles the radio link
protocols with the mobile station.
 BST servers one or more cells in cellular network and contains more than one transceivers. This
transceiver provides full duplex communication to mobile stations.
 Usually, a BTS is used to manage one cell in the GSM cellular network, but using a sectorized
antenna, a single BTS can be used to manage many cells.
Main functions performed by the BTS
1. Formation of cells using appropriately
2. Directed antenna.
3. Processing of signals

Prepared by : T.Manochandar, AP(S.G)/ECE


4. Amplification of signals to acceptable strength so that they can be transmitted without loss of data
5. Channel coding and decoding
6. Frequency hopping so that multiple channels for various mobile stations can operate simultaneously
using different channel band frequencies 7. Encryption and decryption of data
4.5.2 Network Switching Subsystem
 It acts as an interface between wireless and fixed networks. It mainly consists of switches and
databases and manages functions such as handovers between BSS's, worldwide user
localization, maintenance of user accounts and call charges and management of roaming.
 Mobile service Switching Center (MSC) is a main component of network switching subsystem.
It acts as switching node of PSTN.
Network subsystem includes four different types of databases:
1. Home location register
2. Equipment identity register
3. Visitor location register
4. Authentication center
 MSC consists mainly of high-performance digital ISDN switches. It connects to a number of BSCs
over the "A" interface. It also connects to other MSCs and to fixed-line networks through GMSCs.
It is used to manage BSCs in a geographical area.
 MSC performs all necessary functions in order to handle the calls to and from the mobile station,
MSC performs following functions:
1. Call routing
2. Collection of billing information
3. Call setup, monitoring and release
4. Mobility management like registration, location updating and call handoff between BSC and MSC.
5. Management of signaling protocol
 The Home Location Register (HLR) and the Visitor Location Register (VLR) are located within the
MSC.
Home Location Register (HLR)
It includes all permanent user's information. HLR is a database used for storage and management of
subscriptions.
HLR stores following information:
a. Subscriptions information.
b. International Mobile Station Identity (IMSI).
c. One or more Mobile station International ISBN numbers (MSISDN).
d. Location information which required for billing and routing of calls towards the MSC where the MS
is registered.

Prepared by : T.Manochandar, AP(S.G)/ECE


 Each mobile user has only one HLR record worldwide, which is updated constantly on a real-time
basis. Each MS must register at a specific HLR of a specific MSC. The HLR contacts AuC in the
network subsystem for authentication.
 Each HLR is associated to an MSC so that when an MS registered at a a certain HLR moves to
another Location Area (LA), serviced by another MSC, the user's home MSC update the user's
current VLR
 The database contains other useful information like tele-services and bearer services subscription
information, service restrictions etc.

Fig. 4.5.2 Location area

Prepared by : T.Manochandar, AP(S.G)/ECE


 Location Area Identity (LAI) is broadcasted by the BTS so a mobile station can determine if it
has entered a new location area.
 If a new location area is entered the MSC is in formed and the VLR and HLR is updated. Each
cell in a location area is allocated a Cell Identity (CI) consisting of 16 bits.
 The CI and LAI form a globally unique identifier of a cell. If the HLR fails the system fails.
The HLR manages the location updates as mobile phones roam. HLR connects and interacts
with a number of the system. other components on the system.
a) The Gateway MSC for handling incoming calls
b) The VLR for handling request from mobile phones to attach to the network
c) The SMSC for handling incoming SMS
d) The voice system for delivering notification to the mobile phone that a message is
waiting.
Visiting Location Register (VLR)
 A VLR is a database, similar to a HLR, which is used by the mobile network to temporarily
hold profiles of roaming users (users outside their home area).
 This VLR data is based on the user information retrieved from a HLR. MSCs use a VLR to
handle roaming users.
 Dynamic real-time database that stores both permanent and temporary subscriber data which is
required for communication between the MSs in the coverage area of the MSC associated with
that VLR.
 VLR controls those mobiles roaming in its area and reduces number of queries to HL.R. Its
database contains IMSI. TMSI, MSISDN, MSRN, location area and authentication key.
 If a roamer makes a call the VLR will already have the information it needs for call setup. The
VLR primary functions are,
a) To inform the HLR that a MS has arrived in the particular area covered by the VLR.
b) To track where the subscriber is within a VLR area when it is not active
c) To allocate roaming numbers during the process of incoming calls
d) The VLR is reset daily
Equipment Identity Register (EIR)
 The EIR keeps a black list of stolen phones that should be barred from access. Stolen phones can
be re-flashed with a new IMEI and thus avoid the EIR check.
 EIR can also block phones that are malfunctioning and disturb the network.
 The EIR feature is used to reduce the number of GSM mobile handset thefts by providing a
mechanism to assist network operators in preventing stolen or disallowed handsets from accessing
the network.

Prepared by : T.Manochandar, AP(S.G)/ECE


 This control is done by comparing the International Mobile Equipment Identity (IMEI) that is
provided during handset registration to a set of three lists provided by the network operator:
a) Black list : Mobile Stations (MS) on the black list will be denied access to the network
b) White list : MSs on the white list will be allowed access to the network.
c) Gray list : MSs on the gray list will be allowed on the network, but may be tracked.
Authentication Center (AUC)
 The AUC verifies the identity of the user and ensures the confidentiality of each call. The AUC
holds the secret key that is shared between the SIM and the network. The key never leaves the
SIM nor the AUC.
 Network nodes can request the encryption of a set of challenges from the AUC. A challenge is
then sent to the mobile station and if the respond matches the subscriber is authenticated.
 The authentication process also controls encryption for privacy. It is generally associated with
HLR.
 The AUC and the EIR can be implemented as stand-alone nodes or as a combined AUC/EIR
node
How are the HLR and VLR used?
 Each mobile network has its own HLRs and VLRs. When a MSC detects a mobile user's presence
in the area covered by its network, it first checks a database to determine if the user is in his/her
home area or is roaming, i.e, the user is a visitor.
a) User in home area HLR has the necessary information for initiating, a terminating, or
receiving a call.
b) User is roaming: VLR contacts the user's HLR to get the necessary information to set up a
temporary user profile.
 The user's location is recorded in the HLR and in case the user roaming, it is also recorded in the
VLR.
 Suppose that the user wants to make a call
1. User in home area: MSC contacts the HLR prior to setting up the call.
2. User is roaming: MSC contacts the VLR prior to setting up the call.
 Suppose that there is a call for the user (call goes to the home MSC):
1. User in home area: Home MSC delivers the call immediately.
2. User is roaming Home MSC contacts the VLR to determine the appropriate switch in the
roaming area to handle the arriving call and then transfers the call to the roaming area MSC.
 Operation and Maintenance Center (OMC) supervises operation of particular GSM system blocks.
OMC is connected to all switching blocks and performs management functions:
a) Traffic accounting
b) Traffic monitoring

Prepared by : T.Manochandar, AP(S.G)/ECE


c) Management in case of failure
d) HLR management
 Communications between OMC and network blocks is implemented by leased telephone links
or other fixed networks and is performed using the SS7 signaling protocol of X.25 protocol.
4.5.3 Mobile Station
 A Mobile Station (MS) is equipment within the network that is used in applications involving
motion. It can be a hand-held device or any kind of device installed in a mobile vehicle like a
car, bus, boat or airplane.
 Each MS has a unique International Mobile Station Equipment Identity (IMEI) number. The
IMEI is often used for preventing a stolen cell phone from accessing the GSM network. It isn't
used, however, for identifying the subscriber.
 Each MS requires a Subscriber Identification Module (SIM), which stores a unique
international mobile subscriber identity (IMSI). The MS can be locked or unlocked to a SIM
provided by the operator.
 Equipment Identity Register (EIR) contains a list of all valid mobiles. Authentication Center
(AuC) stores the secret keys of all SIM cards. Each handset has a International Mobile
Equipment Identity (IMEI) number.
 Each IMSI contains a unique Mobile Country Code (MCC), a Mobile Network Code (MNC)
and a ciphering key (Kc) for authorization with the Authentication Center (AuC) in the GSM
network subsystem.
SIM card
 Identity modules are synonymous with mobile devices that interoperate with GSM cellular
networks.
 Under the GSM framework, a mobile device is referred to as a mobile station and is partitioned
into two distinct components: The Universal Integrated Circuit Card (UICC) and the Mobile
Equipment (ME).
 A UICC, commonly referred to as an identity module (e.g., Subscriber Identity Module [SIM],
Universal Subscriber Identity Module (USIM), CDMA Subscriber Identity Module [CSIM]),
is a removable component that contains essential information about the subscriber.
 The ME and the radio handset portion cannot fully function without a UICC. The UICC's main
purpose entails authenticating the user of the mobile device to the network providing access to
subscribed services.
 The UICC also offers storage for personal information, such as phonebook entries, text
messages, Last Numbers Dialed (LND) and service related information.

Prepared by : T.Manochandar, AP(S.G)/ECE


Fig. 4.5.3 SIM

SIM stores following types of information:


1. SIM stores the International Mobile Subscriber Identity (IMSI), which is a unique identifier for each
subscriber in the system.
2. Subscribers can maintain a list of the numbers they call or they are called from more frequently.
3. Information about SMS traffic.
4. Information about subscriber's location: The SIM stores the last area where the subscriber has been
registered by the system.
5. Information about calls: The last numbers dialed are stored in a file in the SIM filesystem.
6. Information about the provider: It is possible to extract the provider name and the mobile network
commonly used for communications, along with mobile networks that are forbidden to the subscriber. .
7. Information about the system: Every SIM card has a unique ID stored in it.
 SIM card (Subscriber Identification Module (SIM)) is a type of smart card used in mobile phone.
The SIM is a detachable smart card containing the user's subscription information and phone book.
 This allows the user to retain his or her information even after switching off the handset.
Alternatively, the user can also change service providers while retaining the handset simply by
changing the SIM. SIM card Securely stores the service subscriber key having 15 digits.
The digits of the key are:
a) First 3 digits - Mobile country code
b) Second 2 digits Mobile network code
c) Third 10 digits - Mobile station identification number
BSS Interfaces
 Um interface: Mobile station and base station subsystem communicate across Um interface,
also known as air interface or radio link.
 Abis interface: Base Transceiver Station (BTS) and Base Station Controller (BSC)
communicate across Abis interface.
 A interface: Base station subsystem communicates with mobile service switching center across
A interface.
Prepared by : T.Manochandar, AP(S.G)/ECE
4.5.4 GSM Channel
Physical channel corresponds to a time slot on a frequency carrier. There are 8 physical channels per
carrier in GSM. Physical channel can be used to transmit speech, data or signalling information.

Fig. 4.5.4 shows GSM channel.

 The channel from the base station to the mobile unit is known as the downlink or forward
channel. The channel from the mobile unit to the base station is known as the uplink or reverse
channel.
 Physical channel: Each timeslot on a carrier is referred to as a physical channel.
 Logical channel: Variety of information is transmitted between the MS and BTS. GSM logical
channels consists of two types Control Channels and Traffic Channels.
 Control channels Control Channels is subdivided into three types: Broadcast Control channel,
Common Control Channel and Dedicated Control Channel.
 Channels used for communication between the MS and BSS when a call is in progress.
 Control channels used by idle mode mobiles to exchange signaling information, required
changing to dedicated mode.
• Mobiles in dedicated mode monitor the surrounding base stations for handover and other
information. Control channels include:
1. Broadcast Control Channel (BCCH) serves for BS identification, broadcasts and frequency
allocations.
2. Frequency Correction Channel (FCCH) and Synchronization Channel (SCH) used for
synchronization and physical layer definition (time slots, burst time...)
3. Random Access Channel (RACH) used by mobile to request access to the network
4. Paging Channel (PCH) used for locating the mobile user

Prepared by : T.Manochandar, AP(S.G)/ECE


5. Access Grant Channel (AGCH) used to obtain a dedicated channel. (Following the request of
RACH)
Channel Assignment
Channel assignment is of two types: Fixed and Dynamic.
Fixed channel assignment: Each cell is given a fixed number of channels. Any new call with in a cell
can only be serviced by unused channels in that cell. Otherwise, the call is blocked. A cell which has
run out of channels may "borrow" channels from a neighbouring cell.
Dynamic channel assignment: Channels are allocated to cells based on incoming call requests. It
controlled by a centralized entity, usually a MSC Mobile Switching Centre. Dynamic channel
allocation requires collection of real time data on channel use, traffic distribution across the network
and Received Signal Strength Indication (RSSI) for each channel on a continuous basis.
4.6 OPEN PLATFORM: RASPBERRY PI ARCHITECTURE
8. Explain in detail about Raspberry Pi Architecture with neat diagram.
 A Raspberry Pi is a credit card-sized computer originally designed for education, inspired by
the 1981 BBC Micro.
 Creator Eben Upton's goal was to create a low-cost device that would improve programming
skills and hardware understanding at the pre-university level.
 The Raspberry Pi is slower than a modern laptop or desktop but is still a complete Linux
computer and can provide all the expected abilities that implies, at a low-power consumption
level.
Versions Remarks
Raspberry Pi 1  The original Raspberry Pi had 256 Mb of RAM, which increased to 512 MB
in a later revision. It has a 26-way GPIO connector.
Pi Zero  The Pi Zero includes the GPIO connector, but the header pins are not
soldered.
Raspberry Pi 2  The Raspberry Pi 2 swapped the single-core processor for a much faster
quad-core processor and increased the memory to 1GB RAM.
Raspberry Pi 3  The Raspberry Pi 3 changes the processor to an even more powerful 64-bit
processor. It also adds Wi-Fi and bluetooth which previously needed to be
added as a USB device. The Raspberry Pi 3 Model B was launched in
February 2016.
 To get the Raspberry Pi working an SD card needs to be prepared with the Linux operating
system installed.
 Raspberry Pi users have made many creative and impressive projects using this device. It can
also be programmed to assist in housekeeping your network by functioning as NAS, LDAP
server, web server, media server, DNS server etc.
Prepared by : T.Manochandar, AP(S.G)/ECE
 The Raspberry Pi Foundation recommends Python. Any language which will compile for
ARMv6 can be used. Installed by default on the Raspberry Pi C, C++, Java, Scratch and Ruby.
4.6.1 About the Board
 Fig 4.6.1 shows the Raspberry Pi board. The Raspberry Pi does not have a separate CPU, RAM
or GPU. Instead they are all squeezed into one component called a system on Chip or SoC unit.
 Raspberry Pi is open hardware with the exception of its primary chip, the Broadcomm SoC
which runs the main components of the board CPU, graphics, memory, USB controller etc.

Fig 4.6.1 (a) Block diagram

Fig 4.6.1 (b) Raspberry Pi circuit board


 All of these Raspberry Pi Models share the following features
1. Operating systems: Raspbian RaspBMC. Arch Linux, Rise OS, OpenELEC Pidora.
2. Video output: HDMI Composite RCA.
3. Supported resolutions: 640x350 to 1920x1200, including 1080p, PAL and NTSC standards.
4. Power source: Micro USB
Prepared by : T.Manochandar, AP(S.G)/ECE
Components Descriptions
Processor  Raspberry Pi uses an ARM processor which is also installed in a wide
variety of mobile phones This CPU is single core, however it does have a
co-processor to perform floating point calculations.
Memory  Model B Raspberry PI has 512 MB SDRAM (Synchronous Dynamic RAM).
 It store programs that are currently being run in the CPU
USB ports  Board has two USB ports USB port can provide a current upto 100 mA
 Using powered hub, it is possible to connect more devices
 High Definition Multimedia Interface (HDMI) supports high-quality digital
HDMI video & audio through a single cable
Output  It is also possible to connect a computer monitor with a DVI connection to
HDMI using a converter.
Composite  It supports composite video output with RCA jack and also support PAL.
Video and NTSC.
output  The TVDAC pin can be used to output composite video.
Audio Output  Audio output jack is 3.5 mm.
 This jack is used for providing audio output to old television along with the
RCA jack for video
GPIO Pins  Both models have a total of 26 GPIO pins, organized into one pin header,
named the F1 header
 The newer Raspberry Pi (model B revision 2) adds 8 more GPIO pins in a
new pin header called P5.
 Not all the GPIO pins are programmable. Some of them are 5.0 VDC or 3.3
VDC positive power pins, some of them are negative ground pins and a few
of them are marked DNC (do not connect)
 The P1 header has 17 programmable pins and the P5 header adds 4 more.
 Fig. 4.6.2 shows GPIO pin header.
 Reading from various environmental sensors. Writing output to de motors,
LEDs for status.
Power Input  Micro-USB connector is used for power input.
Status LED  It has five status LED
CSI  Camera Serial Interface (CSI) can be used to connect a camera module to
Raspberry Pi
SD Card Slot  This card is used for loading operating system

Prepared by : T.Manochandar, AP(S.G)/ECE


 The Raspberry Pi comes with a set of 26 exposed vertical pins on the board. These pins are a
General Purpose Input/Output interface that is purposely not linked to any specific native
function on the Raspberry Pi board.

Fig. 4.6.2 GPIO pin header


 Instead, the GPIO pins are there explicitly for the end user to have low-level hardware access
directly to the board for the purposes of attaching other hardware boards, peripherals, LCD
display screens and other hardware devices to the Pi.
The Status LEDs
Status LED Color Functions
ACT Green Lights when the SD card is accessed (marked OK on earlier boarda)
PWR Red Hooked up to 33 V power
FDX Green On if network adapter is full duplex
LNK Green Network activity light
100 Yellow On if the network connection is 100Mbps
 The Raspberry Pi draws its power from a microUSB port and requires a microUSB-to-AC adapter.
Because the Pi is a micro computer and not simply a cell phone getting a battery topped off, you
need to use a high quality charger with stable power delivery that provides a consistent 5V with at
least 700 mA minimum output for older model units and 2.5 A for the Pi 3.
4.6.2 Linux on Raspberry Pi
 There are several unix like operating systems for the RPI and there is an operating system called
RISC OS that has its origin at the developers of the first ARM chips.
 The Raspberry Pi Foundation recommends the use of the following Linux
Prepared by : T.Manochandar, AP(S.G)/ECE
Distributions:
1. Debian 7 2. Raspbian
3. Arch Linux ARM 4. QtonPi
 Raspbian is a free operating system based on Debian optimized for the Raspberry Pi (RPI)
hardware. The default command prompt on the II consists of four components shown in Fig. 6.6.3.
 Raspbian is the desired operating system for the Raspberry Pi. In order to download and install the
operating system onto our Raspberry Pi; you will need Raspbian, Win32DiskImager and USB
memory card reader.
Fig.4.6.3 Command prompt
1. Download both Raspbian and Win32DiskImager and save somewhere easily accessible
2. Plug the USB memory card reader into your computer
3. Open Win32DiskImager
4. Find the location of the image file and the memory card
5. Click "Write"
Logging In
 Now it is time to turn on our Raspberry Pi. When the memory card, HDMI lead, Ethernet cable,
mouse and keyboard are plugged in, plug in the power lead.
 As soon as you do this. You screen should be black and filled with white text. This will be visible
every time you turn on your raspberry pi.
 Wait until your screen reads "raspberrypi login"
Username=pi [ENTER]
Password =raspberry [ENTER]

Prepared by : T.Manochandar, AP(S.G)/ECE


Starting the Raspbian GUI
 GUI stands for Graphical User Interface and is a type of operating system. It is the most common
type of user interface as it is a very friendly' way for people to interact with the computer. It makes
use of pictures, graphics, icons and pointers, hence the name "Graphical User Interface. Fig. 4.6.4
shows Rasbian Linux desktop.
1. Type the line: "startx"

Fig. 4.6.4 Raspbian Linus desktop.

Fig. 4.6.5: First boot time to configure your Pi


4.6.3 Difference between Raspberry Pi is and Desktop Computers
 In Raspberry Pi, operating system is installed on SD card whereas in desktop computer, operating
system is installed in hard disk.
 Raspberry Pi does not have their own CPU and RAM.
 Processing power of Raspberry Pi is less as compared to desktop computers.
 Raspberry Pi uses less power than desktop computers.
Prepared by : T.Manochandar, AP(S.G)/ECE
4.7 RASPBERRY PI INTERFACING
9. Explain in detail about Raspberry PI Interfacing.
Three types of interface is supported by Raspberry Pi
1. Serial
 It uses serial peripherals for serial communication.
 Transmit (TX) and Receive (Rx) pin is used for serial communication.
2. Serial Peripheral Interface (SPI)
 SPI is a communication protocol used to transfer data between micro-computers like the Raspberry
Pi and peripheral devices. These peripheral devices may be either sensors or actuators.
 SPI uses 4 separate connections to communicate with the target device. These connections are the
serial clock (CLK), Master Input Slave Output (MISO), Master Output Slave Input (MOSI) and
Chip Select (CS).
 The clock pin sense pulses at a regular frequency, the speed at which the Raspberry Pi and SPI
device agree to transfer data to each other.
 For the ADC, clock pulses are sampled on their rising edge, on the transition from low to high.
 The MISO pin is a data pin used for the master to receive data from the ADC. Data is read from the
bus after every clock pulse
 The MOSI pin sends data from the Raspberry Pi to the ADC The ADC will take the value of the
bus on the rising edge of the clock. This means the value must be set before the clock is pulsed.
 The Chip Select line chooses which particular SPI device is in use. If there are multiple SPI
devices, they can all share the same CLK, MOSI and MISO.
The SPT has the following features:
1. 16-bit shift register
2. 16-bit Receive buffer register (SPIBUF) and 16-bit Receive buffer emulation alias register
(SPIEMU)
3. 16-bit Transmit data register (SPIDATO) and 16-bit Transmit data and format selection register
(SPIDAT1)
4. 8-bit baud clock generator
5. Serial clock (SPICLK) I/O pin
6. Slave in, master out (SPISIMO) I/O pin
7. Slave out, master in (SPISOMI) I/O pin
8. Multiple slave dúp select (SPISCSI) I/O pins (4 pin mode only)
9. Programmable SPI clock frequency range
10. Programmable character length (2 to 16 bits)
11. Programmable clock phase (delay or no delay)
12. Programmable clock polarity (high or low)

Prepared by : T.Manochandar, AP(S.G)/ECE


13. Interrupt capability
14. DMA support (read/write synchronization events)
15. Up to 66 MHz operation
Master-slave configuration of SPI
 Fig. 4.7.1 shows SPI system. SPI bus is composed by four signals, namely the Master Out Slave In
(MOSI), Master In Slave Out (MISO), serial clock (SCK) and active low slave select (\SS).
 MOSI: This pin is used to transmit data out of the SPI module when it is configured as a Master and
receive data when it is configured as Slave.
 MISO: This pin is used to transmit data out of the SPI module when it is configured as a Slave and
receive data when it is configured as Master.

 /SS: This pin is used to output the select signal from the SPI module to another peripheral with which a

data transfer is to take place when its configured as a Master and its used as an input to receive the
slave select signal when the SPI is configured as Slave.
 SCLK: This pin is used to output the clock with respect to which the SPI transfers data or receive
clock in case of Slave.

Fig. 4.7.1 SPI


 SCK master device will generate a pulse and the data will be synchronized in both master and slave
devices. There are four different clock types to define SIP protocol, depending on what the SCK
polarity and phase may be. It must ensure these signals between the master and slave devices
compatible with each other.
 SPI is a Synchronous protocol. The clock signal is provided by the master to provide synchronization.
The clock signal controls when data can change and when it is valid for reading.
 SPI creates a data loop between two devices. Data leaving the master exits on the SDO (serial data
output) line. Data entering the master enters on the serial data input, SDI line.
 A clock (SCK), is generated by the master device. It controls when and how quickly data is exchanged
between the two devices.
 SS allows a master device to control when a particular slave is being addressed. This allows the
possibility of having more than one slave and simplifies the communications. When the SS signal goes
low at a slave device, only that slave is accessed by SPI
Prepared by : T.Manochandar, AP(S.G)/ECE
 For SPL, there are Serial Clocks (SCLK), Chip Select lines (CS), Serial Data In (SDI) and Serial Data
Out( SDO). There is only one master, there number of slaves depends on the number of chip select
lines of the master.
 Synchronous operation, latch on rising or falling edge of clock, SDI on rising edge, SDO on falling
edge. It operates in 1 to 2 MHz range.
 Master sends out clocks and chip selects. Activates the slaves it wants to communicate with.
 Fig. 4.7.2 master with multiple slave interface.

Fig. 4.7.2 Multiple slave interface

 SPI data transmit and data receive register are the main elements of the SPI. When the
communication takes place the data on the transmit register are transferred into the shift register.
 The shift register in the master of width (8,16,32) and the shift register in the slave are linked by
MOSI and MISO pins to form a distributed 16,32,64 bit register respectively.
 When the data transfer operation needs to be performed these 16,32,64- registers are serially
shifted eight, sixteen, thirty-two bit positions by the serial clock generated by the master so that the
data can be exchanged between the master and the selected slave.
 Data on the master SPI data transmit register becomes the input data for the slave read from the
MOSI and the data read from the master SPI data receive register was the data send from the slave
from MISO.
 Data on the shift registers are transferred into data receive register when the transfer completes and
this data may be read from the data receive register any time before next transfer has completed.
3. I2C
 I2C is a communication protocol that the Raspberry I'I can use to speak to other embedded devices
(temperature sensors, displays, accelerometers, etc).

Prepared by : T.Manochandar, AP(S.G)/ECE


 I2C is a useful bus that allows data exchange between microcontrollers and peripherals with a
minimum of wiring.
 I2C is a two wire bus, the connections are called SDA (Serial Data) and SCL (Serial Clock). Each
I2C bus has one or more masters (Raspberry Pi) and one or more slave devices, like the I/O
Expander.
 As the same data and clock lines are shared between multiple some way to choose which device to
communicate with.
GENERAL PURPOSE INPUT/OUTPUT (GPIO)
10. Explain in detail about General Purpose Input/Output (GPIO)
 General Purpose Input/Output (GPIO) is a generic pin on a chip whose behavior can be controlled
by the user at run time. The GPIO connector has a number of different types of connection:
1. True GPIO pins that you can use to turn LEDs on and off etc.
2. I2C interface pins that allow you to connect hardware modules with just two control pins.
3. SPI interface with SPI devices, a similar concept to 12C but uses a different standard.
4. Serial Rx and Tx pins for communication with serial peripherals.
4.8.1 Controlling LED with Raspberry Pi
Fig 4.8.1 shows diagram of connecting LED to Raspberry Pi . The LED will initially be off because
the GPIO pins are initialized as inputs at power-on.
Install Python 2 library Rpi.GPIO. A library that will let us control the GPIO pins
Install commands:
sudo apt?get update
sudo apt?get install python?dev
sudo apt?get install python?rpi.gpio

Fig 4.8.1 Connecting LED to Raspberry Pi

Prepared by : T.Manochandar, AP(S.G)/ECE


Simple LED Circuit is shows below:

Fig. 4.8.2

 Current flows from the anode (+) to cathode (-). Anode is longer pin and cathode is shorter pin.
 Open up IDLE, the Python programming software and create a New file. Save it as led.py and
input the code from the code listing. What the code does is first tell Python to use the GPIO
module so we can connect to the GPIO pins, by importing the module.
 We then import the time module so we can create a delay between commands. We then tell the
code to treat the GPIO pins as the number they are on the board and to turn the seventh pin into an
output.
 We alternate between True and False so that it turns the pin on and off. Once it's cycled a few
times, it will print the message Done' into IDLE and finally turn off the GPIO pins.

Fig. 4.8.3

Import RPI.GPIO as GPIO


GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.OUT)
GPIO.output(7, True)
GPIO.output(7,False)
time.sleep(1)
GPIO.output(7, True)
GPIO.output(7, False)
print"Done"
GPIO.cleanup()

Prepared by : T.Manochandar, AP(S.G)/ECE


Task 1: Turn LED on for 2 seconds and off for 1 second, loop forever. Code is given below:
(In this example, we use diagram (b), ie, controlling the LED by controlling the voltage at the anode
(+)),
import RPI.GPIO as GPIO
Import time
def main():
GPIO.cleanup()
GPIO setmode(GPIO.BOARD) # to use Raspberry Pi board pin numbers
GPIO setup(11, GPIO.OUT) #set up GPIO output channel
while True:
GPIO.output(11, GPIO.LOW) #set RPi board pin 11 low. Turn off LED.
time.sleep(1)
GPIO.output(11, GPIO HIGH) # set RPi board pin 11 high. Turn on LED.
time.sleep(2)
main()
Example: Display digit ton 7-segment LED. It t is most direct way to control display:
1. Connect pin 3/8 of 7-seg-LED to Vcc
2. Connect the other 8 pins to 8 GPIO pins
3. Configure the 8 GPIO pins as out
For example: display "2". Turn on segments A, B, D, E, G and turn off segments C, F, DP. Set A, B,
D, E, G to LOW and set C, F, DP to HIGH. Set Pin 7, 6, 2, 1, 10 LOW and Set pin 4, 9, 5 HIGH.
4.8.2 Interfacing an LED and Switch with Raspberry PI
 When the switch is not pushed: GPIO detects Voc (HIGH)
 When the switch is pushed: GPIO detects GND (LOW
GPIO Input Sample Code
import RPLGPIO as GPIO
#Use the pin numbers from the ribbon cable board
GPIO.setmode (GPIO.BCM)
#Set up this pin as input.
GPIO setup (17, GPIO.IN)
#Check the value of the input pin
GPIO.input (17)

#Hold down the button, run the command again. The output should be "true".

GPIO.input(17)

Prepared by : T.Manochandar, AP(S.G)/ECE


Fig. 4.8.4
4.8.3 Interfacing Light Sensor
 Unlike some other devices the Raspberry Pi does not have any analogue inputs. All 17 of its GPIO
pins are digital. They can output high and low levels or read high and low levels.
 For sensors that act as a variable resistor such as LDRs (Light Dependent Resistors) or thermistors
(temperature sensors) there is a simple solution. It allows you to measure a number of levels using
a single GPIO pin. In the case of a light sensor this allows you to measure different light levels.
 Fig 4.8.5 shows diagram of connecting an LDR to Raspberry Pi.

Fig.4 .8.5 Diagram of connecting an LDR to Raspberry PI


 Following are steps:
1. First connect pin number 1 (3v3) to the positive rail on the breadboard.
2. Next connect pin number 6 (ground) to the ground rail on the breadboard.
3. Now place the LDR sensor onto the board and have a wire go from one end to the positive rail
4. On the other side of the LDR sensor place a wire leading back to the Raspberry Pi. Hook this to pin
number 7.

Prepared by : T.Manochandar, AP(S.G)/ECE


5. Finally place the capacitor from the wire to the negative rail on the breadboard. Make sure you have
the negative pin of the capacitor in the negative rail.
• Fig 6.8.6 shows circuit diagram for above configuration.

Fig. 4.8.6 Circult diagram for LDR


The sequence of events:
1. Set the GPIO pin as an output and set it Low. This discharges any charge in the capacitor and
ensures that both sides of the capacitor are 0 V.
2. Set the GPIO pin as an input. This starts a flow of current through the resistors and through the
capacitor to ground. The voltage across the capacitor starts to rise.
The time it takes is proportional to the resistance of the LDR.
3. Monitor the GPIO pin and read its value. Increment a counter while we wait.
4. At some point the capacitor voltage will increase enough to be considered as a High by the GPIO
pin (approx 2v). The time taken is proportional to the light level seen by the LDR.
5. Set the GPIO pin as an output and repeat the process as required.
Python Code:
#!/usr/local/bin/python
#Reading an analogue sensor with a single GPIO pin
import RPL.GPIO as GPIO, time
#Tell the GPIO library to use
#Broadcom GPIO references
GPIO setmode(GPIO.BCM)
# Define function to measure charge time
def RCtime (PiPin):
measurement = 0
#Discharge capacitor

Prepared by : T.Manochandar, AP(S.G)/ECE


GPIO.setup(PiPin, GPIO OUT)
GPIO.output(PiPin, GPIO LOW)
time.sleep(0.1)
GPIO.setup(PiPin, GPIO.IN)
#Count loops until voltage across
# capacitor reads high on GPIO
while (GPIO.input(PiPin) GPIO.LOW):
measurement+=1
return measurement
#Main program loop
while True:
print RCtime (4) #Measure timing using GPIO4

4.9 CONNECTING TO THE CLOUD


11. Explain in detail about connecting to the cloud.
 Cloud connections are convenient and encrypted end-to-end and highly recommended for
connections over the Internet. There's no firewall or router reconfiguration and you don't need to
know the IP address of your Raspberry Pi, or provide a static one.
 Raspberry Pi and Google Cloud IoT provide a variety of opportunities for rapid prototyping. While
Raspberry Pi is a powerful prototyping board on its own, cloud connectivity allows for porting
embedded solutions to other boards and IoT devices.
4.9.1 WAMP: AutoBahn for IoT
 WAMP stands for Web Application Messaging Protocol. It is sub-protocol of
 web-socket and provides publish-subscribe and RPC messaging pattern. WAMP is a routed
protocol, with all components connecting to a WAMP Router, where the WAMP Router performs
message routing between the components.
 It supports distributed application architecture. Application components are distributed and run on
mobile nodes and WAMP provides communication in between them.
 WAMP does not make any extra standard, but it bases on established Web standards: WebSocket,
JSON and URI. The WebSocket standard is the default transport channel where WAMP is binding.
With the WebSocket Standard, WAMP is assumed to be given a reliable, ordered and full-duplex
message channel.
 The PubSub messaging pattern defines three roles: Subscribers and Publishers, which
communicate via a Broker. The routed RPC messaging pattern also defines three roles: Callers and
Callees, which communicate via a Dealer.

Prepared by : T.Manochandar, AP(S.G)/ECE


Key components of WAMP:
1. Transport: It is communication channel which connects two peers. WebSocket is default transport
for WAMP. WAMP also uses other transport protocol which is reliable and bi-directional
communication.
2. Session: Conversation between two is called as session.
3. Client: Clients are peers that can have one or more roles. In publish-subscribe model, client can
have following roles:
 Message producers are called publishers, whereas message consumers are called subscribers.
Messages published to a topic using the publish-and-subscribe model can be received by multiple
subscribers. Every subscriber receives a copy of each message, message is broadcasted. Fig. 6.9.1
shows publish-subscribe model

Fig. 4.9.1 Publish-subscribe model

Role of client in RPC model is as follows:


1. The caller program, which represents the client instance in the client/server model sends a call
message to the server process, and waits for a reply message.
2. Callee: Callee executes the producer to which the calls are issued by the caller and returns the
result back to the caller. Routers are peers that perform generic call and event routing. Router act as
Broker in publish-subscribe model.
Broker: It act as a router and routes the messages published to a topic to all subscriber subscribed to
the topic.
In RPC model router has the role of a broker:
1. Dealer: It act as router and routes the RPC calls from the caller to the callee and routes results from
callee to caller.

 Application code runs on client machine. Fig. 4.9.2 shows WAMP session between client and

router.

Prepared by : T.Manochandar, AP(S.G)/ECE


Fig. 4.9.2 (a) Publisher-subscriber

Dealer

caller callee

Fig. 4.9.2 (b) RPC

 A WAMP Session connects two Peers, a Client and a Router. Each WAMP Peer MUST implement
one role and MAY implement more roles. A Client MAY implement any combination of the
Roles: Callee, Caller, Publisher and Subscriber.

Fig. 4.9.3 WAMP session between client and router

 Router MAY Implement either or both of the Roles: Dealer and Broker.
 WAMP implementations may choose to tie the lifetime of the underlying transport connection for a
WAMP connection to that of a WAMP session, Le establish a new transport-layer connection as
part of each new session establishment. They may equally choose to allow re-use of a transport
connection, allowing subsequent WAMP sessions to be established using the same transport
connection.
 Fig. 4.9.4 shows the full transport connection and session lifecycle for an implementation which
uses WebSocket over TCP as the transport and allows the re-use of a transport connection.

Prepared by : T.Manochandar, AP(S.G)/ECE


Autobahn
 Autobahn is an open-source real-time framework enabling Implementations of the WAMP and
WebSocket protocols using multiple languages that are supported by Tavendo. These languages
Include Autobahn Python (based on Python), Autobahn JS (based on JavaScript), Autobahn Cpp
(based on C++) and Autobahn Android.

Fig. 4.9.4 the full transport connection and session lifecycle


 Each language is considered a subproject with its own sub-community and developers. Autobahn
Python is utilized as part of Crossbar.io itself. While these four libraries are supported by Tavendo,
other libraries are provided by third-parties including ones based on other languages not supported
by Tavendo such as C#, Java and PHP. Autobahn also includes a fully automated testing tool
called Autobahn Testsuite.
 Here is a simple WebSocket echo server that will echo back any WebSocket message received:
from autobahn.twisted websocket import WebSocketServerProtocol
class MyServer Protocol(WebSocketServerProtocol):
def onConnect(self, request):
print("Client connecting: []".format(request.peer))
def onOpen(self):
print("WebSocket connection open.")
def onMessage(self, payload, isBinary);
if isBinary:
print("Binary message received: {} bytes'.format(len(payload)))
else:

Prepared by : T.Manochandar, AP(S.G)/ECE


print("Text message received: ()".format(payload.decode('utf8')))
#echo back message verbatim
self.sendMessage(payload, isBinary)
def onClose(self, wasClean, code, reason):
print("WebSocket connection closed: ()".format(reason))
4.9.2 Xively Cloud for IoT
 Xively is a division of LogMeln Inc. (NASDAQ LOGM), a global, public company that provides
remote access and collaboration products including Rescue. Boldchat, join me and Cubby.
 The term IoT cloud platform is used for the cloud platforms that provide very specific services,
protocol support and web-based tools for IoT applications.
 Managing a cloud loT network is a highly complicated task. Provisioning. Connecting and
monitoring thousands or millions of devices is one challenge, but handling and integrating the large
volumes of real-time data they produce is more difficult.
 To simplify your move to the cloud lot space, you need a powerful but easy-to-use IoT cloud
platform that lets you reduce the cost, complexity and risk of developing a connected business.
Xively's cloud IoT platform makes things easy.
With cloud IoT technology from Xively, you can:
1. Model and develop new lot products.
2. Connect both new and existing products quickly and easily.
3. Minimize the complexity and reduce the risk of running a connected business.
4. Tum data and relationships into insight that can help you deliver greater value to customers.
Features of Xively's cloud lot technology:
1. Blazing fast speed and infinitely scalable connectivity, with the hardware and software to process
messages from millions of devices at sub-second speeds.
2. Device management tools for provisioning, monitoring and updating devices.
3. Authentication tools for managing identities and authenticating devices.
4. Security features that offer end-to-end protection of devices and the data residing on them.
5. Remote device support that enables connected products to autonomously communicate problem to
OEMs. providing context that can be used to troubleshoot devices automatically or manually.
6. Support for a device cloud that can be used to test new devices.
 Xively allows devices to securely connect at scale to transmit and store data.
 Following is the Python program using Raspberry Pi which will receive temperature readings every
10 seconds and display the most recent temperature reading and a graph of past readings.
#!/ usr/bin/env python
import os
import xively

Prepared by : T.Manochandar, AP(S.G)/ECE


Import subprocess
import time
Import datetime
import requests
FEED_ID= “YOURFEEDID”
API_KEY =”YOURAPIKEY”
#initialize api client
api=xively. XivelyAPIClient(AΡΙ_ΚΕΥ)
#function to read the temperature from da18b20 temperature sensor on i2cdef
read_temperature():
tempfile = open("/sys/bus/w1/devices/YOURTEMPERATURESENSORID/w1_slave")
thetext= tempfile.read()
tempfile.close()
tempdata =thetext.split("\n")[1].split("")[9]
temperature =float(tempdata(2:1)
temperature= temperature/1000
return temperature
#function to return a datastream object. This either creates a new datastream, or returns an existing one
def get_datastream(feed):
try:
datastream =feed.datastreams.get("Temperature Sensor”)
return datastream
except:
datastream=feed.datastreams.create("Temperature Sensor", taga'temperature")
return datastream
#main program entry point runs continuously updating our data stream with the latest
temperature reading
def run()
feed= api.feeds.get(FEED_ID)
datastream=get_datastream(food)
dataatzeam.max_value = None
datastream.min _value = None
while True:
degreesCelcius =read_ temperature()
datastream.current _value =degreesCelcius
datastream.at =datetime.datetime.utcnow()

Prepared by : T.Manochandar, AP(S.G)/ECE


try:
datastream.update()
except requests HTTPError as e
print "HTTPError((0)) (1) format(e.errno, e.strerror)
time.sleep(10)
run()
Steps for sending data from device to Xively:
1. Download the Arduino IDE
2. Install Xively and the HN P Client libraries.
3. Connect the hardware module to Arduino.
4. Login to Xively and register a new device.
5. Copy the API KEY and the FEED_ID to the clipboard.
6. Download the example sketch for Arduino.
7. Change the SSID, the Password, the API KEY and the FEE ID in the source code.
8. Compile and upload the example.
9. Debug the program by using the Arduino Terminal.
10. Verify the data storage in Xively.
11. Switch on/off the light from Xively.

 Xively is available for many platforms since libraries for Arduino, Android, ARM embeded, C.
Electric Imp, Java, JavaScript, Objeccve-C, PHP, Python and Ruby are available.
 Xively provides message bus for real time message management and routing, data services for time
archiving, directory services that provides a searchable directory of objects and business services for
device provisioning and management.
 Xively device support one or more channels. Each channel enables bi-directional communication
between the loT devices and Xively cloud.

Prepared by : T.Manochandar, AP(S.G)/ECE


TWO MARKS
Q.1 What is Raspberry PI?
Ans. Raspberry Pi is a low-cost, credit card-sized computer that connects to a computer monitor or TV
using HDMI, and uses a standard keyboard and mouse. It can run a host of operating systems, such as
Raspbian, Android, Windows 10, IoT Core, etc.
Q.2 What are the different raspberry pi model types?
Ans. The Raspberry Pi models are of two types:
1. Model A (introduced later as a hardware-reduced model)
2. Model B (introduced first and is the full hardware model)
Q.3 What is Arduino?
Ans. Arduino is an open-source electronics platform based on easy-to-use hardware and software.
Arduino boards are able to read inputs light on a sensor, a finger on a button, or a Twitter message and
turn it into an output activating a motor, turning on an LED, publishing something online
Q.4 Explain difference between Model A and Model B of Raspberry Pi.
Parameters Model A Model B
GPU type Video Com IV VideoCore IV
USB port 1 2
Memory 256 MB 512 MB
Ethernet port No Ethernet port 10 / 100 Ethernet
SoC Type Broadcom BCM2837B0 Broadcom BCM2837B0
Number of Cores 4 4
Type It is hardware-reduced model. It is full hardware model.

Q.5 What is Python?


Ans.: Python is an object-oriented, high-level programming language with integrated dynamic
semantics primarily for web and app development.
Q.6 List and explain features of Python.
Ans. Features:
1. Python is a simple and minimalistic language
2. Easy to Learn
3. Free and Open Source
4. Python supports procedure-oriented programming as well as object-oriented Programming
5. Extensive Libraries: The Python Standard Library is huge indeed.
6. Embeddable: You can embed Python within your C/C++ programs to give scripting capabilities for
your program's users.

Prepared by : T.Manochandar, AP(S.G)/ECE


Q.7 List the benefits of Python.
Ans. Python can be used to develop prototypes.
 Python allows for a more productive coding environment than massive languages like C and
Java.
 Python powers Django, a complete and open source web application framework.
 Most automation, data mining, and big data platforms rely on Python.
 Python supports modules and packages, which encourages program modularity and code reuse.
Q.8 What is GND in GPIO?
Ans.: GND means ground pins. Ground GPIO pins are physical numbers 6, 9, 14, 20, 25, 30, 34 & 39.
Q.9 Define Raspberry Pi hardware.
Ans. Raspberry Pi hardware includes ARM processor, GPU, RAM and USB port.
Q.10 What is Raspbian OS?
Ans. Raspbian is a free operating system based on Debian optimized for the Raspberry Pi hardware.
 An operating system is the set of basic program a and utilities that make your Raspberry Pi run.
 As Raspbian is a Linux operating system it has good security features, has excellent networking
capabilities. Raspbian is highly optimized for the Raspberry 1 line's low-performance ARM
CPUs
Q.11 What is GSM?
Ans. GSM stands for Global System for Mobile communication. It is widely used for digital cellular
radio. It is a second generation cellular standard developed to cater voice services and data delivery
using digital modulation. It supports 200 full duplex channels per cell. Each channel uses different
uplink and downlink frequency.
Q.12 What is IEEE 802.15.47?
Ans.: IEEE 802.15.4 is simple packet data protocol for lightweight wireless networks. Channel access
is via Carrier Sense Multiple Access with Collision Avoidance and optional time slotting. It provides
multi-level security.
Q.13 What are GPS satellite signals?
Ans. Satellites are continually broadcasting their orbital position and exact time at that position on
radio frequencies. That signal is received by antennas, along with at least three other satellite signals,
then processed in a GPS receiver to compute a user's location.
Q.14 Explain Publish / Subscribe pattern.
Ans.: The Publish/Subscribe pattern allows a loose coupling between communication partners. There
are services offering information and advertise those offers on a broker component. When clients
declare their interest in certain information on the broker the component will make sure the
information flow between service and client will be established.

Prepared by : T.Manochandar, AP(S.G)/ECE


Q.15 List the functions of ZigBee coordinator.
Ans.: Functions of ZigBee coordinator:
1. It forms a network.
2. It establishes the 802.15.4 channel on which the network will operate.
3. It establishes the extended and short PAN ID for the network.
4. It decides on the stack profile to use (compile or run-time option).
Q.16 Define cell.
Ans. Each cellular base station is allocated a group of radio channels within a small geographic area
called a cell
Q.17 If you lose your cell phone you would deactivate your SIM. How is this achieved in the
GSM architecture?
Ans. Equipment Identity Register (EIR) is a database that keeps tracks of handsets on the network
using the IMEI. There is only one EIR per network. It is composed of three lists; the white list, the
gray list, and the black list. The black list is a list if IMEls that are to be denied service by the network
for some reason. Reasons include the IMEI being listed as stolen or cloned or if the handset is
malfunctioning or doesn't have the technical capabilities to operate on the network.
Q.18 Differentiate between CDMA and GSM networks in terms of sharing access to the channel.
Ans: GSM uses TOMA/FDMA access scheme in order to assign channels to the different subscribers
to utilize the service from the service operator's base stations. One frequency and one time slot (f1, 11)
is needed for one way communication and a pair for two-way communication. CDMA uses PN codes
for communication between subscribers and Node BS.

Prepared by : T.Manochandar, AP(S.G)/ECE

You might also like