Unit 4
Unit 4
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
R.Rama Rajesh.,M.E.MBA.,MHRM., 1
IOT COMMUNICATION AND OPEN PLATFORMS
retrieves the data from the database or resource representation, and converts it to an encoded
response that is sent back to the client. The client then receives the response.
On the other hand, in the Request-Response communication model, the client sends a
request to the server and the server responds to the request by deciding how to retrieve the data
or resources needed to prepare the response. Once prepared, the server sends the response back
to the client.
2. Request & Response Model
This model follows a client-server architecture. The client, when required, requests the
information from the server. This request is usually in the encoded format. This model is
stateless since the data between the requests is not retained and each request is independently
handled. The server Categories the request, and fetches the data from the database and its
resource representation. This data is converted to response and is transferred in an encoded
format to the client. The client, in turn, receives the response.
In Request-Response communication model client sends a request to the server and the
server responds to the request. When the server receives the request it decides how to
respond,fetches the data retrieves resources, and prepares the response, and sends it to the client.
3. Publisher-Subscriber Model
This model comprises three entities: Publishers, Brokers, and Consumers. Publishers are
the source of data. It sends the data to the topic which are managed by the broker. They are not
aware of consumers. Consumers subscribe to the topics which are managed by the broker.
Hence, Brokers responsibility is to accept data from publishers and send it to the
appropriate consumers. The broker only has the information regarding the consumer to which a
particular topic belongs to which the publisher is unaware of.
R.Rama Rajesh.,M.E.MBA.,MHRM., 2
IOT COMMUNICATION AND OPEN PLATFORMS
4. Push-Pull Model
The push-pull model constitutes data publishers, data consumers, and data queues.
Publishers and Consumers are not aware of each other. Publishers publish the message/data and
push it into the queue. The consumers, present on the other side, pull the data out of the queue.
Thus, the queue acts as the buffer for the message when the difference occurs in the rate of push
or pull of data on the side of a publisher and consumer. Queues help in decoupling the messaging
between the producer and consumer. Queues also act as a buffer which helps in situations where
there is a mismatch between the rate at which the producers push the data and consumers pull the
data.
5. Exclusive Pair
Exclusive Pair is the bi-directional model, including full-duplex communication among
client and server. The connection is constant and remains open till the client sends a request to
close the connection.
R.Rama Rajesh.,M.E.MBA.,MHRM., 3
IOT COMMUNICATION AND OPEN PLATFORMS
The Server has the record of all the connections which has been opened. This is a state-
full connection model and the server is aware of all open connections. WebSocket based
communication API is fully based on this model.
IOT APPLICATION PROGRAMMING INTERFACE
Application Programming Interface or an API is a set of definitions and protocols
through which applications communicate with each other. With API your application or service
can use the functions provided by another application without needing to know how that other
application is being implemented. APIs can also serve as an intermediary layer for data transfers
between system applications, allowing businesses to open their application data and functionality
to third-party developers, business partners, as well as internal departments within their
organizations.
In IoT specifically, APIs are used to gather and transfer data from the connected device to
an application or computer. They are also used to instruct a connected device to take a particular
action. Because connected devices can be anywhere in the world, having an API makes it
possible to remotely access a device and make the data useful.
An API is a way to enable users to programmatically access information about their
devices and make decisions or take actions based on it. There are an endless number of ways
they can work together in IoT.
A few examples include:
1. Managing a fleet: Everything from activating devices to billing and reporting are all
done via the API.
2. Preventing fraud: Leveraging the API enables users to create alerts if a device is
moved or if a SIM card was stolen. We’ve also seen users configure SMS limits to
prevent high data charges if a device is stolen.
R.Rama Rajesh.,M.E.MBA.,MHRM., 4
IOT COMMUNICATION AND OPEN PLATFORMS
API endpoint
An API endpoint is the source which you want to get the data from. In more technical
terms, it’s an API call. The most obvious API endpoint in IoT is at the device level, gathering
data from the connected device. This collects data usage, connectivity status, and any other
additional data an IoT application is intending to collect. Beyond the device endpoint, there are
many other useful endpoints within an IoT deployment. For example, a team may use the API to
collect data as it relates to billing, making finance reporting programmatic.
Types of API
There are four common types of APIs. They are
1. Public
2. Partner
3. Internal
4. Composite.
Public APIs
Public APIs, also known as Open APIs, are available to the public with no restrictions.
This enables developers outside of an organization to access data to enhance their own
application. Single sign on, using your email or social media account, is made possible through
Public APIs, bringing in the email provider or social platform code into your application.
Partner APIs
Partner APIs can be leveraged by a client or partner of an application. These APIs require
users to sign in and authenticate with an API key to access the API. The Hologram API is an
example of a Partner API, allowing customers to communicate directly with their connected
devices and bring data back to their applications.
Internal APIs
APIs used by a company to build and manage their applications are internal or private
APIs. This ensures that only those working on a product have access to make changes to a
product or to the sensitive data on a platform.
Composite APIs
Composite APIs batch several API requests into a single API call. This reduces the
number of trips to a server. By grouping a chain of API calls into one API, a client can make one
API request that includes a chain of calls and end with one response.
R.Rama Rajesh.,M.E.MBA.,MHRM., 5
IOT COMMUNICATION AND OPEN PLATFORMS
R.Rama Rajesh.,M.E.MBA.,MHRM., 6
IOT COMMUNICATION AND OPEN PLATFORMS
1. Bluetooth
Standard communication protocols help in unleashing the full potential of the internet of
things. More than one third of Iot devices contain bluetooth connectivity. Bluetooth is a form of
wireless technology used for device communication and to make personal area networks(PANs).
The latest version is the bluetooth5 and it has features such as high range, speed and data
broadcasting.
Bluetooth connects to devices with smaller distances and changes the device interaction.
It has some empowering features that support IoT devices. Bluetooth low energy(BLE) supports
devices that require less power and ideal for IoT enabled projects.
2. Zigbee
ZIgbee is a WLAN and a wireless technology that aims to support extremely low power
devices. It supports these kinds of devices and makes it possible to connect them to the internet.
It is an open global standard and works on IEEE 802.15.4 physical radio standards.
IoT devices do not require extra functionality and Zigbee is an ideal protocol for
transferring data from one communication point to another. Zigbee makes data flow easy. It is
used to send small amounts of data using very less power which is why it is used in machine to
machine communication(M2M) and IoT.
R.Rama Rajesh.,M.E.MBA.,MHRM., 7
IOT COMMUNICATION AND OPEN PLATFORMS
R.Rama Rajesh.,M.E.MBA.,MHRM., 8
IOT COMMUNICATION AND OPEN PLATFORMS
8. Ethernet
Ethernet is a communication standard that was developed in the early 80s to network
between local devices and computers. The local environment is labeled as a local area
network(LAN). LAN creates a common environment for devices to receive and share
information among one another. Ethernet however offers a wired form of communication. Since
it does not offer wireless communication the set becomes a bit costly and is not the ideal option
for IoT communication.
9. NFC
NFC stands for near-field communication. It is a wireless technology for short-distance
communication. However, the NFC-enabled devices must be in close proximity to each other so
that they can communicate via radio waves. One of the devices should be an active device such
as a smartphone or tablet and the other device can be passive such as an NFC tag. The active
devices require an external power supply while the passive devices do not.
10. LPWAN
LPWAN stands for low power wide area network. It offers wireless communication
between devices that consume less amounts of power. It connects these devices to the internet to
send and receive messages from devices within the same network. Some examples of LPWAN
are sigfox and LoRa.
11. LoRaWAN
Low range wide area network or LoRaWAN is a wide area network protocol. It was
constructed to connect objects to the internet and to act as a mode of communication between
these objects. These objects could be home automation devices, smart cars, thermostats and so
on.
BLUETOOTH
Bluetooth is universal for short-range wireless voice and data communication. It is a
Wireless Personal Area Network (WPAN) technology and is used for exchanging data over
smaller distances. This technology was invented by Ericson in 1994. It operates in the
unlicensed, industrial, scientific, and medical (ISM) band from 2.4 GHz to 2.485 GHz.
Maximum devices that can be connected at the same time are 7. Bluetooth ranges up to 10
meters. It provides data rates up to 1 Mbps or 3 Mbps depending upon the version.
R.Rama Rajesh.,M.E.MBA.,MHRM., 9
IOT COMMUNICATION AND OPEN PLATFORMS
Bluetooth simply follows the principle of transmitting and receiving data using radio
waves. It can be paired with the other device which has also Bluetooth but it should be within the
estimated communication range to connect. When two devices start to share data, they form a
network called piconet which can further accommodate more than five devices. The spreading
technique that it uses is FHSS (Frequency-hopping spread spectrum). A Bluetooth network is
called a piconet and a collection of interconnected piconets is called scatternet.
Piconet:
Piconet is a type of Bluetooth network that contains one primary node called the master
node and seven active secondary nodes called slave nodes. Thus, we can say that there is a total
of 8 active nodes which are present at a distance of 10 meters. The communication between the
primary and secondary nodes can be one-to-one or one-to-many. Possible communication is only
between the master and slave; Slave-slave communication is not possible. It also has 255 parked
nodes, these are secondary nodes and cannot take participation in communication unless it gets
converted to the active state.
Scatternet:
It is formed by using various piconets. A slave that is present in one piconet can act as
master or we can say primary in another piconet. This kind of node can receive a message from a
master in one piconet and deliver the message to its slave in the other piconet where it is acting
as a master. This type of node is referred to as a bridge node. A station cannot be mastered in two
piconets.
R.Rama Rajesh.,M.E.MBA.,MHRM., 10
IOT COMMUNICATION AND OPEN PLATFORMS
Radio (RF) layer: It specifies the details of the air interface, including frequency, the use of
frequency hopping and transmit power. It performs modulation/demodulation of the data into RF
signals. It defines the physical characteristics of Bluetooth transceivers. It defines two types of
physical links: connection-less and connection-oriented.
Baseband Link layer: The baseband is the digital engine of a Bluetooth system and is
equivalent to the MAC sublayer in LANs. It performs the connection establishment within a
piconet, addressing, packet format, timing and power control.
Link Manager protocol layer: It performs the management of the already established links
which includes authentication and encryption processes. It is responsible for creating the links,
monitoring their health, and terminating them gracefully upon command or failure.
Logical Link Control and Adaption (L2CAP) Protocol layer: It is also known as the heart of
the Bluetooth protocol stack. It allows the communication between upper and lower layers of the
Bluetooth protocol stack. It packages the data packets received from upper layers into the form
expected by lower layers. It also performs segmentation and multiplexing.
Service Discovery Protocol (SDP) layer: It is short for Service Discovery Protocol. It allows
discovering the services available on another Bluetooth-enabled device.
RF comm layer: It is a cabal replacement protocol. It is short for Radio Frontend Component. It
provides a serial interface with WAP and OBEX. It also provides emulation of serial ports over
the logical link control and adaption protocol(L2CAP). The protocol is based on the ETSI
standard TS 07.10.
R.Rama Rajesh.,M.E.MBA.,MHRM., 11
IOT COMMUNICATION AND OPEN PLATFORMS
R.Rama Rajesh.,M.E.MBA.,MHRM., 12
IOT COMMUNICATION AND OPEN PLATFORMS
network without an AP and can agree to be a part of a BSS. A BSS without an AP cannot send
data to other BSSs and defines a standalone network. It is called Ad-hoc network or Independent
BSS(IBSS).i.e A BSS without AP is an ad-hoc network. A BSS with AP is infrastructure
network. The figure below depicts an IBSS, BSS with the green coloured box depicting an AP.
R.Rama Rajesh.,M.E.MBA.,MHRM., 13
IOT COMMUNICATION AND OPEN PLATFORMS
Multiple Device Connectivity: Wi-Fi networks can support multiple devices at the same time,
allowing multiple users to connect to the same network and access the internet simultaneously.
Security: Wi-Fi networks can be secured using encryption and other security measures, which
protect against unauthorized access and hacking.
Range: Wi-Fi networks can cover a wide range of distances, depending on the type of router and
the environment in which it is used.
Compatibility: Wi-Fi is a widely adopted technology and is compatible with a wide range of
devices, including smartphones, laptops, tablets, and smart home devices.
Interference: Wi-Fi signals can be subject to interference from other wireless devices and
physical barriers, such as walls and buildings, which can impact network performance.
Reliability: Wi-Fi networks can sometimes suffer from dropouts or signal loss, particularly in
areas with high network congestion or interference.
ZIG-BEE
ZigBee is a Personal Area Network task group with low rate task group 4. It is a
technology of home networking. ZigBee is a technological standard created for controlling and
sensing the network. As we know that ZigBee is the Personal Area Network of task group 4 so it
is based on IEEE 802.15.4 and is created by Zigbee Alliance.
ZigBee is an open, global, packet-based protocol 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.
Types of ZigBee Devices:
1. Zigbee Coordinator Device: It communicates with routers. This device is used for
connecting the devices.
2. Zigbee Router: It is used for passing the data between devices.
3. Zigbee End Device: It is the device that is going to be controlled.
Features of Zigbee:
1. Stochastic addressing: A device is assigned a random address and announced. Mechanism
for address conflict resolution. Parents node don’t need to maintain assigned address table.
R.Rama Rajesh.,M.E.MBA.,MHRM., 14
IOT COMMUNICATION AND OPEN PLATFORMS
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.
Architecture of Zigbee:
Zigbee architecture is a combination of 6 layers.
Application Layer
Application Interface Layer
Security Layer
Network Layer
Medium Access Control Layer
Physical Layer
Physical layer: The lowest two layers i.e the physical and the MAC (Medium Access Control)
Layer are defined by the IEEE 802.15.4 specifications. The Physical layer is closest to the
hardware and directly controls and communicates with the Zigbee radio. The physical layer
translates the data packets in the over-the-air bits for transmission and vice-versa during the
reception.
R.Rama Rajesh.,M.E.MBA.,MHRM., 15
IOT COMMUNICATION AND OPEN PLATFORMS
Medium Access Control layer (MAC layer): The layer is responsible for the interface between
the physical and network layer. The MAC layer is also responsible for providing PAN ID and
also network discovery through beacon requests.
Network layer: This layer acts as an interface between the MAC layer and the application layer.
It is responsible for mesh networking.
Application layer: The application layer in the Zigbee stack is the highest protocol layer and it
consists of the application support sub-layer and Zigbee device object. It contains manufacturer-
defined applications.
Advantages of Zigbee:
1. Designed for low power consumption.
2. Provides network security and application support services operating on the top of IEEE.
3. Zigbee makes possible completely networks homes where all devices are able to communicate
4. Use in smart home
5. Easy implementation
6. Adequate security features.
Disadvantages of Zigbee :
Limited range: Zigbee has a relatively short range compared to other wireless communications
protocols, which can make it less suitable for certain types of applications or for use in large
buildings.
Limited data rate: Zigbee is designed for low-data-rate applications, which can make it less
suitable for applications that require high-speed data transfer.
Interoperability: Zigbee is not as widely adopted as other IoT protocols, which can make it
difficult to find devices that are compatible with each other.
Security: Zigbee’s security features are not as robust as other IoT protocols, making it more
vulnerable to hacking and other security threats.
GLOBAL POSITIONING SYSTEM (GPS)
Global Positioning System (GPS) is a navigation system based on satellite. It has created
the revolution in navigation and position location. It is mainly used in positioning, navigation,
monitoring and surveying applications.
The GPS systems are a Combination of a network of satellites that are constantly sending
coded information in the form of radio signals. After that receiver received the signals and
R.Rama Rajesh.,M.E.MBA.,MHRM., 16
IOT COMMUNICATION AND OPEN PLATFORMS
interprets the transmitted information from the satellites to locate the position on earth
accurately. This satellite system is congestive of 29 satellites situated at almost 20,000
kilometers above the Earth’s surface. The GPS satellites are located at 6 earth-centered orbital
planes and travel at a speed of 14,000 km/hr.
Functionality of GPS:
The GPS device will first establish a connection with 3 to 4 satellites. After that GPS
satellite broadcasts a message including the location of the receiver. If the GPS receiver receives
a Group of messages from different satellites to calculate the exact position using the process
called triangulation. GPS satellites need an unobstructed line of sight for the broadcast. Hence,
this technology is not only for indoor but also for use in a wide area. There some devices use
nearby cell towers and open-source Wi-Fi signals. Then technology is called LPS (Local
Positioning System) and is a substitute for GPS.
ARCHITECTURE OF GPS
R.Rama Rajesh.,M.E.MBA.,MHRM., 17
IOT COMMUNICATION AND OPEN PLATFORMS
R.Rama Rajesh.,M.E.MBA.,MHRM., 18
IOT COMMUNICATION AND OPEN PLATFORMS
Usage of GPS:
There are five most uses of the GPS.
Location:- with the help of GPS we can find the exact position of the object.
Navigation:– we can navigate one location to another with the help of GPS.GPS technology is
also useful for Transportation Management and breathing of Ship at docks.
Tracking: -with the help of GPS we can Monitor object movement like speed, distance,
position.
Mapping:– GPS also helps in creating maps of the World.
Timing:- GPS also provides the estimated time for reaching destination measurement its depend
on speed and object movement.
GSM MODULE
GSM stands for Global System for Mobile Communication. GSM is an open and digital
cellular technology used for mobile communication. It uses 4 different frequency bands of 850
MHz, 900 MHz, 1800 MHz and 1900 MHz . It uses the combination of FDMA and TDMA. This
article includes all the concepts of GSM architecture and how it works.
GSM is having 4 different sizes of cells are used in GSM :
Macro : In this size of cell, Base Station antenna is installed.
Micro : In this size of cell, antenna height is less than the average roof level.
Pico : Small cells’ diameter of few meters.
Umbrella : It covers the shadowed (Fill the gaps between cells) regions.
SYSTEM ARCHITECTURE
R.Rama Rajesh.,M.E.MBA.,MHRM., 19
IOT COMMUNICATION AND OPEN PLATFORMS
BSS : BSS stands for Base Station Subsystem. BSS handles traffic and signaling between a
mobile phone and the network switching subsystem. BSS having two components BTS and BSC.
NSS : NSS stands for Network and Switching Subsystem. NSS is the core network of GSM.
That carried out call and mobility management functions for mobile phone present in network.
NSS have different components like VLR, HLR and EIR.
OSS : OSS stands for Operating Subsystem. OSS is a functional entity which the network
operator monitor and control the system. OMC is the part of OSS. Purpose of OSS is to offer the
customer cost-effective support for all GSM related maintenance services.
Functionality Of Different Components.
1. MS : MS stands for Mobile System. MS comprises user equipment and software needed for
communication with a mobile network. Mobile Station (MS) = Mobile Equipment(ME) +
Subscriber Identity Module (SIM). Now, these mobile stations are connected to tower and that
tower connected with BTS through TRX. TRX is a transceiver which comprises transmitter and
receiver. Transceiver has two performance of sending and receiving.
2. BTS : BTS stands for Base Transceiver Station which facilitates wireless communication
between user equipment and a network. Every tower has BTS.
3. BSC : BSC stands for Base Station Controller. BSC has multiple BTS. You can consider the
BSC as a local exchange of your area which has multiple towers and multiple towers have BTS.
4. MSC : MSC stands for Mobile Switching Center. MSC is associated with communication
switching functions such as call setup, call release and routing. Call tracing, call forwarding all
functions are performed at the MSC level. MSC is having further components like VLR, HLR,
AUC, EIR and PSTN.
VLR : VLR stands for Visitor Location Register. VLR is a database which contains the exact
location of all mobile subscribers currently present in the service area of MSC. If you are going
from one state to another state then your entry is marked into the database of VLR.
HLR : HLR stands for Home Location Register. HLR is a database containing pertinent data
regarding subscribers authorized to use a GSM network.. If you purchase SIM card from in the
HLR. HLR is like a home which contains all data like your ID proof, which plan you are taking,
which caller tune you are using etc.
AUC : AUC stands for Authentication Center. AUC authenticates the mobile subscriber that
wants to connect in the network.
R.Rama Rajesh.,M.E.MBA.,MHRM., 20
IOT COMMUNICATION AND OPEN PLATFORMS
EIR : EIR stands for Equipment Identity Register. EIR is a database that keeps the record of all
allowed or banned in the network. If you are banned in the network then you can’t enter the
network, and you can’t make the calls.
PSTN : PSTN stands for Public Switched Telephone Network. PSTN connects with MSC.
PSTN originally a network of fixed line analog telephone systems. Now almost entirely digital in
its core network and includes mobile and other networks as well as fixed telephones. The earlier
landline phones which places at our home is nothing but PSTN.
5.OMC : OMC stands for Operation Maintenance Center. OMC monitor and maintain the
performance of each MS, BSC and MSC within a GSM system.
Three subsystem BSS, NSS and OSS are connected with each other via some interfaces.
Total three interfaces are there:
Air Interface : Air interface is also known as UM interface. Interface between MS and BTS is
called as UM interface because it is mobile analog to the U interface of ISDN.
Abis Interface : It is a BSS internal interface linking with BTS and BSC.
A interface : It provides communication between BSS and MSC.
Services in GSM
1. Bearer services/ data services:
GSM specifies different mechanism for data transmission, The original GSM allowing
for data rates of up to 9600 bits/s. Bearer services permit transparent or non transparent data
transmission.
Transparent bearer services: Transparent bearer services only use the physical layer to transmit
data. Data transmission has a constant delay at throughput if no transmission error occurs.
Non-transparent bearer services: Non-transparent bearer services use protocols of layer two and
three two three to implement error correction and flow control.(data link layer and network
layer).
2.Tele services:
Tele services are nothing but we use now as at also.
Video calls.
Video text and face emoji.
Short text message(SMS).
R.Rama Rajesh.,M.E.MBA.,MHRM., 21
IOT COMMUNICATION AND OPEN PLATFORMS
3. Supplementary services:
Supplementary services it means advanced services.
Conference calls.
Call waiting.
Call forwarding.
RASPBERRY PI
Raspberry Pi, developed by Raspberry Pi Foundation in association with Broadcom, is a
series of small single-board computers and perhaps the most inspiring computer available today.
From the moment you see the shiny green circuit board of Raspberry Pi, it invites you to tinker
with it, play with it, start programming, and create your own software with it. Earlier, the
Raspberry Pi was used to teach basic computer science in schools but later, because of its low
cost and open design, the model became far more popular than anticipated.
It is widely used to make gaming devices, fitness gadgets, weather stations, and much
more. But apart from that, it is used by thousands of people of all ages who want to take their
first step in computer science. It is one of the best-selling British computers and most of the
boards are made in the Sony factory in Pencoed, Wales.
Raspberry Pi consists of a 64-bit quad-core processor or microprocessor. The Raspberry
Pi has about 1GiB of RAM. Here, 1 GiB = 1024 x 1024 x 1024 bytes = (1024)^3 bytes. It
promotes Scratch and Python as the chief programming language. The foundation of Raspberry
Pi provides an operating system such as Linux. It also provides a non-Linux operating system,
such as OpenBSD, NetBSD, HelenOS, etc.
The types of Raspberry Pi are Raspberry Pi Alternatives, Raspberry Pi Zero W, and
Raspberry Pi 3 Model B+. We can run all types of applications in Raspberry Pi, including
Microsoft Office, emails, or specific code for an electronics project. We can run a single or
different piece of code in Raspberry Pi.
The Operating system in all the files is saved in the SD card. For one Raspberry Pi, we
can have multiple SD cards for the different operating system or file system. It is consistent in
many programming languages.It can be easily connected to the Internet.
The processor speed in Raspberry Pi ranges from 700MHz to 1.5GHz. The hard drive for
the Raspberry Pi is the slot on the board, in which the SD card is inserted. The Analog to Digital
R.Rama Rajesh.,M.E.MBA.,MHRM., 22
IOT COMMUNICATION AND OPEN PLATFORMS
converter is attached externally to the Raspberry Pi. The Raspberry Pi3 has 40 Input/Output pins
on board.
Processor: Broadcom BCM2711, quad-core Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz
Memory: 1GB, 2GB, 4GB or 8GB LPDDR4 (depending on model) with on-die ECC
Connectivity: 2.4 GHz and 5.0 GHz IEEE 802.11b/g/n/ac wireless LAN, Bluetooth 5.0, BLE
Gigabit Ethernet, 2 × USB 3.0 ports, 2 × USB 2.0 ports.
GPIO: Standard 40-pin GPIO header (fully backwards-compatible with previous boards)
Video & sound: 2 × micro HDMI ports (up to 4Kp60 supported) 2-lane MIPI DSI display port,
2-lane MIPI CSI camera port, 4-pole stereo audio and composite video port, Multimedia: H.265
(4Kp60 decode), H.264 (1080p60 decode, 1080p30 encode); OpenGL ES, 3.0 graphics
SD card support: Micro SD card slot for loading operating system and data storage
Input power: 5V DC via USB-C connector (minimum 3A 1), 5V DC via GPIO header
(minimum 3A1 ) Power over Ethernet (PoE)–enabled (requires separate PoE HAT)
The Raspberry Pi Foundation developed the Raspberry Pi in the United Kingdom. The
design of Raspberry Pi board consists of CPU (Central Processing Unit), GPU (Graphics
Processing Unit), the graphics chip, RAM, Xbee port, Ethernet port, power source connector,
UART (Universal Asynchronous Reciever/Transmitter), and GPIO (General-Purpose
Input/Output) pins.
R.Rama Rajesh.,M.E.MBA.,MHRM., 23
IOT COMMUNICATION AND OPEN PLATFORMS
GPIO PINS
A powerful feature of the Raspberry Pi is the row of GPIO (general-purpose input/output)
pins along the top edge of the board. A 40-pin GPIO header is found on all current Raspberry Pi
boards (unpopulated on Raspberry Pi Zero, Raspberry Pi Zero W and Raspberry Pi Zero 2 W).
Prior to the Raspberry Pi 1 Model B+ (2014), boards comprised a shorter 26-pin header. The
GPIO header on all boards (including the Raspberry Pi 400) have a 0.1" (2.54mm) pin pitch.
The GPIO pins allow the Raspberry Pi to control and monitor the outside world by being
connected to electronic circuits. The Pi is able to control LEDs, turning them on or off, run
motors, and many other things. It’s also able to detect whether a switch has been pressed, the
temperature, and light. We refer to this as physical computing. There are 40 pins on the
Raspberry Pi (26 pins on early models), and they provide various different functions.
R.Rama Rajesh.,M.E.MBA.,MHRM., 24
IOT COMMUNICATION AND OPEN PLATFORMS
Voltages
Two 5V pins and two 3.3V pins are present on the board, as well as a number of ground
pins (0V), which are unconfigurable. The remaining pins are all general purpose 3.3V pins,
meaning outputs are set to 3.3V and inputs are 3.3V-tolerant.
Outputs
A GPIO pin designated as an output pin can be set to high (3.3V) or low (0V).
Inputs
A GPIO pin designated as an input pin can be read as high (3.3V) or low (0V). This is
made easier with the use of internal pull-up or pull-down resistors. Pins GPIO2 and GPIO3 have
fixed pull-up resistors, but for other pins this can be configured in software.
More
As well as simple input and output devices, the GPIO pins can be used with a variety of
alternative functions, some are available on all pins, others on specific pins.
PWM (pulse-width modulation)
Software PWM available on all pins
Hardware PWM available on GPIO12, GPIO13, GPIO18, GPIO19
SPI(serial peripheral interface)
SPI0: MOSI (GPIO10); MISO (GPIO9); SCLK (GPIO11); CE0 (GPIO8), CE1 (GPIO7)
SPI1: MOSI (GPIO20); MISO (GPIO19); SCLK (GPIO21); CE0 (GPIO18); CE1
(GPIO17); CE2 (GPIO16)
I2C(Inter-integrated Circuit)
Data: (GPIO2); Clock (GPIO3)
EEPROM Data: (GPIO0); EEPROM Clock (GPIO1)
Serial
TX (GPIO14); RX (GPIO15)
GPIO pinout
A handy reference can be accessed on the Raspberry Pi by opening a terminal window
and running the command pinout. This tool is provided by the GPIO Zero Python library, which
is installed by default in Raspberry Pi OS.
R.Rama Rajesh.,M.E.MBA.,MHRM., 25
IOT COMMUNICATION AND OPEN PLATFORMS
R.Rama Rajesh.,M.E.MBA.,MHRM., 26
IOT COMMUNICATION AND OPEN PLATFORMS
with your circuits and connections, you could have a pile of dead components (and GPIO boards)
on your hands. This is why you might want to invest in a good Raspberry Pi Kit, since they often
come with both the hardware you need and practice projects so that you can learn the ropes
safely.
RASPBERRY PI INTERFACING
Ports and Sockets
Most components and sockets, with the help of which you connect it, are sticking out at
the top side whereas the back side is relatively flat. The spiky GPIO (general-purpose input
output) pins.
Insert SD or MicroSD card
We need an SD or MicroSD card with OS to get started with Raspberry Pi. If you are
using model 2, 3, A+, or B+ then, you need to turn your Raspberry Pi circuit board, so that the
underside is at your side and you can see that. You can see, there would be a metal MicroSD
card slot on the left side of the board. Slide your card into this slot.
Camera Module
Camera module, an official module from the Raspberry Pi board, is a small circuit board
with a strip of ribbon cable. It plugs directly into the board.
Display device
Depending on the screen type, you have two ways to connect the display device to your
Pi board. In these two ways, we are assuming that you are going to use either monitor or
television. Apart from these two ways, there is an official Pi touchscreen that connects using the
display socket. Let us check how we can connect an HDMI display and television, as explained
below.
HDMI or DVI display
The HDMI connector is on the top surface of your Raspberry Pi board. But for the
Raspberry Pi Zero model, you need to use an adapter that converts Mini HDMI to an HDMI
socket. For connecting, insert one end of the HDMI cable in the board or Pi ZERO connector and
the other end into your monitor. On the other hand, if you are using a DVI display, an adapter
should be used.
R.Rama Rajesh.,M.E.MBA.,MHRM., 27
IOT COMMUNICATION AND OPEN PLATFORMS
Television
If the TV you are using is having a HDMI socket, you can use that for optimal results. But if in
case, your TV does not have an HDMI socket, you need to use the composite video socket. On
the Raspberry Pi Model-A and Model-B, the composite video socket is placed on the top edge of
the board. It is a round, yellow-and-silver sockets.
Keyboard and Mouse
On Raspberry Pi Model B+, Model Pi 2, and Model Pi 3 the keyboard and mouse can be
directly connected. They should work fine. But for earlier models of Raspberry Pi, you should
use an external USB hub to connect keyboard and mouse. Because with this, the devices will not
draw too much power from the Pi board, and we can reduce the risk of heat and other problems
caused by devices. On the other hand, for Raspberry Pi Zero, Model A, and Model A+, we must
use a USB hub, since these boards have only one USB socket.
Audio devices
Raspberry Pi’s audio socket is a small black or blue box. On Model A and Model B, it is
stuck along the top edge of the board. Whereas, on Model B+, Pi 2 and Pi 3, it is stuck along the
bottom edge of the board. If you have connected an HDMI TV, then you do not need to connect
a separate audio cable, as the sound is routed through your HDMI cable. On the other hand, if
you have earphones or headphones with a 3.5mm jack, you can directly plug them into the audio
socket.
Internet router
All the Raspberry Pi models other than Model A, A+, and Zero have an Ethernet socket.
You can find the socket on the right edge of the Raspberry board. To connect to the internet, you
can use a standard Ethernet cable in this socket. In case if you are using a router with DHCP
(Dynamic Host Configuration Protocol) support, your Raspberry Pi will automatically connect to
the internet. On the other hand, if you have a Wi-Fi adapter then, you can plug into a USB socket
of Raspberry Pi and it will be ready to use whenever you turn on your board.
Power
Once you are done with connecting all the necessary and required devices, it is time to
connect your Raspberry Pi to power and turn it on. For this, you need to use the Micro USB
power socket. To safeguard your board from damage, you need to provide a steady 5v of power.
Keep in mind that Raspberry Pi board has no on/off switch. It means, whenever you connect it
R.Rama Rajesh.,M.E.MBA.,MHRM., 28
IOT COMMUNICATION AND OPEN PLATFORMS
with power, it will start working. If you want to turn it off, you just need to disconnect it. So, if
you want to save your data, you should proceed with caution and should shut down the
Raspberry Pi first.
CONNECTING TO THE CLOUD
ThingSpeak is an IoT platform in the cloud that provides sensor data collection services,
transmission, processing, visualization, and analytics on the cloud by using API keys.
Furthermore, it provides these services in real-time, which means that users can operate their
services for monitoring and control applications in real-time. Potential application areas for
sensor monitoring and control with ThingSpeak include:
Air quality monitoring
Energy monitoring
Smart farming
Traffic monitoring
Weather station
Because of the cost-saving feature and reliability offered by such platforms, a number of big
IoT companies are opting to purchase the services offered by IoT providers such as ThingSpeak.
Instead of building their own IoT platforms, a move to cloud-based infrastructure offers
unparalleled benefits for companies, big or small.
ThingSpeak and Sensor Data
There are two methods for saving sensor readings in ThingSpeak—either in a public
channel or a private channel. A channel consists of eight fields for data storage, three fields for
recording the geophysical location, and a status field. To access these services, a user needs to be
signed in. Integration with MATLAB guarantees users access to rich visualization and sensor
data analytics tools. The platform accepts raw sensor data and users use equations and algorithms
to transform that data into a usable form. It is advantageous to perform any data processing on
the cloud due to a number of reasons:
Most IoT projects are battery-powered so processing data costs energy
Processing data may slow down the micro-controllers
Increase microcontroller sleep time
R.Rama Rajesh.,M.E.MBA.,MHRM., 29
IOT COMMUNICATION AND OPEN PLATFORMS
myAPI = 'IUKV2ZRBQW9MV407Q'
ThingsURL = 'https://api.thingspeak.com/update?api_key=%s' % myAPI
def DHT22_data():
humidity, temperature = dht.read_retry(dht.DHT22, 23)
return humi, temp
R.Rama Rajesh.,M.E.MBA.,MHRM., 30
IOT COMMUNICATION AND OPEN PLATFORMS
the DHT22 sensor is measuring the parameters correctly. Once we pass this test, then we know
we have done the heavy work, and we are good to go.
Sending Sensor Data to ThingSpeak
To send the sensor data to our ThingSpeak channel, firstly, we need to obtain the
channel’s write API key. Then we will need the sensor values to write. For this tutorial, we have
two sensor variables—temperature and humidity. So we need to have two fields: field1 and
field2. Send this information in a single URL using the following format:
https://api.thingspeak.com/update?api_key=drminls2dn88g1ez&field1=4&field2=4. The URL
description is shown in the diagram below:
R.Rama Rajesh.,M.E.MBA.,MHRM., 31