IoT TillMidsem 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 270

CS578: Internet of Things

Introduction to IoT
Definitions, Characteristics, Applications

Dr. Manas Khatua


Assistant Professor, Dept. of CSE, IIT Guwahati
E-mail: manaskhatua@iitg.ac.in

“I have no special talent. I am only passionately curious.” – Albert Einstein


What is IoT?
 Internet of Things (IoT) is the network of smart physical objects
 physical objects (e.g. devices, vehicles, buildings, etc.) embedded with sensors/actuators,
computation unit, memory unit, power source, and network connectivity,
 which enables the physical object to collect and exchange data,
 analyze the collected data to extract new insight and respond accordingly.

Goal of IoT is to “connect the unconnected”


 “Things” or “objects” that were not supposed to be connected to the Internet

 IoT did the technology transition


in traditional computer networks

02-08-2022 Dr. Manas Khatua 2


Cont…
• Unifications of technologies:
• Embedded systems,
• Low power and low rate network,
• Internet,
• Big data,
• Data analytics,
• Cloud computing,
• Edge Intelligence
• Software defined networks,
• Network and data security
• Etc.

• Alternate Definition:

“The Internet of Things (IoT) is the network of physical objects that contain embedded
technology to communicate and sense or interact with their internal states or the external
environment.” – Gartner Research*

* https://www.gartner.com/en/information-technology/glossary/internet-of-things

02-08-2022 Dr. Manas Khatua 3


Brief History of IoT
 The term "Internet of things" was likely coined by Kevin Ashton of Procter & Gamble,
later MIT's Auto-ID Center, in 1999.
 “In the 20th century, computers were brains without senses — they only knew what we told them.” Now in the
21st century, computers are sensing things for themselves! – Kevin Ashton

 Early 1980s at the Carnegie Melon University, a group of students created a way to get
their campus Coca-Cola vending machine to report on its contents through a network in
order to save them the trek if the machine was out of Coke.

 In 1990, John Romkey, developer of the first TCP/IP stack for IBM PC in 1983,
connected a toaster to the internet for the first time.

 In 1991, a group of students at the University of Cambridge used a web camera to report
on coffee available in their computer labs coffee pot.

 At the beginning of the 21st Century, LG Electronics introduced the world’s first
refrigerator connected to the internet

02-08-2022 Dr. Manas Khatua 4


Cont…
 The popularity of the term IoT did not accelerate until 2010/2011 and reached mass
market in 2013-14.

 Definition of the IoT has evolved over time.


2010 onwards
Early 2000
Post 1993
1990

Evolutionary Phases of the Internet


02-08-2022 Dr. Manas Khatua 5
Benefits of IoT

Cost
Predictive
Automation Process / Reduction Improved/
Maintenance Adaptability
Efficiency New Insights
•Machines can •Continuous Improvement •When an
assemble parts with monitoring of organization can
more precision and systems and improve system •the ability to adapt
•process
speed, resulting in processes to identify uptime, automate •IoT systems often to new business
improvement affects
fewer errors during key indicators of processes, reduce act as the eyes and requirements,
every aspect of an
assembly problems before the risk of failure ears on remote, customer needs,
operation’s bottom
•Robots can very they result in and gain insights hard-to-reach, or and changing
line
rapidly detect faults downtime or system that support better widely distributed conditions, or scale
that may not be failure decision making, equipment and the deployment in
detected by the and reduce resource processes. response to business
human eye usage, the result is growth or customer
efficiency and cost requirements
savings

02-08-2022 Dr. Manas Khatua 6


IoT vs. WSN
• Wireless Sensor Network (WSN):

– WSN refers to a group of specialized dedicated sensors with a communications


infrastructure.

– WSN is primarily used for monitoring and recording the physical environment
conditions like temperature, sound, pollution levels, humidity, wind, and so on.

– It is designed to acquire, process, transfer, and provide data/information extracted


from the physical world.

– In a WSN, there is no direct connection to the internet. Instead, the various sensors
connect to some kind of router or central node.

• WSN: Resource constraint sensor nodes + wireless network to connect the


nodes + gather some data by sensing the environment.

• IoT: WSN + Internet + App + Cloud computing + Data Analytics + etc…

02-08-2022 Dr. Manas Khatua 7


IoT vs. M2M
• Machine-to-Machine (M2M): It is a concept where two or more than two
machines communicate with each other without human interaction using a
wired or wireless mechanism.

Basis of IoT M2M


Connection type via (IP) Network and using various Mainly point-to-point
communication types.
Communication IP based protocol Proprietary protocols
protocol
Internet Internet connection is required not dependent on the Internet
Data Sharing Data is shared with other Data is shared with only the
applications (if required) communicating parties.
Open API Supports Open API integrations. There is no support for Open
API’s
Scalability More devices, more scalable due to Limited devices, less scalable
cloud based architecture than IoT
App. Example Smart home, Smart wearables, etc. Sensor telemetry, ATMs in Bank

02-08-2022 Dr. Manas Khatua 8


Growth of IoT Devices

IoT Analytics’ prediction


Source: https://iot-analytics.com/state-of-the-iot-2020-12-billion-iot-connections-surpassing-non-iot-for-the-first-time/

02-08-2022 Dr. Manas Khatua 9


Where is IoT?
Wearable
Tech Devices

Smart Appliances

It’s everywhere!

Industry Automation
and Monitoring
Healthcare
02-08-2022 Dr. Manas Khatua 10
Global IoT Market Share
14% Smart Homes Retail < 2%

3%
Wearables Smart Utilities
& Energy
4%

7%
Industrial IoT
Connected Cars
24%

20%* Healthcare 20%*


Personal Health
Smart Cities 26%
Source: https://growthenabler.com/flipbook/pdf/IOT%20Report.pdf

02-08-2022 Dr. Manas Khatua 11


Global Spending on IoT

Source: https://iot-analytics.com/iot-market-size/

02-08-2022 Dr. Manas Khatua 12


Smart City

Source: https://depositphotos.com/126025652/stock-illustration-smart-city-concept-and-internet.html

02-08-2022 Dr. Manas Khatua 13


Smart Home

Source: https://medium.com/@globalindnews/north-america-accounted-for-major-share-in-the-global-smart-home-healthcare-market-in-2015-cc9cc1974ac5

02-08-2022 Dr. Manas Khatua 14


Smart Healthcare

Source: http://iot.fit-foxconn.com/

02-08-2022 Dr. Manas Khatua 15


Industrial IoT

Source: https://www.winmate.com/Solutions/Solutions_IoT.asp

02-08-2022 Dr. Manas Khatua 16


Connected Cars

Source: Vehicular K. Ziadi, M. Rajarajan, “Internet:


Security & Privacy Challenges and Opportunities”,
Future Internet 2015, 7(3), 257-275.

02-08-2022 Dr. Manas Khatua 17


Google’s Self-Driving Car

Source: https://www.google.com/

02-08-2022 Dr. Manas Khatua 18


Smart Agriculture

Source: https://in.pinterest.com/pin/515380751093603767/?lp=true

02-08-2022 Dr. Manas Khatua 19


Livestock Management

Source: https://data-flair.training/blogs/iot-applications-in-agriculture/

02-08-2022 Dr. Manas Khatua 20


Many More ….

Source: Rajiv Ranjan et. al., “Integrating the IoT


and Data Science” IEEE Cloud Computing, 2018

02-08-2022 Dr. Manas Khatua 21


Main Challenges in IoT
Sensors Scale Privacy Security
• Limited resources • millions of devices • which personal • “things” becomes
• Limited types of are connected to data to share connected, so
sensors form IoT with whom security becomes
• how to control complex

Low Power Big data and


Network Data analytics
• Devices should remain connected to the • massive amount of sensor data
Internet for years • different sources and various forms
• High network latency • extract intelligence form the heaps of data

Interoperability
• various protocol, various architecture
• unavailability of standardized platform
• different technology leads to interoperability issue
• Recent IoT standards are minimizing this problem

02-08-2022 Dr. Manas Khatua 22


Lessons Learned

 Learned about what is IoT

 Learned the genesis of IoT

 Understand the benefits of IoT

 Learned about the market share of IoT

 Understand the real world applications of IoT

 Understand various challenges IoT implementation is facing

02-08-2022 Dr. Manas Khatua 23


Figures and slide materials are taken from the following Books:

1. David Hanes et al., “IoT Fundamentals: Networking Technologies, Protocols,


and Use Cases for the Internet of Things”, 1st Edition, 2018, Pearson India.

2. Mayur Ramgir, “Internet of Things: Architecture, Implementation and Security”,


1st Edition, 2020, Pearson India.

02-08-2022 Dr. Manas Khatua 24


CS578: Internet of Things
IoT Ecosystem
Different components of IoT

Dr. Manas Khatua


Assistant Professor, Dept. of CSE, IIT Guwahati
E-mail: manaskhatua@iitg.ac.in

“Strength is Life, Weakness is Death. ” – Swami Vivekananda


IoT Ecosystem
IoT is not just a technology; it is an enormous ecosystem!

• Community components:
 IoT Frameworks
• Tools needed to design and implement IoT-based solutions and products

 IoT Architectures
• Graphical structure of the designed IoT-based solutions and products

 IoT Core
• Sensors & Actuators, microcontrollers, internet connectivity, service platform including security

 IoT Gateway
• It carries the responsibility to ensure bidirectional communication between IoT protocols and other networks

 Cloud
• Accepts, accumulates, maintains, stores, and process data in real time

 Analytics
• It indulges in conversion and analysis of data which results in recommendations and future decision making

 User Interface / Visualization


• Design sleek, visually appealing, interactive, and ease-of-use graphical user interface

02-08-2022 Dr. Manas Khatua 2


IoT Framework
• Framework provides a development environment.

– It provides appropriate infrastructure to design and implement the architecture

• IoT framework comprises of large number of components

– sensors, sensor systems, gateways, mobile app, embedded controller, data management
platform, analytical platform, and so on.

– support interoperability among all devices, provides secure connectivity, reliability in data
transfer, interface to 3rd party application to built on it, and so on.

Few IoT Framework Few IoT Framework


RTI (Real-Time Innovations) Connext DDS Cisco Ultra IoT
Salesforce IoT cloud Microsoft Azure IoT
Eclipse IoT PTC ThingWorx
GE (General Electronic) Predix Amazon AWS IoT
IBM Watson IoT Kaa

02-08-2022 Dr. Manas Khatua 3


IoT Network Architecture
 Network and its application should never be built without careful planning

 Architecture is how you design (i.e. graphical structure) your application or solution.

• The practice of building single-purpose and “vertical” domain applications leads to isolated silos.

• Using the smart building use case, a security application can detect when nobody is in the building.
• It could then trigger lights to be switched off and for the air conditioning system to operate on a reduced setting.
Source: https://onem2m.org/using-onem2m/developers/basics

02-08-2022 Dr. Manas Khatua 4


Core Components of IoT

• Sensors - to gather data and events

• Actuators – responsible for moving and


controlling a mechanism or system
Sensors & Internet • Microcontrollers - automatically controls
Actuators Connectivity sensors and actuators; makes them smart

• Internet connectivity – responsible for


sharing information and control command
Micro Service
controllers Platform
• Service Platform – ability to deploy and
manage the IoT devices and applications
including data management, data analytics
and all aspects of security

02-08-2022 Dr. Manas Khatua 5


“Things” in IoT – Sensors

MQ135 - Air Quality Sound Detection DHT11 - Temperature PIR Motion Detector
Gas Sensor Sensor and Humidity Sensor Sensor

Pulse Sensor Ultrasonic Distance IR Sensor


LDR Light Sensor
Sensor

02-08-2022 Dr. Manas Khatua 6


“Things” in IoT – Actuators

4 Channel 5V Relay Servo Motor DC Motor Solenoid valve

LED LCD
Linear Actuators

02-08-2022 Dr. Manas Khatua 7


Connecting Smart Objects
Communication Criteria IoT Access Technologies
 Range
 Frequency Bands
 Power Consumption
 Topology
 Constrained Devices
 Constrained-Node
Networks

02-08-2022 Dr. Manas Khatua 8


Comparison of Key Attributes
WiFi BLE Thread Sub-GHz: TI Sigfox Zigbee LoRa
Max. Data 72 Mbps 2 250 200 100 250 50
throughput Mbps Kbps Kbps bps Kbps Kbps
Range 100 m 750 m 100 m 4 km 25 km 130 m 10 km
Topology Star P2P/ Mesh/ Star Star Mesh/ Star of Star
Mesh Star Star
Frequency 2.4 GHz 2.4 GHz 2.4 GHz Sub-GHz Sub-GHz 2.4 GHz Sub-1GHz
Power 1 Year (AA Up to years on a coin-cell battery for limited range Few Years
consumption battery) (AA battery)
IP at the Yes No Yes No No No No
device node
Deployed AP smart No No No No No
Devices phones

Source: Nick Lethaby “Wireless Connectivity for the IoT: one size does not fit all”, Texas Instruments, 2017

02-08-2022 Dr. Manas Khatua 9


Utilizing IP for IoT
Key Advantages of IP
 Open and standard-based
 Versatile
 Ubiquitous
 Scalable
 Manageable
 Highly secure
Stable and resilient

• IPv6 packets require a minimum MTU/PDU size of 1280 bytes.


• The maximum size of a MAC layer frame in IEEE 802.15.4 is 127 bytes.
– It gives just 102 bytes for an IPv6 packet !!

Need of packet/frame size optimization due to


 Constrained Nodes
 Constrained Networks

02-08-2022 Dr. Manas Khatua 10


Modification in TCP/IP Stack

IEEE 802.15.4e -
2011 Amendment

• WPAN: Wireless Personal Area Networks


• IEEE 802.15.4: Low-rate WPAN In 6TiSCH IoT Network

• LoWPAN: Low-Power WPAN


• 6LoWPAN: IPv6 over LoWPAN
• TSCH: Time Synchronized Channel Hopping
• 6TiSCH: IPv6 over the TSCH mode of IEEE 802.15.4e
• 6top: 6TiSCH Operation Sublayer
02-08-2022 Dr. Manas Khatua 11
Application Layer

02-08-2022 Dr. Manas Khatua 12


IoT Gateway
• It is a physical device or software
program that serves as the connection
point between the two different types
of networks

• Provide bidirectional communication


 Between IoT protocols and other
networks
• e.g. Zigbee <--> Ethernet

• Sometimes programmed to execute


some processing operations
 Edge computing

• It is necessary to maintain security to a


certain extent
 Can shield the entire IoT systems from
any cyberattack

Source: B. Kang, D. Kim, H. Choo, “Internet of Everything: A Large-Scale Autonomic IoT Gateway”,
IEEE Transactions on Multi-scale Computing Systems, vol. 3, no. 3, 2017, pp. 206-214.

02-08-2022 Dr. Manas Khatua 13


Cloud
• IoT generates vast amount of Big Data;
• this in turn puts a huge strain on
Internet Infrastructure.

• Cloud can facilitate to


– Provide different services
– Store huge amount of data
– Process the data efficiently

• Benefits of Cloud Platform in IoT


– Network Scalability
– Data Mobility
– Time to market
– Security
– Cost-effectiveness

02-08-2022 Dr. Manas Khatua 14


AI for IoT
• AI focuses on putting human intelligence in machine
• It gives the ability to a machine/program to think and learn by itself

Use of AI in IoT:
• Smart Home
– Automated HVAC control

• Industrial IoT
– Predictive maintenance
– Optimized supply chain

• Farming
– Smart farming
– Interruption warning

• Self-driving Car
– Mimic human driving on road

• Health
– Auto-diagnosing any disease
– Assistive healthcare

02-08-2022 Dr. Manas Khatua 15


Data Analytics in IoT
“Data Analytics + IoT => Smart Business Solutions”

 The business value of IoT is not just in the ability to connect devices, but it
comes from understanding the data these devices create.
Challenges:
Huge Volume
Real-time data flow
Variety of data types
e.g. XML, video, SMS
 Unstructured data
 Variable data model and
meaning / value

 IoT analytics is the application of data analysis tools and procedures to realize
value from the huge volumes of data generated by connected IoT devices

02-08-2022 Dr. Manas Khatua 16


Securing IoT
• Both the IoT manufacturers and their customers didn’t care about the security !

Unauthorized access to IoT devices Unauthorized access to IoT network

Source:https://www.theguardian.com/technology/2016/oct/26/ddos-
attack-dyn-mirai-botnet Source:http://metropolitan.fi/entry/ddos-attack-halts-heating-in-
finland-amidst-winter

Major cyber attack disrupts internet DDoS attack halts heating in


service across Europe and US; Finland amidst winter;
October 26, 2016 November 7, 2016

02-08-2022 Dr. Manas Khatua 17


User Interface
• Information made available to the end-users

• Users can actively check and act in for their IOT system

Important
Characteristics:

 Sleek design

 Visually appealing

 Interactive UI

 Ease-of-use

 Handy

Source: https://www.daikin.com/about/design/2017/05/entry-15

02-08-2022 Dr. Manas Khatua 18


Lessons Learned

 What is IoT Ecosystem  IoT Gateway

 Different components of IoT  Use of Cloud in IoT

 IoT Framework  Data Analytics in IoT


 IoT Architecture
 AI for IoT
 IoT Core
 Security in IoT
 Sensors & Actuators
 User Interface for IoT
 IoT Access Technologies

02-08-2022 Dr. Manas Khatua 19


Figures and slide materials are taken from the following Books:

1. David Hanes et al., “IoT Fundamentals: Networking Technologies, Protocols,


and Use Cases for the Internet of Things”, 1st Edition, 2018, Pearson India.

02-08-2022 Dr. Manas Khatua 20


Security in IoT
• US Military’s Defense
Advanced Research Projects
Agency (DARPA) demonstrates
hacking smart “Things”

Source: https://www.youtube.com/watch?v=7E1WsdODxu0

Source: https://www.youtube.com/watch?v=4oONdV5RYp8

02-08-2022 Dr. Manas Khatua 21


CS578: Internet of Things
Introduction to Arduino
Arduino UNO Board & IDE

Dr. Manas Khatua


Assistant Professor, Dept. of CSE, IIT Guwahati
E-mail: manaskhatua@iitg.ac.in

“The soil of India is my highest heaven, the good of India is my good.” – Swami Vivekananda
What is Arduino?
• Arduino is an open-source electronics platform
– based on easy-to-use hardware and software.

• It was born at the Interaction Design Institute Ivrea, Italy, as an easy tool for fast
prototyping
– aimed at students without any background in electronics and programming.

• These boards are incorporated with microcontrollers


– To execute a small program, to receive input, to apply action on real world

• It has the capability to act as an interface for electrical and electronic systems

• These boards are used extensively because:


– Inexpensive
– Cross-platform – runs on Windows, Mac OS, and Linux OS.
– Easy-to-use hardware and software environment
– Open source hardware and software IDE
– Capable to interact with other boards and computers
– Can interact with sensors and actuators
– Facilitate serial communication

15-08-2022 Dr. Manas Khatua 2


Types of Arduino Boards
• Entry Level - easy to use and ready to power your first
creative projects.
– Arduino UNO
– Arduino Nano
– Arduino Micro
Arduino UNO
• Enhanced Features - boards with advanced
functionalities, or faster performances
– Arduino Zero
– Arduino Mega 2560
– Arduino Motor Shield

Arduino Mega 2560


• Internet of Things - Make connected devices easily with
one of these IoT products
– Arduino Nano 33 IoT
– Arduino Nano 22 BLE
– UNO WiFi REV2

Source: https://www.arduino.cc/ Arduino Nano 33 IoT


15-08-2022 Dr. Manas Khatua 3
Arduino UNO
• Arduino Uno is a Single board Micro-controller based on the ATmega328P
– a product of Atmel (now Microchip)
– 32 - represents it’s flash memory capacity that is 32KB
– 8 - represents it’s cpu type that is of 8 bit
– p - simply denotes picoPower (very low power).

Few competitors: STM32 and MSP430

15-08-2022 Dr. Manas Khatua 4


Pins/Jacks in Arduino UNO
• It has the following major pins/jacks:

 14 digital input/output pins (of which 6 can be used as PWM outputs),


 6 analog inputs,
 6 pins related to energy/power
 a reset pin
 an analog reference pin
 a reset button
 a USB connection,
 a power jack,
 a 16 MHz ceramic resonator,
 two ICSP header
 Atmel ATmega328 IC pins

15-08-2022 Dr. Manas Khatua 5


Detailed Pin Diagram

15-08-2022 Dr. Manas Khatua 6


Pin Description

Pin category Pin Name Details


Power Vin, 3.3V, 5V, GND, Vin : Input voltage to Arduino when using an
Reset external power source.

5V : Regulated power supply used to power


microcontroller and other components on the
board.

3.3V : 3.3V supply generated by on-board


voltage regulator. Maximum current draw is
50mA.

GND : ground pins.

Reset: Reset the microcontroller

15-08-2022 Dr. Manas Khatua 7


Cont…
Pin category Pin No / name Details
Analog pin A0 - A5 Used to provide analog input in the range 0-5V.

Digital Input/output pin Digital Pins 2 - 13 Can be used as input or output pins.
Serial 0(Rx),1(Tx) Used to receive and transmit TTL serial data.

External Interrupts 2, 3 To trigger an interrupt.


PWM: Pulse Width 3, 5, 6, 9, 10, 11 Provides 8-bit PWM output.
Modulation
SPI: Serial Peripheral 10 (SS), 11 (MOSI), 12 Used for SPI communication.
Interface (MISO) and 13 (SCK)
Inbuilt LED 13 To turn on the inbuilt LED.

TWI: Two Wire Interface A4 (SDA: Serial Data), Used for TWI / I2C communication.
/ I2C: Inter-IC A5 (SCL: Serial Clock)
AREF AREF : Analog Reference To provide reference voltage for input voltage.
Voltage

15-08-2022 Dr. Manas Khatua 8


Arduino in IoT
• Arduinos are used a lot to create IoT projects.

• But, it requires either a specialized Arduino or


shields to provide network capabilities

• The network interface could be Ethernet / WiFi /


Cellular
EtherTen

Arduino + Ethernet Shield Arduino UNO WiFi Rev2


Arduino Ethernet Shield

15-08-2022 Dr. Manas Khatua 9


Configure Arduino IDE
• Download and Install Arduino IDE https://www.arduino.cc/en/Main/Software

• The Arduino Software (IDE) allows you to write programs and upload them to your board.

• When the Arduino IDE first opens, this is what you should see:

15-08-2022 Dr. Manas Khatua 10


Built-in Examples

• Launch the Arduino application

• If you disconnected your board, plug it back


in.

• Programs written using Arduino IDE are


called sketches.

• There are many built-in examples /


sketches.

• To open built-in examples: select File ->


examples.

• These simple programs demonstrate all the


basic Arduino commands.

15-08-2022 Dr. Manas Khatua 11


Set Arduino Board

• Select the type of Arduino board


you're using:
 Tools -> Board -> (your board type)
 In this case, type is “Arduino UNO”

15-08-2022 Dr. Manas Khatua 12


Set Serial Port

• Select the serial/COM port that


your Arduino is attached to:
 Tools > Port > COMxx

Note: If you're not sure which serial


device is your Arduino, take a look
at the available ports, then unplug
your Arduino and look again. The
one that disappeared is your
Arduino.

15-08-2022 Dr. Manas Khatua 13


Code Compilation

• Compilation
successful
message in
bottom left
corner.

15-08-2022 Dr. Manas Khatua 14


Code Uploading

• With your Arduino board


connected, and the Blink sketch
open, press the 'Upload' button

• After a second, you should see


some LEDs flashing on your
Arduino, followed by the
message 'Done Uploading' in
the status bar of the Blink
sketch.

• If everything worked, the on-


board LED on your Arduino
should now be blinking!

15-08-2022 Dr. Manas Khatua 15


Serial Monitor
• The serial monitor is the 'tether' between the computer and your Arduino - it lets you
send and receive text messages.
• First select the port (go to Tools -> Port: ) to which the board is connected then click
the icon of Serial Monitor on the top right side of the Arduino IDE

Serial Monitor
output

15-08-2022 Dr. Manas Khatua 16


How to Install Sensor Libraries
• In this demo, we use DHT11 sensor for which we will be using DHT.h
header file in the code. So, this header file should be installed.

• Install Using the Library Manager


– click to Sketch menu then Include Library > Manage Libraries
– Search for “DHT” on the Search box and install the DHT library from Adafruit.

15-08-2022 Dr. Manas Khatua 17


Cont…
• After installing the DHT library from Adafruit, install “Adafruit Unified Sensor” libraries.

• There exist other methods for installing libraries


– Importing a .zip Library
• Sketch --> Include Library --> Add .Zip Library

– Manual Installation of Library


• Download the library as .Zip --> extract it
• Place the files in File --> Preferences --> Sketchbook location
• Restart Arduino IDE

15-08-2022 Dr. Manas Khatua 18


Live Demo: LED Blink

• See the Live Demo using Arduino UNO circuit board

1) Blink the in-built LED of Arduino Board

2) Blink the additionally attached LEDs

15-08-2022 Dr. Manas Khatua 19


Blink In-built LED
• First upload the bare
minimum example:
 Files -> Examples -> Basics ->
BareMinimum

• Output:
 In-built LED will glow
continuously

15-08-2022 Dr. Manas Khatua 20


Blink In-built LED
• First upload the bare
minimum example:
 Files -> Examples -> Basics ->
BareMinimum

• Output:
 In-built LED will glow
continuously

• Then, upload the blink


example:
 Files -> Examples -> Basics ->
Blink

• Output:
 In-built LED will glow
periodically

15-08-2022 Dr. Manas Khatua 21


Blink External LED

Upload this sketch in


Arduino UNO
• Connect the “digital out” pin 9 with the
Anode pin of LED through 1K Ohm resistor,
and “ground” pin with the Cathode pin of LED

OUTPUT:
 LED connected with digital pin 9 will blink periodically.

15-08-2022 Dr. Manas Khatua 22


Demo on LED Blink

15-08-2022 Dr. Manas Khatua 23


Lessons Learned
 What is Arduino

 Types of Arduino Board

 Arduino UNO pin diagram

 Arduino in IoT

 Arduino IDE

 Built-in Sketch in IDE

 Compiling and Uploading a sketch using IDE

 LED blink program and system setup

15-08-2022 Dr. Manas Khatua 24


15-08-2022 Dr. Manas Khatua 25
Which is better? Atmega368P vs STM32 vs MSP430

ATmega328P STM32 MSP430


Brand ATmel (now Cortex Texas Instruments
MicroChip) (STMicroelectronics)
Cost Low High Low
Architecture Advanced RISC Power Architecture Older, von-Neumann
architecture technology designed for architecture
embedded applications
Power Consumption Low Medium Low
Performance Medium, suitable High, fast processing Low, more suitable
for complex speed, Running 32 bit for only simple
projects ARM processor core projects
with sufficient RAM
Ease of Usage Easy to use, 8 bit Complicated due to its Complex relative to
and high nature of being a 32 bit Arduino boards
compatibility microcontroller
with Arduino
boards
15-08-2022 Dr. Manas Khatua 26
CS578: Internet of Things
Introduction to
Arduino Programming

Dr. Manas Khatua


Assistant Professor, Dept. of CSE, IIT Guwahati
E-mail: manaskhatua@iitg.ac.in

“If you want peace of mind, do not find fault with others. Rather learn to see your own faults.” – Ma Sarada Devi
Introduction
• The Arduino Software (IDE) allows you to write programs (i.e. sketches)
and upload them to your board.

• A sketch is consists of two mandatory functions:


 Setup( ) -- it is executed once
 Loop( ) -- it is executed repeatedly

• Setup( ) is used for


 initialization of serial communication
 defining pinMode
 declaring variables

• Loop( ) is used for


 writing the main code which has to execute continuously.
 e.g. reading inputs from the sensors, triggering outputs to the external
device, etc.

08-08-2022 Dr. Manas Khatua 2


Cont…
• Sketches are compiled by
avr-gcc / avr-g++
– It is based on C/C++
programming language

• So, the program syntax is


almost similar to C/C++
– Supported data types
– Variables
– Constants
– Control structure
– Looping structure
– Arrays
– Strings
– Function

• One important extension is : Arduino Libraries


– Libraries are a collection of code that makes it easy for you to
connect to a sensor, display, module, etc.

08-08-2022 Dr. Manas Khatua 3


Variables

08-08-2022 Dr. Manas Khatua 4


Operators & Structures

08-08-2022 Dr. Manas Khatua 5


Few Built-in Functions
https://www.arduino.cc/reference/en/

• pinMode (pin, mode)


– It configures the specified pin to behave either as input or as output pinMode(9,OUTPUT);
– By default the digital pins in Arduino function as input.

– pin: is the number of the pin whose mode needs to be set


– mode: can be INPUT, OUTPUT, INPUT_PULLUP.

• digitalReadPin(pin) val = digitalRead(inPin);


– Reads the value from a specified digital pin, either HIGH or LOW.

• digitalWrite(pin, value)
– Used for output by using the LOW/HIGH logic level (i.e. 0V / 5V) digitalWrite(10,HIGH);
– value: LOW / HIGH

• analogRead(pin)
– Access and gets value from a particular Analog pin having 10-bit resolution (i.e. 10- val = analogRead(A3);
bit ADC)
– Returns: 0-1023 (integer)
– Arduino UNO yields a resolution between readings of: 5 volts / 1024 units. It will
map input voltages between 0 and the operating voltage(5V or 3.3V) into integer
values between 0 and 1023.
– The input range can be changed using analogReference()

• analogWrite(pin, value)
– Write the analog value (PWM wave) to a pin analogWrite(9, val / 4);
– value: it is the duty cycle value between 0 and 255 (as 6 pins).
– Note: analogRead values go from 0 to 1023, analogWrite values from 0 to 255

08-08-2022 Dr. Manas Khatua 6


Cont…
• delay(ms)
– Pause the program for the amount of time (in millisecond) delay(1000); // wait for a second
specified by ms

• Serial.begin( speed )
– It sets the speed in bps (baud rate) for serial data transmission Serial.begin(9600);
from computer to Arduino board

• Serial.available ()
– Returns: the number of bytes (characters) available to read
if (Serial.available() > 0) { }

• Serial.print( value )
– Print data to the serial port as human-readable ASCII text
Serial.print("I received: ");
– Numbers are printed using ASCII character for each digit
– Floats are printed as ASCII digits (upto 2 decimal places)
– Bytes are send as a single character
– Characters and Strings are sent as is.

• Serial.print( value, format)


Serial.print(i,DEC);
– The optional 2nd argument specifies the base (format) to use
– format: BIN / OCT / DEC / HEX // Print Decimal value of number i

• Serial.println( value) , Serial.println( value, format)


– Additionally it returns the number of bytes written

08-08-2022 Dr. Manas Khatua 7


Cont…
• Serial.read() incomingByte = Serial.read();
– Reads incoming serial data.

Serial.write(45); // send a byte with the value 45


• Serial.write(val) or .write(str) or .write(buf, len)
– Writes binary data to the serial port.
– This data is sent as a byte or series of bytes; to send the int bytesSent = Serial.write("hello"); //send the
characters representing the digits of a number use string "hello" and return the length of the string.
the print() function instead.

• Trigonometry:
– cos()
– sin()
– tan()

• Math:
– abs()
– max()
– min()
– pow()
– sq()
– sqrt()
– random()
– randomSeed()

08-08-2022 Dr. Manas Khatua 8


Programming Example 1: Blinking LED
• Requirements:
– Arduino UNO
– USB connector
– Breadboard
– LED
– 1K Ohm resistor
– Arduino IDE

• Connection:
– Place the LED and resistor on breadboard
– Connect the digital out pin with Anode, and
ground with Cathode of the LED
– Connect the bradboard power with Arduino
– Connect the Arduino board with PC/Laptop

• Arduino Programming
– Install IDE in PC/Laptop
– Run the IDE
– Select the Arduino board in IDE
– Select the connected COM port
– Start writing new sketch

08-08-2022 Dr. Manas Khatua 9


Cont…

• Write this sketch as shown


in the left figure

• Build this sketch and


upload in Arduino board

• OUTPUT:
 LED connected with digital
pin 9 will periodically blink.

08-08-2022 Dr. Manas Khatua 10


Example 2: Binary Counter in LED
• Requirements:
– Arduino UNO
– USB connector
– Breadboard
– 4 piece LEDs
– 4 piece 1K ohm resistor
– Arduino IDE

• Connection:
– Place the LED and resistor on breadboard
– Connect the bradboard power with Arduino
– Connect the LED with Arduino
– Connect the Arduino board with PC/Laptop

• Arduino Programming
– Install IDE in PC/Laptop
– Run the IDE
– Select the Arduino board in IDE
– Select the connected COM port
– Start writing new sketch

08-08-2022 Dr. Manas Khatua 11


Sketch of Binary Counter

08-08-2022 Dr. Manas Khatua 12


Demo on Binary Counter in LED

08-08-2022 Dr. Manas Khatua 13


Lessons Learned

 What is Arduino Programming

 Syntax of Arduino Programming

 Supporting variable, structures, operators

 In-Built Arduino Function Library

 Programming example - LED blink

 Program and Demo on binary counter in LED

08-08-2022 Dr. Manas Khatua 14


08-08-2022 Dr. Manas Khatua 15
CS578: Internet of Things
UART
Serial Communication

Dr. Manas Khatua


Assistant Professor, Dept. of CSE, IIT Guwahati
E-mail: manaskhatua@iitg.ac.in

“We suffer as a result of our own actions; it is unfair to blame anybody for it.” – Ma Sarada Devi
UART
 UART stands for Universal Asynchronous Receiver Transmitter
• one of the earliest modes of communication applied to computers
• its origin goes back at least as far as the 1960s
• called ‘universal’ because its parameters — speed, data size and so on — are not fixed
and can be configured, however, both side should agree

• It is used for asynchronous serial communication


• Serial communication stands for the process of sending data one bit at a time
sequentially
• Asynchronous means there is no clock signalling line to synchronize, and
transmitter and receiver might turn on at different time instant
• Two devices do not necessarily share a common clock.
• Both systems might for example agree on some fixed Baud rate.

 Baud rate is a measure of the speed of data transfer, expressed as symbol / sec.
 Also represented by bit per second (bps).
 Bit Rate = Baud rate x the number of bit per baud
 Common baud rates: 9600, 4800, 19200, 38400, etc.

15-08-2022 Dr. Manas Khatua 2


Clock based Synchronization

Source: Google Image

15-08-2022 Dr. Manas Khatua 3


Synchronization in UART
 This synchronisation is done in the form of a high to low (or low to high)
transition on the data line.
 The line will ideally high in idle
 then drop low when transmit starts.
 This transition acts to synchronise the timing between both devices.
 The receiver then knows to clock in enough cycles of data based on its baud clock.

15-08-2022 Dr. Manas Khatua 4


Synchronization in UART
 This synchronisation is done in the form of a high to low (or low to high)
transition on the data line.
 The line will ideally high in idle
 then drop low when transmission starts.
 This transition acts to synchronise the timing between both devices.
 The receiver then knows to clock in enough cycles of data based on its baud clock.

 However, there are two problems with this scheme:


 The single high to low transition is not enough to synchronise timing over a long
period of time.
 So, they need periodic re-synchronisation.
 If the first bit of data it wants to send is also represented by a high level, then there
are no transition, and vice-versa.
 So, they need some way to distinguish the first bit.

Both of these problems are solved in UART by using start and stop bits.
15-08-2022 Dr. Manas Khatua 5
UART Communication
 UART Communication
• Communication may be simplex, full duplex, or half duplex

• Simplex: One direction only, transmitter to receiver

• Half Duplex: Devices take turns transmitting and receiving

• Full Duplex: Devices can send and receive at the same time

• Data format and transmission speed are configurable

• Communication goes through the two independent lines/wires

• TX (transmission)

• RX (reception).

15-08-2022 Dr. Manas Khatua 6


Data Framing

Start Bit:
• The UART transmission line is normally held at a high voltage level when it’s not transmitting data
i.e. idle
• It start bit is set to logic low as it is used to signal the receiver that a new framing is coming.

Data Frame:
• If one parity bit is used, then next 5-8 bits carry the “data bits” (information).
• Otherwise, data bits can be 5-9 bits
• Certainly, the standard data size is 8-bit byte, but other sizes have their uses.
• A 7-bit data chunk can be more efficient than 8, especially if you're just transferring 7-bit ASCII
characters.
15-08-2022 Dr. Manas Khatua 7
Cont…

Parity:
• It is an optional bit.
• It is used to detect the wrong data packets, i.e. error during transmission
• Two type of parity bit used: even parity, odd parity.
• Even parity:
• If the count of bits with value 1 is odd, the parity bit value is set to 1, making the total
count of occurrences of 1s in the whole set (including the parity bit) an even number.
• If the count of 1s in a given set of bits is already even, the parity bit's value is 0.
• Odd parity:
• the coding is reverse of even parity.

Stop Bits:
• To signal the end of the data packet, the sending UART drives the data transmission line from a low
voltage to a high voltage.

15-08-2022 Dr. Manas Khatua 8


Steps of UART Communication
1. The transmitting UART receives data in parallel from the data bus:

2. The transmitting UART adds the start bit, (even) parity bit, and stop bit(s) to the data frame:
Cont…
3. The entire packet is sent serially from the transmitting UART to the receiving UART. In most
cases, the data is sent with the least significant bit first.

The receiving UART samples the data line at the pre-configured baud rate:

4. The receiving UART discards the start bit, parity bit, and stop bit from the data frame:
Cont…
5. The receiving UART converts the serial data back into parallel and transfers it to the data bus
on the receiving end:

Note:
• For communication between the devices, both of them have to have same baud rate
• The baud rate between the transmitting and receiving UARTs can only differ by max 10%.
Use of Start bit
As time matters with asynchronous signals,
it is needed to send a "LISTEN UP" signal.

Without any time reference, they all


look alike as a voltage signal.

Source: https://electronics.stackexchange.com/questions/335695/why-the-start-bit-and-the-stop-bits-are-necessary

15-08-2022 Dr. Manas Khatua 12


Use of Stop bits
• In the first figure, no
transition for start bit !

• So, the stop bit ensures the


line goes back to the idle
state at the end of the
transmission.

• It also gives the receiver a


time window to handle the
bytes just received, reset,
and get ready to listen for
the next start bit.

• Note: Start & Stop bits are


used for synchronization, but
not to define the data length

Source: https://electronics.stackexchange.com/questions/335695/why-the-start-bit-and-the-stop-bits-are-necessary

15-08-2022 Dr. Manas Khatua 13


9600 8N1 (an example)
• 9600 8N1 – 9600 baud, 8 data bits, no parity, and 1 stop bit - is one of the more
commonly used serial protocols.

• A device transmitting the ASCII characters 'O' and 'K' would have to create two packets
of data.
• The ASCII value of O (that's uppercase) is 79, which breaks down into an 8-bit binary
value of 01001111, while K's binary value is 01001011

• Since we're transferring at 9600 bps, the time spent holding each of those bits high or
low is 1/(9600 bps) or 104 µs per bit.
• For every byte of data transmitted, there are actually 10 bits being sent: a start bit, 8
data bits, and a stop bit.
• So, at 9600 bps, we're actually sending 9600 bits per second or 960 (9600/10) bytes per
second.
15-08-2022 Dr. Manas Khatua 14
Advantages and Disadvantages
Advantages:
1) Well documented and widely used method.

2) Only uses two wires

3) No clock signal is necessary

4) Has a parity bit to allow for error checking

5) The structure of the data packet can be changed as long as both sides are set up for it.

Disadvantages:
1) The size of the dataframe is limited to max 9 bits.

2) Doesn’t support multiple slave or multiple master systems

3) The baud rate of each UART must be with 10% of each other.

15-08-2022 Dr. Manas Khatua 15


Applications and Standards
 UART is normally used in microcontrollers for exact requirements,

 Today, UART is being used in many applications like


 GPS Receivers,
 Bluetooth Modules,
 GSM and GPRS Modems,
 Wireless Communication Systems,
 RFID based applications
 etc.

 The first of the serial data transmission standards was RS232, or more correctly RS-
232 or COM-port. This was developed in 1962.

 There are more recent standards which allow high speed data transmission along
with multiple transmitters and receivers

 e.g. USB, DP, HDMI, DDR, Ethernet, PCI Express, SAS/SATA, Thunderbolt, etc.
Lessons Learned

 What is serial communication

 What is asynchronous communication

 UART communication mechanism

 Pros and Cons of UART communication

 Applications of UART communication


Thanks!

15-08-2022 Dr. Manas Khatua 18


CS578: Internet of Things
IoT Architecture

Dr. Manas Khatua


Assistant Professor, Dept. of CSE, IIT Guwahati
E-mail: manaskhatua@iitg.ac.in

“We must have life-building, man-making, character-making assimilation of ideas.” – Swami Vivekananda
Traditional Data Flow in IoT

IoT Network Core Network

Image Source: http://events17.linuxfoundation.org/sites/events/files/slides/Intelligence%20at%20the%20Edge.pdf

21-08-2022 Dr. Manas Khatua 2


What is Architectural Plan?
Smart Home

 Networks run the modern


business

 So, it should never be built


without careful planning

Driving forces:
 Architecture is how you design (i.e. graphical  Scale
structure) your application or solution.  Security
 Constrained devices
 Essence of IoT architecture:  Massive data
 how the data is  Data analysis
 transported,  Support to legacy
 collected, devices
 analyzed, and
 ultimately acted upon.

21-08-2022 Dr. Manas Khatua 3


Basic 3-Layer architecture
• Perception layer is the physical layer,
which has sensors for sensing and
gathering information about the
environment.

• Network layer is responsible for


connecting to other smart things,
network devices, and servers. Its
features are also used for
transmitting and processing sensor
data.

• Application layer is responsible for


delivering application specific
services to the user. For example,
smart homes, smart cities, smart
health, etc.

Source: https://www.pinterest.com/pin/641129696942354756/

21-08-2022 Dr. Manas Khatua 4


IoT Architecture
• In the past several years, architectural standards and frameworks have emerged

• Two best-known architectures: oneM2M and IoT World Forum (IoTWF)

Source: https://onem2m.org/using-onem2m/developers/basics

21-08-2022 Dr. Manas Khatua 5


oneM2M Architecture
Goal of oneM2M architecture:
• to create a common services layer, which can be readily embedded in field
devices to allow communication with application servers.

Challenges in IoT Architecture: • Using the smart building use case, a


• heterogeneity of devices, security application can detect when
• heterogeneity of software, nobody is in the building.
• Heterogeneity of access methods • It could then trigger lights to be switched
off and for the HVAC system to operate
on a reduced setting.
Image Source: https://onem2m.org/using-onem2m/developers/basics

21-08-2022 Dr. Manas Khatua 6


oneM2M Architecture
• Proposed by European Telecommunications Standards Institute (ETSI)
• oneM2M architecture divides IoT functions into three major domains.
First

• Defines application-layer protocols

• Attempts to standardize northbound


API definitions for interaction with
business intelligence (BI) systems

• A northbound interface allows a


particular component of a network to
communicate with a higher-level
component.

• Applications have their own sets of


data models

21-08-2022 Dr. Manas Khatua 7


oneM2M Architecture
• Proposed by European Telecommunications Standards Institute (ETSI)
• oneM2M architecture divides IoT functions into three major domains.
First Second
• horizontal framework
across the vertical
industry applications.

• Include:
• the physical
network that the
IoT applications
run on. (e.g.
backhaul network)
• the underlying
management
protocols
• the hardware

21-08-2022 Dr. Manas Khatua 8


oneM2M Architecture
• Proposed by European Telecommunications Standards Institute (ETSI)
• oneM2M architecture divides IoT functions into three major domains.
First Second
• top is the common
services layer

• This layer adds APIs and


middleware supporting
third-party services and
applications.

• Service layer can be


readily embedded within
various hardware and
software nodes

• A RESTful API uses HTTP


requests to GET, PUT,
POST and DELETE data.
21-08-2022 Dr. Manas Khatua 9
oneM2M Architecture
• Proposed by European Telecommunications Standards Institute (ETSI)
• oneM2M architecture divides IoT functions into three major domains.
First Second Third

IoT devices,
communicat
ion network
(802.15.4,
LoRa, WiFi)

21-08-2022 Dr. Manas Khatua 10


IoTWF Architecture – 7 Layer Stack
• IoTWF architectural committee (led by Cisco, • Control flowing from the
IBM, Rockwell Automation, and others) center to the edge

• Decompose the IoT


problem into smaller parts

• Identify different
technologies at each layer

• Different parts of a system


can be provided by
different vendors

• Tiered security model


enforced at the transition
points between levels
• offers a clean, simplified perspective on IoT
• includes edge computing, data storage, and access • Define interfaces that
• succinct way of visualizing IoT from a technical perspective leads to interoperability

21-08-2022 Dr. Manas Khatua 11


Layers 1 & 2
Layer 1: Physical Devices Layer 2: Connectivity Layer
and Controllers Layer • focus is on connectivity

• home of the “things” in IoT

• “things” can be from a


microscopic sensors to giant
machines in a factory

• primary function is
generating data

• capable of being queried


and/or controlled over a
network.

21-08-2022 Dr. Manas Khatua 12


Layer 3 : Fog Layer
Basic principle:

Layer 3: Edge Computing Layer information processing is initiated as


early and as close to the edge of the
• often referred to as the “fog” layer network as possible.
• emphasis is on
– Data reduction by filtering and
cleaning up

– Reformatting and compressing data

– Initial processing of data (e.g. alert


generation, data validation, etc)

21-08-2022 Dr. Manas Khatua 13


Upper Layers: Layers 4–7

Layers Functions
Layer 4: Data Accumulation • Captures data and stores it for applications
• Convert event-based data to query-based processing
Layer 5: Data Abstraction • Reconciles multiple data formats
• Ensures consistent semantics for various data sources
• Confirmation about dataset completeness
Layer 6: Application • Interpret data using software applications
• Applications may monitor, control, and provide report
based on analysing the data
Layer 7: Collaboration and • Consumes and shares the application information
processes • Collaborating and communicating IoT information
21-08-2022 Dr. Manas Khatua 14
Simplified IoT Architecture
• It highlights the fundamental building blocks that are common to most IoT
systems and which is intended to help in designing an IoT network.

• IoT architectural framework is presented as two parallel stacks


• Core IoT Functional Stack
• IoT Data Management and Compute Stack

21-08-2022 Dr. Manas Khatua 15


Lessons Learned

 What is the need of IoT architecture?

 Different type of IoT Architectures

 About oneM2M architecture

 About IoT WF architecture

 About Simplified IoT Architecture

21-08-2022 Dr. Manas Khatua 16


Figures and slide materials are taken from the following sources:

1. David Hanes et al., “IoT Fundamentals: Networking Technologies, Protocols,


and Use Cases for the Internet of Things”, 1st Edition, 2018, Pearson India.

21-08-2022 Dr. Manas Khatua 17


CS578: Internet of Things

The “Things” in IoT

Dr. Manas Khatua


Assistant Professor, Dept. of CSE, IIT Guwahati
E-mail: manaskhatua@iitg.ac.in

“Arise! Awake! Stop not till the goal is reached.”‐ Swami Vivekananda.
The “Things”
 Sensors & Actuators are the fundamental building 
blocks of IoT
 Sensor senses Sensor
 Actuator acts

 Smart objects are any physical objects that contain
Actuator
 Embedded technology
 Sensors and/or actuators

 Smart objects are to sense and/or interact with 
their environment in a meaningful way
 by being interconnected, and
 enabling communication among themselves or an 
external agent. Smart Object

03‐10‐2020 Dr. Manas Khatua 2
Sensors
• It measures some physical quantity and converts that measurement into analog/digital form

• There are a number of ways to group and cluster sensors into different categories

– Based on external energy requirement
• Active / Passive

– Based on placement location
• Invasive / Non‐invasive

– Based on distance from the sensing object
• Contact / No‐contact

– Based on application industry
• Medical / Manufacturing / Agriculture / etc.

– Based on measuring scale
• Absolute / Relative

– Based on sensing mechanism
• Thermoelectric / Electromechanical / Piezo resistive / Optic / Electric / Fluid mechanics / Photoelastic / etc.

– Based on sensing parameter
• Position / Occupancy / Motion / Velocity / Force / Pressure / Flow / Humidity / Light / Temperature / Acoustic / 
Radiation / Chemical / Biosensors / etc.

03‐10‐2020 Dr. Manas Khatua 3
Sensor Types: What it measures
Sensor Type Description Example
Position • Measures the position of an object • Proximity sensor
• Position could be absolute/relative • Potentiometer
• Position sensor could be linear, angular,  • Inclinometer
or multi‐axis
Occupancy • Detects the presence of people and  • Radar Sensor
animals in a surveillance area
• Generates signal even when a person is 
stationary
Motion • Detects the movement of people and  • Passive Infrared (PIR) 
objects Sensor

Ultrasonic Proximity  Infrared Proximity  Microwave Radar  PIR Motion 


Sensor Sensor Sensor Sensor
03‐10‐2020 Dr. Manas Khatua 4
Cont…
Sensor Type Description Example
Velocity and  • Velocity sensor measures how fast an  • Gyroscope
Acceleration object moves • Accelerometer
• Acceleration sensor measures the 
changes in velocity
Force • Detects whether a physical force is  • Tactile sensor
applied and the magnitude of the force • Viscometer
Pressure • Measuring the force applied by liquids  • Barometer
or gases • Piezometer
• It is measured as force per unit area

Gyroscope Capacitive Touch Sensor Barometric Pressure Sensor


03‐10‐2020 Dr. Manas Khatua 5
Cont…
Sensor Type Description Example
Flow • Detects the rate of fluid flow through a  • Water meter
system in given period of time • Anemometer
Humidity • Detects amount of water vapour in the air • Hygrometer
• Can be measured in absolute/relative scale • Soil moisture sensor
Light • Detects the presence of light • LDR light sensor
• Photodetector
• Flame Sensor 

Soil moisture  LDR light  Flame 


Water meter
sensor sensor sensor

03‐10‐2020 Dr. Manas Khatua 6
Cont…
Sensor Type Description Example
Radiation • Detects the radiation in the environment • Neutron detector
• Geiger‐Muller counter
Temperature • Measures the amount of heat or cold  • Thermometer
present in the system • Temperature gauge
• Two type: contact / non‐contact • Calorimeter

Neutron detector Geiger‐Muller counter Temperature  Thermo‐


Sensor Hygrometer

03‐10‐2020 Dr. Manas Khatua 7
Cont…
Sensor Type Description Example
Acoustic • Measures sound level • Microphone
• Hydrophone
Chemical • Measures the concentration of a  • Smoke detector
chemical (e.g. CO2) in a system • Breathalyzer
Biosensor • Detects various biological elements, such  • Pulse oximeter
as organisms, tissues, cells, enzymes,  • Electrocardiograph (ECG)
antibodies, nucleic acid, etc. • Blood glucose biosensor

Hydrophone Breathalyzer Pulse oximeter


03‐10‐2020 Dr. Manas Khatua 8
Sensors in a Smart Car

03‐10‐2020 Dr. Manas Khatua 9
Sensors in a Smartphone

03‐10‐2020 Dr. Manas Khatua 10
Actuators
• Sensors are designed to sense and measure the surrounding environment

• Actuators receive some type of control signal (commonly an electrical 
signal or digital command) that triggers a physical effect, usually some 
type of motion, force, and so on.

Source: https://cdn2.hubspot.net/hubfs/1878050/Landingpages/Events/Schwabengipfel/Guido_Schmutz_IoT‐Cloud‐or‐OnPrem.pdf?t=1501051153000

03‐10‐2020 Dr. Manas Khatua 11
Cont…

Source: 
https://bridgera.com/iot‐
system‐sensors‐actuators/

Source: 
https://www.novatec‐
gmbh.de/blog/sensors‐
and‐actuators‐of‐the‐iot/

03‐10‐2020 Dr. Manas Khatua 12
Actuator Classification
• Common ways to classify actuators:

 Type of motion they produce
• e.g. linear, rotary, one/two/three axes

 Power output
• e.g. high power, low power, micro power

 Binary / Continuous output
• Based on number of stable‐state outputs

 Area of application
• Specific industry or vertical where they are used 

 Type of energy
• e.g. mechanical energy, electrical energy, hydraulic energy, etc.

03‐10‐2020 Dr. Manas Khatua 13
Actuators by Energy Type
Type Examples

Mechanical actuators Lever, Screw jack, Hand crank

Electrical actuators Thyristor, Bipolar transistor, Diode

Electromechanical actuators AC motor, DC motor, Step motor

Electromagnetic actuators Electromagnet, Linear solenoid

Hydraulic and Pneumatic  Hydraulic cylinder, Pneumatic cylinder, Piston, 
actuators Pressure control valve, Air motor

Smart material actuator (includes  Magnetorestrictive material, Bimetallic strip, 


thermal and magnetic actuators) Piezoelectric bimorph

03‐10‐2020 Dr. Manas Khatua 14
Smart Objects
• It is the building blocks of IoT

• Smart object has the following five characteristics:

– Sensor(s) and/or Actuator(s)

– Processing unit
• For acquiring sensed data from sensors,
• processing and analysing sensing data,
• coordinating control signals to any actuators, and
• controlling many functions (e.g. communication unit, power unit).

– Memory
• Mostly on‐chip flash memory
• user memory used for storing application related data
• program memory used for programming the device

– Communication unit
• Responsible for connecting a smart object with other smart 
objects and the outside world (via the network using 
wireless/wired communication)

– Power source
• To powered all components of the smart object
TelosB Mote

03‐10‐2020 Dr. Manas Khatua 15
Cont…

Source: Cisco
03‐10‐2020 Dr. Manas Khatua 16
Present Trends in Smart Objects

• Size is decreasing

• Power consumption is decreasing

• Processing power is increasing

• Communication capabilities are improving

• Communication is being increasingly standardized

03‐10‐2020 Dr. Manas Khatua 17
Lessons Learned

 What is “Things” in IoT

 Classification method of Sensors

 Different Sensors based on Sensing parameter

 Classification method of Actuators

 Different Actuators based on Energy type

 What is “Smart object” in IoT

03‐10‐2020 Dr. Manas Khatua 18
Figures and slide materials are taken from the following Books:

1. David Hanes et al., “IoT Fundamentals: Networking Technologies, Protocols, 
and Use Cases for the Internet of Things”, 1st Edition, 2018, Pearson India. 

03‐10‐2020 Dr. Manas Khatua 19
CS578: Internet of Things

IoT Access Technologies

Dr. Manas Khatua


Assistant Professor, Dept. of CSE, IIT Guwahati
E-mail: manaskhatua@iitg.ac.in

“All Birds find shelter during a rain. But Eagle avoids rain by flying above the Clouds” – APJ Abdul Kalam
Communications Criteria
• A large number of wired and
wireless access technologies are
available

• Communication criteria describes


the characteristics and attributes
of access technologies

• Wireless communication is
prevalent for smart object
connectivity
– ease of deployment
– allows smart objects to be mobile
without losing connectivity

• Few basic criteria:


• Range • Topology
• Frequency bands • Constrained devices
• Power consumptions • Constrained-node networks

10-09-2022 Dr. Manas Khatua 2


Communication Range

• Short range:
– tens of meters of maximum distance between two devices • Long range
– often considered as an alternative to serial cable – greater than 1 mile (1.6 km)
between two devices
– IEEE 802.15.1 Bluetooth, IEEE 802.15.7 Visible Light
Communications (VLC) – Wireless : 2G, 3G, 4G, Outdoor
Wi-Fi (IEEE 802.11ah), Low-
Power Wide-Area (LPWA)
• Medium range communications
– tens to hundreds of meters between two devices – Wired : IEEE 802.3 ethernet
– Wireless : IEEE 802.11 WiFi, IEEE 802.15.4 Low Rate WPAN, over optical fiber, IEEE 1901.2
IEEE 802.15.4g Smart Utility Networks (SUN) Broadband PLC
– Wired : IEEE 802.3 Ethernet, IEEE 1901.2 Narrowband
Power Line Communications (PLC)

10-09-2022 Dr. Manas Khatua 3


Frequency Bands

• Radio spectrum is regulated by countries and/or organizations (e.g. International


Telecommunication Union (ITU), Federal Communications Commission (FCC))
• frequency bands leveraged by wireless communications are split between licensed
and unlicensed bands.
• Unlicensed
• Licensed – industrial, scientific, and medical (ISM)
– applicable to long-range access technologies portions of the radio bands
– users must subscribe to services – Unlicensed means that no guarantees or
interference protections are offered
– common licensed spectrum for IoT : Cellular
(900-2100 MHz), NB-IoT (700-900 MHz), – well-known ISM bands for IoT : 2.4 GHz,
WiMax 5 GHz, 915 MHz for WiFi, BLE, ZigBee;
868 MHz for LoRa
10-09-2022 Dr. Manas Khatua 4
Cont…
• Examples of circuit switching networks
– Public telephone network
– Private branch exchange (PBX) system
– Data switch system

• In circuit switching, the path is established before data transmission begins.


– Sometimes less efficient as channel capacity remains unused
– There is connection establishment delay prior to data transfer

10-09-2022 Dr. Manas Khatua 5


ISM Bands in India

• India also allow 865-867 MHz ISM band


10-09-2022 Dr. Manas Khatua 6
Power Consumption
• Powered node • Battery-powered nodes
– node has a direct connection to a power – bring more flexibility to IoT devices
source – batteries are small
– communications are usually not limited – batteries can be changed or recharged
by power consumption criteria
– IoT wireless access technologies must
– ease of deployment is limited by the address
availability of a power source • the needs of low power consumption
– makes mobility more complex • connectivity for battery-powered nodes

Bluetooth ZigBee WiFi LoRaWAN NB-IoT


Standard IEEE 802.15.1 IEEE 802.15.4 IEEE 802.11b LoRaWAN 3GPP NB-IoT
Sleeping 9 µA 12 µA 30 µA 0.1 µA 3 µA
Awake/Idle 35 mA 50 mA 245 mA 1.4 mA 6 mA
Transmitting 39 mA 52 mA 251 mA 44 mA 220 mA
Receiving 37 mA 54 mA 248 mA 12 mA 46 mA
Power Supply 3.3 V 3.3 V 5 V* 3.3 V 3.6 V
* The ESP8266 module powered by 3.3 V could be used as WiFi module.
10-09-2022 Dr. Manas Khatua 7
Topology
• Three main topology schemes are dominant:
– star, mesh, and peer-to-peer • IEEE 802.15.4, 802.15.4g,
and wired IEEE 1901.2a
• For long-range and short-range technologies: PLC are generally deployed
– star topology is prevalent as a mesh topology.

• Indoor Wi-Fi deployments


• For medium-range technologies: are mostly star topologies
– star, peer-to-peer, or mesh topology is common

FFD: A node that


implements the full
network functions

RFD: The device can


implement a subset of
protocol functions to
perform just a specialized
part (communication
with the coordinator).
10-09-2022 Dr. Manas Khatua 8
Constrained Devices
• Constrained nodes have limited resources that impact their
networking feature set and capabilities.

• RFC 7228 defines three classes for constrained nodes: Class 0, 1, 2

RAM Flash IP stack Security Example


Storage Scheme
Class 0 < 10 KB < 100 KB Not No Push
present button
Class 1 > 10 KB > 100 KB Optimized Light Sensors
IP stack
Class 2 > 50 KB > 250 KB Full IP Yes Smart
stack meter

10-09-2022 Dr. Manas Khatua 9


Constrained-Node Networks
• Constrained-node networks are often referred to as low-power and lossy networks (LLNs)

• Layer 1 and Layer 2 protocols must be evaluated in using the following characteristics:
– data rate and throughput
– latency and determinism
– overhead and payload.

• Data rate & throughput:


– data rates available from 100 bps to tens of Mbps
– actual throughput is less, sometimes much less, than the data rate
• Latency & determinism:
– When latency is a strong concern, emergent access technologies such as Time-Slotted Channel
Hopping (TSCH) mode of IEEE 802.15.4e should be considered.
• Overhead & Payload
– The minimum IPv6 MTU size is expected to be 1280 bytes.
– MTU size for IEEE 802.15.4 is 127 bytes; payload in LoRaWAN may be from 19 to 250 bytes
– So, the fragmentation of the IPv6 payload has to be taken into account by the link layer

10-09-2022 Dr. Manas Khatua 10


IoT Access Technologies
• there are many IoT technologies in the market today

10-09-2022 Dr. Manas Khatua 11


IEEE 802.15.4 PHY and MAC

IEEE 802.15.4 is the IEEE standards for Low Rate Wireless Networks (or Low Rare Wireless
Personal Area Networks). Version 2015 is followed in this portion.

For more details:


2011 version: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=6012487
2015 version: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=7460875
2020 version: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=9144691

10-09-2022 Dr. Manas Khatua 12


IEEE 802.15 Task Group 4
• TG4 was formed to define low-data-rate PHY and MAC layer specifications for wireless
personal area networks (WPAN)

• standard has evolved over time: • PAN


 IEEE 802.15.4-2003 ; IEEE 802.15.4-2006 – span a small area
 IEEE 802.15.4-2011; IEEE 802.15.4-2015 • e.g., a private home or an
 IEEE 802.15.4-2020 individual workspace

– short distance
communication

– low-powered
communication

– primarily uses ad-hoc


networking

– could be wireless or wired


10-09-2022 Dr. Manas Khatua 13
IEEE 802.15.4
• IEEE 802.15.4 is a wireless access technology for
 low-cost and low-data-rate devices
 devices powered by batteries

• It enables easy installation using a compact protocol stack

• Several network communication stacks leverage this technology for many IoT
use cases in both the consumer and business markets.

• Few applications:
 Home and building automation
 Automotive networks
 Industrial wireless sensor networks
 Interactive toys and remote controls

10-09-2022 Dr. Manas Khatua 14


Cont…
• Few well-known protocol stacks
which leverage the IEEE 802.15.4:
• ZigBee shows how 802.15.4 can
 ZigBee
be leveraged at the PHY and MAC
 ZigBee IP
layers, independent of the
 6LoWPAN
protocol layers above.
 WirelessHART
 Thread
 ISA100.11a
• Criticisms:
 MAC reliability
 unbounded latency
 susceptibility to interference
and multipath fading
 lacks a frequency-hopping
technique

10-09-2022 Dr. Manas Khatua 15


ZigBee
• ZigBee specification was ratified in 2004
ZigBee in Digi’s
• ZigBee Alliance is an industry group Xbee radio module
 certify interoperability between vendors
 evolving ZigBee as an IoT solution

• ZigBee solutions are aimed at smart objects and sensors


that have low bandwidth and low power needs.

• Well-known application domains:

Industrial and Commercial Smart Home Smart Energy


Automation Applications smart meters, that can
measuring temperature control lighting, monitor and control the use
and humidity, and tracking thermostats, and and delivery of utilities, such
assets security functions as electricity and water

10-09-2022 Dr. Manas Khatua 16


ZigBee Protocol Stack
Vendor Specific Application
• ZigBee predefines many application/
profiles for certain industries.
• Vendors can optionally create their own
custom ones.

ZigBee Platform Stack


• The application support layer interfaces
the lower portion of the stack, dealing
with the networking of ZigBee devices,
with the higher-layer applications

• ZigBee uses AODV routing across a mesh MAC & PHY Layers
network • ZigBee network & security layer provides
mechanisms for network startup,
configuration, routing, and securing
• ZigBee utilizes 128-bit AES encryption for communications.
security at the MAC layer
• ZigBee utilizes the IEEE 802.15.4
• It also provides security at the network and standard at the PHY and MAC layers
application layers.
10-09-2022 Dr. Manas Khatua 17
ZigBee IP
• ZigBee has not provided interoperability
with other IoT solutions or open standards

• ZigBee IP was created to embrace the open


standards at the network and transport
layers

• Open standards designed by IETF’s work on


LLNs, such as IPv6, 6LoWPAN, and RPL.

• ZigBee IP requires the support of


6LoWPAN’s fragmentation and header
compression schemes.

• ZigBee IP nodes support


– IPv6, • ZigBee IP is a compelling protocol stack
– ICMPv6, offering because it is based on current
– 6LoWPAN, IoT standards at every layer under the
– Neighbour Discovery (ND), and application layer.
– RPL for the routing of packets.

10-09-2022 Dr. Manas Khatua 18


IEEE 802.15.4 PHY layer
• Physical layer transmission options in IEEE 802.15.4-2015
– 2.4 GHz, 16 channels, with a data rate of 250 kbps
– 915 MHz, 10 channels, with a data rate of 250 kbps
– 868 MHz, 3 channel, with a data rate of 100 kbps

• Modulation schemes
– OQPSK PHY : Direct sequence spread spectrum (DSSS) PHY employing offset quadrature phase-shift
keying (OQPSK)
– BPSK PHY : DSSS PHY employing binary phase-shift keying (BPSK)
– ASK PHY : parallel sequence spread spectrum (PSSS) PHY employing amplitude shift keying (ASK)
and BPSK

Preamble (4 byte): identifies the start of the


frame; used to synchronize the data transmission

IEEE 802.15.4 PHY Frame Format SFD (1 byte): informs the receiver about the
starting point of frame content
10-09-2022 Dr. Manas Khatua 19
IEEE 802.15.4 MAC layer
• MAC layer manages access to the PHY channel
• defines how devices in the same area will share the frequencies allocated.
• Main tasks:
• Network beaconing for devices acting as coordinators
• PAN association and disassociation by a device
• Reliable link communications between two peer MAC entities
• Device security
16-bit short address
OR
64-bit extended address

• MAC frame types:


• Data frame
• Beacon frame
• ACK frame
• Command frame

10-09-2022 Dr. Manas Khatua 20


Cont…

Compress

10-09-2022 Dr. Manas Khatua 21


Topology
• Topology for 802.15.4:
• Star
• Peer-to-Peer
• Mesh

802.15.4 Sample Mesh Network Topology

• IEEE 802.15.4 does not define a path selection for a mesh topology
 Mesh-under: Path selection can be done at Layer 2
 Mesh-over: Path selection can occur at Layer 3 in routing protocol

10-09-2022 Dr. Manas Khatua 22


Security

• IEEE 802.15.4 specification uses Advanced Encryption Standard (AES) with a 128-bit
key length as the base encryption algorithm

• Message integrity code (MIC), which is calculated for the entire frame using the
same AES key, to validate the data that is sent

10-09-2022 Dr. Manas Khatua 23


IEEE 802.15.4g
IEEE 802.15.4e

IEEE 802.15.4g & IEEE 802.15.4e are the PHY and MAC layer amendments of wireless
personal area networks (IEEE 802.15.4) published in 2012.

For more details:


IEEE 802.15.4e-2012: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=6185525

10-09-2022 Dr. Manas Khatua 24


IEEE 802.15.4e & 802.15.4g
• Disadvantages of IEEE 802.15.4
– MAC reliability
– unbounded latency
– multipath fading

• IEEE 802.15.4e amendment of 802.15.4- • IEEE 802.15.4g amendment of


2011 expands the MAC layer feature set 802.15.4-2011 expands the PHY layer
feature set
 to remedy the disadvantages of 802.15.4.
 to better suitable in factory and process  to optimize large outdoor wireless mesh
automation, and smart grid networks for field area networks (FANs)
 to better suitable in smart grid or smart
 Main modifications were: utility network (SUN) communication
• frame format,
• security,  Main modifications were:
• determinism mechanism, • New PHY definitions
• frequency hopping • some MAC modifications were needed
to support the new PHY

10-09-2022 Dr. Manas Khatua 25


Wi-SUN PHY layer
• 802.15.4g-2012 and 802.15.4e-2012 led to additional difficulty in
– achieving the interoperability between devices and mixed vendors

• Wi-SUN Alliance was formed to guarantee interoperability

 IEEE 802.15.4 maximum payload size of 127 bytes  2047 bytes for SUN PHY.
– Fragmentation is no longer necessary at Layer 2 for IPv6 packets

 Error protection was improved in IEEE 802.15.4g by the CRC from 16 to 32 bits.

 SUN PHY supports multiple data rates and more channels in ISM bands

 Modulation schemes:
– MR-FSK : Multi-Rate and Multi-Regional Frequency Shift Keying
• good transmit frequency
– MR-OFDM : Multi-Rate and Multi-Regional Orthogonal Frequency Division Multiplexing
• good data rate
– MR-O-QPSK : Multi-Rate and Multi-Regional Offset Quadrature Phase-Shift Keying
• cost effective design

10-09-2022 Dr. Manas Khatua 26


802.15.4e MAC layer
• IEEE 802.15.4e amendment modifies: frame format, security, determinism
mechanism, frequency hopping

• Physical layer for implementation could be Wi-SUN PHY

• TSCH: Time Slotted Channel Hopping

 One type of MAC operation mode

 guaranteed media access by time slotted access


 time is divided in fixed time period – “time slots”
 in a time slot, one packet and its ACK can be transmitted
 multiple slots together form a “slot frame” which is repeated regularly
 offers guaranteed bandwidth
 offers predictable latency

 provide channel diversity by channel / frequency hopping


 reduce interference
 increase robustness in noisy environment. We can say increase reliability also.
 increase network capacity by parallel communication via multiple cell (using multiple channels)

 Transmitter and receiver maintain time & channel synchronization


 by a global timeslot counter and a global channel hopping sequence list

10-09-2022 Dr. Manas Khatua 27


Cont…

Source: Palattella et al., “Standardized Protocol Stack for the Internet of


(Important) Things”, IEEE Comm. Surv. & Tutor, vol. 15, no. 3, 2013, pp. 1389–1406.

10-09-2022 Dr. Manas Khatua 28


Cont…
• IE: Information Element
 allow for the exchange of information at the MAC layer
 either as header IEs (standardized) and/or payload IEs (private)
 carry additional metadata to support MAC layer services
 IEEE 802.15.9 key management
 Wi-SUN 1.0 IEs to broadcast and unicast schedule timing information,
 frequency hopping synchronization information for the 6TiSCH architecture

• EB: Enhanced Beacon


 allow the construction of application-specific beacon content
 includes relevant IEs in EB frames
 network metrics, frequency hopping broadcast schedule, and PAN information

• EBR: Enhanced Beacon Request


 allow the sender to selectively specify the request of information
 EBRs leverages IEs to specify

• Enhanced ACK
 allow for the integration of a frame counter for the frame being acknowledged
 helps to protect against certain attacks

10-09-2022 Dr. Manas Khatua 29


802.15.4e/g Frame Format
One or
more IEs

10-09-2022 Dr. Manas Khatua 30


Security and Topology
• Encryption is done by
AES with a 128-bit key

• Message integrity
code (MIC) validates
the data that is sent

Mesh Topology
• Battery-powered nodes
with a long lifecycle
requires
– optimized Layer 2
forwarding or
– optimized Layer 3
routing protocol

10-09-2022 Dr. Manas Khatua 31


IEEE 802.11ah

IEEE 802.11ah is a wireless networking protocol published in 2016.

For more details: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=7920364

10-09-2022 Dr. Manas Khatua 32


IEEE 802.11ah
• Advantages of WiFi • Disadvantages of WiFi
– Most successful endpoint wireless – Less signal penetration
technology – Unsuitable for battery powered
– Useful for high data rate devices, for nodes
audio-video analytics devices, for – Unable to support large number
deploying WiFi backhaul infrastructure of devices

• Wi-Fi Alliance defined a new technology


called Wi-Fi HaLow
 ah  Ha
 Low power network  Low

• Main use cases for IEEE 802.11ah


 Sensors and meters covering a smart grid
 Backhaul aggregation of industrial sensors
and meter data
 Extended range Wi-Fi

10-09-2022 Dr. Manas Khatua 33


802.11ah PHY layer
• Operating in unlicensed sub-GHz bands
 868–868.6 MHz for EMEAR (Europe, Middle East, Africa, and Russia)
 902–928 MHz for North America and Asia Pacific (India, Japan, Korea, …)
 314–316 MHz, 430–434 MHz, 470–510 MHz, 779–787 MHz for China

• OFDM Modulation

• Channels of 2, 4, 8, or 16 MHz (and also 1 MHz for low-bandwidth


transmission)

• Provides one-tenth of the data rates of IEEE 802.11ac

• Provide an extended range for its lower speed data


 For data rate of 100 kbps, the outdoor transmission range approx 1 Km

10-09-2022 Dr. Manas Khatua 34


802.11ah MAC layer
Enhancements and features
• Number of devices: Has been scaled up from 250 to 8192 per access point (AP).
• MAC header: Has been shortened

• Null data packet (NDP) support: to cover control and management frames.
– It is only transmitted by a STA; It carry’s no data payload.

• Restricted access window (RAW): increase throughput and energy efficiency by


– dividing stations into different RAW groups.
– Only the stations in the same group can access the channel simultaneously.

• Sectorization: partition the coverage area of a Basic Service Set (BSS) into sectors, each
containing a subset of stations. it uses an antenna array and beam-forming technique.
– reduces contention by restricting which group, in which sector, and at which time window.
– to mitigate the hidden node problem; to eliminate the overlapping BSS problem.

• Target wake time (TWT): allows an AP and STAs to “wake up” at negotiated times

• Speed frame exchange: Enables an AP and endpoint to exchange frames during a


reserved transmit opportunity (TXOP)
– TXOP is the amount of time a station can send frames when it has won contention for the medium

10-09-2022 Dr. Manas Khatua 35


802.11ah Topology

• Star topology

• Includes simple hops


relay to extend its range
– Max 2 hops
– Client handle the relay
operation

10-09-2022 Dr. Manas Khatua 36


LoRaWAN

LoRaWAN is a wireless networking protocol published in 2015.

For more details: https://lora-alliance.org/sites/default/files/2018-07/lorawan1.0.3.pdf

10-09-2022 Dr. Manas Khatua 37


LPWA Technology
• a new set of wireless technologies has received a lot of attention from the
industry, know as
– Low-Power Wide-Area (LPWA) technology

• unlicensed-band LPWA technology


– LoRaWAN

• licensed-band LPWA technology


– NB-IoT and Other LTE Variations

10-09-2022 Dr. Manas Khatua 38


LoRa Alliance
• Initially, LoRa was a PHY layer modulation scheme
– developed by a French company “Cycleo”; Later, Cycleo was acquired by Semtech.

• Semtech LoRa: Layer 1 PHY modulation technology available by multiple chipset vendors

• The LoRa Alliance is a technology alliance


– committed to enabling large scale deployment of Low-Power Wide Area Networks (LPWAN) IoT
– publishing LoRaWAN specifications for LPWAN

• LoRaWAN is a premier solution for global LPWAN deployments


– It is a MAC-layer protocol built on top of LoRa

LoRaWAN
Protocol Stack

10-09-2022 Dr. Manas Khatua 39


LoRa PHY layer
• Semtech LoRa PHY

• Uses a variation of chirp spread spectrum (CSS)


modulation
 it allows demodulation below the noise floor, offers
robustness to noise and interference

 manages a single channel occupation by different LoRa Module: SX1276


spreading factors (SFs) 868MHz band

• Main unlicensed sub-GHz frequency bands


 433 MHz
 779–787 MHz
 863–870 MHz ( In India: 868 MHz)
 902–928 MHz

LoRa GPS Shield


with Arduino LoRa Shield for Arduino
10-09-2022 Dr. Manas Khatua 40
LoRaWAN MAC layer
• Classifies LoRaWAN endpoints into three classes. Uplink Transmission

Class A:
• this is default
implementation
• optimized for battery-
powered nodes
• allows bidirectional
communications
• two receive windows are
available after each
transmission

Class B:
• Class B node should get additional
receive windows compared to Class A Class C:
• gateways must be synchronized • This class is particularly adapted for
through a beaconing process powered nodes
• “ping slots”, can be used by the • enables a node to be continuously
network infrastructure to initiate a listening by keeping its receive window
downlink communication open when not transmitting

10-09-2022 Dr. Manas Khatua 41


LoRaWAN MAC Frame Format

Node Addressing:
endpoints are also
known by their 32-bit
end device address
• 7 bit for network
• 25 bit for devices

10-09-2022 Dr. Manas Khatua 42


LoRaWAN Address Space
• LoRaWAN knows a number of identifiers for devices, applications and
gateways.
 DevEUI - 64 bit end-device identifier, EUI-64 (unique)
 DevAddr - 32 bit device address (non-unique)

 AppEUI - 64 bit application identifier, EUI-64 (unique)

 GatewayEUI - 64 bit gateway identifier, EUI-64 (unique)

• LoRaWAN devices have a 64 bit unique identifier (DevEUI) that is assigned to


the device by the chip manufacturer or the authorized owner.

• However, all communication is done with a dynamic 32 bit device address


(DevAddr) of which 7 bits are fixed for the Network, leaving 25 bits that can
be assigned to individual devices.

* EUI-64 (Extended Unique Identifier) is a method we can use


to automatically configure IPv6 host addresses.
10-09-2022 Dr. Manas Khatua 43
LoRaWAN Gateway
• LoRa gateway is deployed as the center hub of a star
network architecture.

• It uses multiple transceivers and channels


Dragino LoRa Gateway
– It can demodulate multiple channels at once

– It can also demodulate multiple signals on the same channel


simultaneously

• LoRa gateways serve as a transparent bridge relaying


data between endpoints

• The endpoints use a single-hop wireless connection to


communicate with one or many gateways

• Data rate varies depending on the frequency


bands and adaptive data rate (ADR)

– ADR is an algorithm that manages data rate and


radio signal for each endpoint.

10-09-2022 Dr. Manas Khatua 44


Cont…
• LoRa has the ability to handle various data rates via spreading factor (SF)
• Best practices:
– Use ADR for fixed endpoints
– Use fixed data rate or spreading factor for mobile endpoints

LoRaWAN Data Rate


Example
• Low SF  high data rate,
less distance
• High SF  low data rate,
longer distance

10-09-2022 Dr. Manas Khatua 45


LoRaWAN Security
• LoRaWAN supports: protect communication and data privacy across the network

• LoRaWAN endpoints must implement two layers of security


– Network security applied in MAC layer
• authentication of the endpoints
• protects LoRaWAN packets by performing encryption based on AES

• Each endpoint implements a network session key (NwkSKey)


• The NwkSKey ensures data integrity through computing and checking the message integrity
code (MIC) of every data message

– Data privacy applied at the end points (end device and application server)
• second layer is an application session key (AppSKey)
• performs encryption & decryption functions between the endpoint and its application
server.
• it computes and checks the application-level MIC

• LoRaWAN service provider does not have access to the application payload if it is
not allowed

10-09-2022 Dr. Manas Khatua 46


LoRaWAN Node Registration
• LoRaWAN endpoints attached to a LoRaWAN network must get registered and
authenticated.

– Activation by personalization (ABP)


• Endpoints don’t need to run a join procedure
• Individual details (e.g. DevAddr and the NwkSKey and AppSKey keys) are preconfigured and
stored in the end device.

• This same information is registered in the LoRaWAN network server.

– Over-the-air activation (OTAA)


• Endpoints are allowed to dynamically join a particular LoRaWAN network after successfully
going through a join procedure.
• During the join process, the node establishes its credentials with a LoRaWAN network server,
exchanging its globally unique DevEUI, AppEUI, and AppKey.

• AppKey is then used to derive the session keys: NwkSKey and AppSKey.

10-09-2022 Dr. Manas Khatua 47


NB-IoT
and
Other LTE Variations

10-09-2022 Dr. Manas Khatua 48


NB-IoT
• Well-known Cellular Technology • Disadvantage
– GSM: Global System for Mobile Communications
– GPRS: General Packet Radio Service
– Not adapted to battery-
– CDMA: Code Division Multiple Access
powered small devices like
– EDGE: Enhanced Data Rates for GSM Evolution IoT smart objects
– 3G/UMTS: Universal Mobile Telecommunications System
– 4G/LTE: Long-Term Evolution

• In 2015, 3GPP approved a proposal to standardize a new narrowband radio


access technology called Narrowband IoT (NB-IoT)

• It address the requirement:


 massive number of low-throughput devices,
 low device power consumption,
 extended coverage – rural and deep indoors
 optimized network architecture.

• NB-IoT is addressing the LPWA IoT market opportunity using licensed spectrum
– New physical layer signals and channels are designed

• NB-IoT can co-exist with 2G, 3G, and 4G mobile networks

10-09-2022 Dr. Manas Khatua 49


Comparison of Access Technologies

WiFi BLE Thread Sub-GHz: TI SigFox ZigBee LoRa


Max. Data 72 Mbps 2 250 200 100 250 50
throughput Mbps Kbps Kbps bps Kbps Kbps
Range 100 m 750 m 100 m 4 km 25 km 130 m 10 km
Topology Star P2P/ Mesh/ Star Star Mesh/ Star of Star
Mesh Star Star
Frequency 2.4 GHz 2.4 GHz 2.4 GHz Sub-GHz Sub-GHz 2.4 GHz Sub-1GHz
Power 1 Year (AA Up to years on a coin-cell battery for limited range Few Years
consumption battery) (AA battery)
IP at the Yes No Yes No No No No
device node
Deployed AP smart No No No No No
Devices phones

10-09-2022 Dr. Manas Khatua 50


Lessons Learned
 Different Attributes of Access Technologies in IoT
 Communication criteria
 Communication Range
 Frequency Band
 Power consumption
 Topology

 Different Access Technologies in IoT


 IEEE 802.15.4
 IEEE 802.1.5.4e
 IEEE 802.11ah
 LoRaWAN
 NB-IoT

10-09-2022 Dr. Manas Khatua 51


Figures and slide materials are taken from the following sources:

1. David Hanes et al., “IoT Fundamentals: Networking Technologies, Protocols,


and Use Cases for the Internet of Things”, 1st Edition, 2018, Pearson India.

10-09-2022 Dr. Manas Khatua 52


CS578: Internet of Things
IEEE 802.15.4
Low-Rate Wireless Networks
2011 version: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=6012487
2015 version: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=7460875
2020 version: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=9144691

Dr. Manas Khatua


Assistant Professor, Dept. of CSE, IIT Guwahati
E-mail: manaskhatua@iitg.ac.in

“The highest education makes our life in harmony with all existence.” – Rabindranath Tagore
IEEE 802.15.4 LR-WPAN
 A low-rate wireless personal area network (LR-WPAN) is a
 simple,
 low-cost communication network
 that allows wireless connectivity in applications
 with limited power and
 relaxed throughput requirements.

 The main objectives of an LR-WPAN are


 ease of installation,
 reliable data transfer,
 extremely low cost,
 a reasonable battery life,
 while maintaining a simple and flexible protocol.

Reference: IEEE Std 802.15.4™‐2020, “IEEE Standard for Low‐Rate Wireless Networks”,
Developed by the LAN/MAN Standards Committee of the IEEE Computer Society, Approved on 6 May 2020.

10-09-2022 Dr. Manas Khatua 2


IEEE 802.15.4 Stack – PHY & MAC
 IEEE 802.15.4 standard is limited to the PHY & MAC Layers

 IEEE 802.15.4 standard PHY provides the PHY data service and
PHY management services:
 The PHY data service enables the transmission and reception of
PHY protocol data units (PPDU) across the physical radio channel.

 The PHY's features include


 radio transceiver activation/deactivation,
 radio channel selection,
 energy level detection (ED) and
 received signal quality or link quality indicator (LQI),
 clear channel assessment (CCA), and
 transmitting and receiving packets in 2.4-GHz band.

 IEEE 802.15.4 standard MAC provides the MAC data service


and MAC management services.
 The MAC data service enables transmission of MAC protocol data
units (MPDU) across the PHY data service.

 The MAC sublayer features include


 beacon management,
 channel access,
 GTS management,
LLC: Logical Link Control – provides protocol multiplexing  frame validation,
SSCS: Service Specific Convergence Sublayer  ACK frame delivery, and
 association and disassociation.

Image Source: https://www.embedded.com/ieee-802-15-4-zigbee-hardware-and-software-open-the-applications-window/

10-09-2022 Dr. Manas Khatua 3


What is ZigBee Alliance?
• An alliance of organizations with a mission to define
– reliable,
– cost effective,
– low-power,
– wirelessly networked, • Alliance provides
– monitoring and control products – interoperability,
– based on an open global standard
– certification testing, and
– branding

• ZigBee Alliance
 45+ companies: Semiconductor mfrs, IP providers, OEMs, etc.

10-09-2022 Dr. Manas Khatua 4


ZigBee/802.15.4 architecture
• ZigBee Alliance
 Defining upper layers of protocol stack:
from network to application, including
application profiles
• ZigBee takes full advantage of a
powerful physical radio specified by
• IEEE 802.15.4 Working Group IEEE 802.15.4
 Defining lower layers of protocol stack: MAC
and PHY • ZigBee adds
– logical network,
– security, and
– application software
Applications

Application Framework

Network & Security ZigBee


Specification
Application
MAC Layer
802.15.4 ZigBee stack
PHY Layer
Hardware

10-09-2022 Dr. Manas Khatua 5


ZigBee network applications

monitors TV VCR
sensors DVD/CD
automation Remote control
control
INDUSTRIAL & CONSUMER
COMMERCIAL ELECTRONICS

monitors mouse
diagnostics ZigBee keyboard
sensors LOW DATA-RATE joystick
PC &
RADIO DEVICES PERIPHERALS
PERSONAL
HEALTH CARE

security
consoles HVAC
portables lighting
educational TOYS & HOME closures
GAMES AUTOMATION

10-09-2022 Dr. Manas Khatua 6


IEEE 802.15.4 PHY

10-09-2022 Dr. Manas Khatua 7


IEEE 802.15.4 PHY overview
• PHY functionalities:

• Activation & deactivation of the radio transceiver

• Energy detection within the current channel

• Link quality indication for received packets

• Clear channel assessment (CCA) for CSMA-CA

• Channel frequency selection

• Data transmission and reception

10-09-2022 Dr. Manas Khatua 8


Spectrum
• Federal Communications of Commissions (FCC) in USA decides frequency bands

• Applications using ISM band do not require a licence for stations emitting less than 1W.

FCC Band Max. Transmit Power Frequencies


Industrial Band <1W 902 MHz – 928 M Hz
Scientific Band <1W 2.4 GHz – 2.48 GHz
Medical Band <1W 5.725 GHz – 5.85 GHz
U-NII (Unlicensed < 40 mW 5.15 GHz – 5.25 GHz
National Information < 200 mW 5.25 GHz – 5.35 GHz
Infrastructure)
< 800 mW 5.725 GHz – 5.82 GHz

• Physical layer transmission options in IEEE 802.15.4-2015

– 2.4 GHz, 16 channels, data rate 250 kbps


– 915 MHz, 10 channels, data rate 250 kbps
– 868 MHz, 3 channel, data rate 100 kbps

10-09-2022 Dr. Manas Khatua 9


Spread Spectrum
• Idea of Spread Spectrum is
– to spread the information signal over a wider bandwidth
– to make jamming and interception more difficult.
– can be used to transmit analog / digital data, using an analog signal

• Types:
 frequency hopping spread spectrum (FHSS)
 direct sequence spread spectrum (DSSS)

Channel coding is accomplished by selectively introducing redundant bits into the transmitted information stream.

Modulation is the process by which some characteristic of a carrier wave is varied in accordance with an information/ modulating signal.

10-09-2022 Dr. Manas Khatua 10


Cont…
• Pseudorandom numbers

– generated by an algorithm using some initial value called the seed

– produce sequences of numbers that are not statistically random, but passes reasonable tests of
randomness

– unless you know the algorithm and the seed, it is impractical to predict the sequence

• Gain from this apparent waste of spectrum

– The signals gains immunity from various kinds of noise and multipath distortion.

– Immune to jamming attack

– It can also be used for hiding and encrypting signals.

– Several users can independently use the same higher bandwidth with very little interference. (e.g. CDMA)

10-09-2022 Dr. Manas Khatua 11


DSSS
• each bit in the original signal is represented by multiple bits in the transmitted signal,
using a spreading code

• spreading code spreads the signal across a wider frequency band in direct proportion
to the number of bits used

Spread the
data stream

Transmit the
spread data using
modulation

10-09-2022 Dr. Manas Khatua 12


Modulation
Modulation schemes
• OQPSK PHY : DSSS PHY employing Offset Quadrature Phase-Shift Keying (OQPSK)
• BPSK PHY : DSSS PHY employing binary phase-shift keying (BPSK)
• ASK PHY : PSSS PHY employing Amplitude Shift Keying (ASK) and BPSK

Amplitude Shift Keying (ASK) Binary Phase-Shift Keying (BPSK)

10-09-2022 Dr. Manas Khatua 13


QPSK

In-phase
Constellation diagram
quadrature for QPSK
phase

Quadrature Phase-Shift Keying (QPSK)


• More efficient use of bandwidth
– as each signalling element
represents more than one bit.
10-09-2022 Dr. Manas Khatua 14
Orthogonal QPSK
• Problem in QPSK: large phase shift at high transition rate is difficult to perform.
Phase shift is 180° in QPSK.

• OQPSK
 a variation of QPSK known as
offset QPSK or orthogonal
QPSK
 a delay of one bit time is
introduced in the Q stream of
QPSK
 Its spectral characteristics and
bit-error performance are the
same as that of QPSK
 at any time the phase change
in the combined signal never
exceeds 90° (π/2)

10-09-2022 Dr. Manas Khatua 15


Other Attributes

• IEEE 802.15.4 does not prefer to use frequency hopping to minimize energy consumption.
• To minimize interference in 2.4 GHz band, IEEE 802.15.4 prefer channel no. 15, 20, 25, 26

• Transmission power is adjustable from 0.5 mW (min. in 802.1.5.4) to 1 W (max. in ISM band)
• Transmission power 1 mW provides theoretical distances as:
– Outdoor range 300 m.
– Indoor range 100 m.

10-09-2022 Dr. Manas Khatua 16


Cont…
• 802.15.4 PHY provides energy detection (ED) feature

– Application can request to asses each channel’s energy level

– Coordinator can make optimal selection of channel based on channels energy level

• 802.15.4 PHY provides link quality information (LQI) to Network and Application layers

– Transmitter may decide to use high transmission power based on LQI

– Applications may dynamically change 802.15.4 channels based on LQI

• 802.15.4 uses CSMA/CA which ask the PHY layer to do CCA

– Clear Channel Assessment (CCA):


• Can be energy threshold regardless of modulation
• Can be detection of modulation
• Can be both the above

10-09-2022 Dr. Manas Khatua 17


PHY Frame
• PHY packet fields
– Preamble (32 bits) – synchronization of data transmission
– SFD (8 bits) – shall be formatted as “1110 0101”
– PHY header (8 bits) – PSDU length
– PSDU (0 to 127 bytes) – data field

Sync Header PHY Header PHY Payload


Start of Frame Reserved PHY Service
Preamble Frame Length (1 bit) Data Unit (PSDU)
Delimiter (7 bit)
4 Octets 1 Octets 1 Octets
0-127 Bytes

10-09-2022 Dr. Manas Khatua 18


IEEE 802.15.4 MAC

10-09-2022 Dr. Manas Khatua 19


IEEE 802.15.4 Device Types
• There are two different device types :
– full function device (FFD)
– reduced function device (RFD)

• The FFD can operate in three modes by serving as


– PAN Coordinator
• scanning the network and selecting optimal RF channel
• selecting the 16 bit PAN ID for the network

– Coordinator (aka Parent, Join Proxy)


• relaying messages to other FFDs including PAN coordinator
• transmits periodic beacon (under beacon enable access mode)
• respond to beacon requests

– Device
• cannot route messages
• usually receivers are switched off except during transmission
• attached to the network only as leaf nodes

• The RFD can only serve as:


– Device

10-09-2022 Dr. Manas Khatua 20


Topology

10-09-2022 Dr. Manas Khatua 21


General MAC Frame Format

MAC frame types:


• Data frame
• ACK frame
• Beacon frame
• Command frame

10-09-2022 Dr. Manas Khatua 22


Cont…

Frame Control

10-09-2022 Dr. Manas Khatua 23


Beacon Frame Format
Octets:2 1 4 or 10 2 variable variable variable 2
Beacon Pending Frame
Frame Source address Superframe GTS
sequence address Beacon payload check
control information specification fields
number fields sequence
MAC
MAC header MAC payload
footer

Bits: 0-3 4-7 8-11 12 13 14 15


Beacon Superframe Final CAP Battery life PAN Association
Reserved
order order slot extension coordinator permit

Beacon Beacon

CAP CFP

GTS GTS
Inactive
0 1

Superframe 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Time
SD = aBaseSuperframeDuration*2SO symbols (Active)
SO: superframe order
BO: beacon order BI = aBaseSuperframeDuration*2BO symbols
PAN coordinator decides SO, BO

10-09-2022 Dr. Manas Khatua 24


Command Frame Format

Octets:2 1 4 to 20 1 variable 2
Data Frame
Frame Address Command
sequence Command payload check
control information type
number sequence
MAC
MAC header MAC payload
footer

• Command Frame Types


– Association request – Orphan Notification
– Association response – Beacon request
– Disassociation notification – Coordinator realignment
– Data request – GTS request
– PAN ID conflict notification

10-09-2022 Dr. Manas Khatua 25


Data & ACK Frame Format
Data Frame
Octets:2 1 4 to 20 variable 2
Data Frame
Frame Address
sequence Data payload check
control information
number sequence
MAC
MAC header MAC Payload
footer

ACK Frame
Octets:2 1 2
Data Frame
Frame
sequence check
control
number sequence
MAC
MAC header
footer

10-09-2022 Dr. Manas Khatua 26


Device Addressing
• Two or more devices communicating on the same physical channel constitute a WPAN.
– A WPAN includes at least one FFD (PAN coordinator)
– Each independent PAN will select a unique PAN ID

• Each device operating on a network has a unique 64-bit address


– called extended unique identifier (EUI-64)
– This address can be used for direct communication in the PAN

• A device also has a 16-bit short address, which is allocated by the PAN coordinator when the device
associates with its coordinator.
– Same short address may be present in to different PAN

• IEEE 802.15.4 devices can be grouped into PAN. These are identified by their 2 Byte PAN identifier

10-09-2022 Dr. Manas Khatua 27


Addressing Modes
• IEEE 802.15.4 frames contain address of both the source & destination.

• Three different addressing modes, which sets the address data (none/short/long,
with/without PAN ID)

– Short addressing mode: The address field includes a short address (2B) and a PAN ID (2B) = (total
of 4 bytes).

– Long addressing mode: The address field includes a long address (8B) and a PAN ID (2B) = (total of
10 bytes).

– No addressing mode:
• Both addresses are missing from ACK frames.
• For data and command frames, only one (either source or destination) field can be omitted
– if the source address is omitted, it means the PAN coordinator sent the frame;
– if the destination address is missing, it means it should be received by the PAN coordinator.

10-09-2022 Dr. Manas Khatua 28


Superframe
Beacon Beacon

CAP CFP

GTS GTS
Inactive
0 1

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

SD = aBaseSuperframeDuration*2SO symbols (Active)

BI = aBaseSuperframeDuration*2BO symbols

• superframe order (SO) : decides the length of


• A superframe is divided into two parts the active portion in a superframe

– Inactive: all station sleep. • beacon order (BO) : decides the length of a
• no communication superframe or beacon transmission period
• nodes can turn their radios off and go into power saving mode
• beacon-enabled network should satisfy
– Active: 0≦SO≦BO≦14
• Active period is divided into 16 slots in general
• PAN coordinator decides SO, BO
• 16 slots are further divided into two parts • Default value: SO=3, BO=5
– Contention access period (CAP)
– Contention free period (CFP) • SD: Superframe Duration
– Beacon only period (BOP) • BI: Beacon Interval

10-09-2022 Dr. Manas Khatua 29


Cont…
• aBaseSlotDuration
= The number of symbols forming a superframe slot when the superframe order (SO) is equal to zero
= 60 PHY symbols

• aNumSuperframeSlots
= The number of slots contained in any superframe
= 16

• aBaseSuperframeDuration
= The number of symbols forming a superframe when the superframe order (SO) is equal to zero
= aBaseSlotDuration × aNumSuperframeSlots

• So, Length of a superframe


= can range from 15.36 msec to 215.7 sec (= 3.5 min).

• Beacons are used for


– announcing the existence of a PAN
– synchronizing with other devices
– informing pending data in coordinators
– starting superframes

10-09-2022 Dr. Manas Khatua 30


Cont…
• In a “beacon-enabled” network (i.e. uses superframe structure)

– Devices use the slotted CAMA/CA mechanism to contend for the channels

– FFDs who require fixed rates of transmissions can ask for GTS from the coordinator

• In a “nonbeacon-enabled” network (i.e. do not use superframe structure)

– Devices use the unslotted CAMA/CA mechanism for channel access

– GTS shall not be permitted

• CSMA/CA is not used for Beacon transmission; also not for Data frame transmission during CFP

• Each device will be


– active for 2-(BO-SO) portion of the time
– sleep for 1 - 2-(BO-SO) portion of the time

• Duty Cycle:

BO-SO 0 1 2 3 4 5 6 7 8 9 ≧10

Duty cycle (%) 100 50 25 12 6.25 3.125 1.56 0.78 0.39 0.195 < 0.1

10-09-2022 Dr. Manas Khatua 31


Data Transfer: Device -> Coordinator
In a beacon-enable network In a non-beacon-enable network
• a device finds the beacon to synchronize
to the superframe structure. • device simply transmits its data using
• Then it uses slotted CSMA/CA to unslotted CSMA/CA
transmit its data.

Communication to a coordinator Communication to a coordinator


In a beacon-enabled network In a non-beacon-enabled network

10-09-2022 Dr. Manas Khatua 32


Data Transfer: Coordinator -> Device
• Data transferred from coordinator to device
– in a beacon-enabled network:
• The coordinator indicates in the beacon that some data
is pending.
• A device periodically listens to the beacon and transmits
a Data Request command using slotted CSMA/CA.
• Then ACK, Data, and ACK

• Data transferred from coordinator to device


– in a non-beacon-enable network:
• The device transmits a Data Request using unslotted CSMA/CA.
• If the coordinator has its pending data, an ACK is replied.
• Then the coordinator transmits Data using unslotted CSMA/CA.
• If there is no pending data, a data frame with zero length
payload is transmitted.
• ACK is replied

10-09-2022 Dr. Manas Khatua 33


Channel Access Mechanism
• CSMA/CA random channel access method

• This method was developed to decrease the chances of


collisions when two or more stations start sending their
signals over the datalink layer.

• CSMA requires that each station first check the state of


the medium before sending.

• Persistence methods can be applied to take action


when the channel is busy/idle.

 1-persistent
 When station found idle channel, it transmits the frame
without any delay.

 p-persistent
 If the channel found to be idle, it transmits the frame with
probability p

 Non-persistent
 when the channel is found busy, it will wait for the random
time and again sense for the state of the station whether idle
or busy

10-09-2022 Dr. Manas Khatua 34


Slotted CSMA/CA
• CSMA/CA random channel access Backoff:
• is an algorithm that uses
 beacon-enabled network  uses slotted CSMA/CA feedback to multiplicatively
decrease the rate of some
In slotted CSMA/CA: process
 The backoff period boundaries of every device in the PAN shall be
aligned with the superframe slot boundaries of the PAN coordinator Binary exponential backoff (BEB)
 i.e. the start of first backoff period of each device is aligned with the • After c collisions in BEB algo.,
start of the beacon transmission
the delay is randomly chosen
 The MAC sublayer shall ensure that the PHY layer commences all of from [0, 1, ..., N] slots, where
its transmissions on the boundary of a backoff period N = 2c − 1, and expected
backoff time (in slots) is N/2.

Note:
CW in 802.15.4 is
not same with
CW in 802.11

10-09-2022 Dr. Manas Khatua 35


Unslotted CSMA/CA
• CSMA/CA random channel access

 nonbeacon-enabled network  uses unslotted CSMA/CA

In unslotted CSMA/CA:
 The backoff periods of one device are not related in time to the
backoff periods of any other device in the PAN.

 One backoff period = aUnitBackoffPeriod.

10-09-2022 Dr. Manas Khatua 36


Slotted CSMA/CA
• Each device maintains 3 variables for each transmission attempt

– NB (Number of Backoff): number of times that backoff has been taken in this attempt of transmission
• if exceeding macMaxCSMABackoff, the attempt fails

– BE (Backoff Exponent): play the role to decide how many backoff periods a device shall wait before
attempting to assess a channel.
• the number of backoff periods is greater than the remaining number of backoff periods in the CAP
– Otherwise, MAC sublayer shall pause the backoff countdown at the end of the CAP,
and resume it at the start of the CAP in the next superframe

– CW (Contention Window): the number of clear slots that must be seen after each backoff
• always set to 2 and count down to 0 if the channel is sensed to be clear
• The design is for some PHY parameters, which require 2 CCA for efficient channel usage.

• Note: CW in 802.15.4 is not same with CW in 802.11


– CW in 802.11 is used to decide the backoff window from which the backoff period is choosen randomly
– CW in 802.15.4 is used to decide how many rounds of CCA is required before getting the channel access

• Battery Life Extension (BLE):


– designed for very low-power operation, where a node only contends in the first few slots

10-09-2022 Dr. Manas Khatua 37


Cont…
Slotted CSMA
need 2 CCA
Delay for
random(2BE - 1) unit to ensure no
backoff periods
CW=2
NB = 0, CW =0 collision

Y Perform CCA on
Battery life BE = lesser of
backoff period
extension? (2, macMinBE)
boundary
N

BE = macMinBE Y
Channel idle?

Locate backoff CW = 2, NB = NB+1, CW = CW - 1


period boundary BE = min(BE+1, aMaxBE)

N NB> N
macMaxCSMABackoffs CW = 0?
?

NB (Number of Backoff) Y Y
BE (Backoff Exponent)
CW (Contention Window) Failure Success

CCA (Clear Channel Assessment)


10-09-2022 Dr. Manas Khatua 38
Contention in 802.11 & 802.15.4

Contention in
IEEE 802.11 DCF

Contention in
IEEE 802.15.4
(for slotted CSMA/CA)

10-09-2022 Dr. Manas Khatua 39


Why 2 CCAs to Ensure Collision-Free
• Each CCA occurs at the boundary of a backoff slot

• Each Backoff Slot duration = 20 PHY symbols


• Each CCA duration = 8 PHY symbols

• The standard specifies that a transmitter node performs the CCA twice in
order to protect acknowledgment (ACK).

– When an ACK packet is expected, the receiver shall send it after a tACK time on the
backoff boundary
• tACK varies from 12 to 31 symbols

– One-time CCA of a transmitter may potentially cause a collision between a newly-


transmitted packet and an ACK packet.

– (See examples below)

10-09-2022 Dr. Manas Khatua 40


Why 2 CCAs (case 1)
Backoff slot aUnitBackoffPeriod =
boundary aTurnaroundTime +
aCcaTime = 12+8 sym

Existing
session for
DATA & ACK

New CCA
transmitter
Backoff Detect
end here an ACK

New
transmitter CCA CCA

Backoff Detect
end here an ACK
10-09-2022 Dr. Manas Khatua 41
Why 2 CCAs (Case 2)
Backoff slot
boundary aTurnaroundTime

Existing
session for
DATA & ACK

New CCA
transmitter
Backoff Detect
end here an ACK

New
transmitter CCA

Backoff Detect
end here an DATA
10-09-2022 Dr. Manas Khatua 42
Why 2 CCAs (Case 3)
Backoff boundary

Existing
session for
DATA & ACK

New CCA CCA


transmitter
Backoff Detect
end here an ACK

New
transmitter CCA

Backoff Detect a
end here DATA
10-09-2022 Dr. Manas Khatua 43
Unslotted CSMA/CA
Un-slotted CSMA

NB = 0,
only one
BE = macMinBE
CCA

Delay for
random(2BE - 1) unit
backoff periods

Perform CCA

Y
Channel idle?

NB = NB+1,
BE = min(BE+1, aMaxBE)

N NB>
macMaxCSMABackoffs
?
NB (Number of Backoff) Y
BE (Backoff Exponent)
Failure Success
CW (Contention Window)
CCA (Clear Channel Assessment)
10-09-2022 Dr. Manas Khatua 44
GTS Concepts
• A guaranteed time slot (GTS) allows a device to operate on the channel within a
portion of the superframe

• A GTS shall only be allocated by the PAN coordinator

• The PAN coordinator can allocated up to 7 GTSs at the same time

• The PAN coordinator decides whether to allocate GTS based on:


– Requirements of the GTS request
– The current available capacity in the superframe

10-09-2022 Dr. Manas Khatua 45


Cont…
• A GTS can be deallocated
– At any time at the discretion of the PAN coordinator, OR
– By the device that originally requested the GTS

• A device that has been allocated a GTS may also operate in the CAP

• A data frame transmitted in an allocated GTS shall use only short addressing

• Before GTS starts, the GTS direction shall be specified as either Tx or Rx


– Each device may request one transmit GTS and/or one receive GTS

• A device shall only attempt to allocate and use a GTS if it is currently tracking the
beacon

• If a device loses synchronization with the PAN coordinator, all its GTS allocations
shall be lost

• The use of GTSs by an RFD is optional

10-09-2022 Dr. Manas Khatua 46


Security

• IEEE 802.15.4 specification uses Advanced Encryption Standard (AES) with a 128-bit
key length as the base encryption algorithm

• Message integrity code (MIC), which is calculated for the entire frame using the
same AES key, to validate the data that is sent

10-09-2022 Dr. Manas Khatua 47


Limitations in 802.15.4
• Disadvantages of IEEE 802.1.5.4
– MAC reliability
– unbounded latency
– multipath fading
• IEEE 802.15.4e amendment of • IEEE 802.15.4g amendment of
802.15.4-2011 expands the MAC 802.15.4-2011 expands mainly
layer feature set PHY layer feature set

 to remedy the disadvantages of  to optimize large outdoor


802.15.4. wireless mesh networks for field
 to better suitable in factory and area networks (FANs)
process automation, and smart grid  to better suitable in smart grid or
smart utility network (SUN)
 Main modifications were: communication
• frame format,
• security,  Main modifications were:
• determinism mechanism, and • New PHY definitions
• frequency hopping • some MAC modifications needed to
support the new PHY

10-09-2022 Dr. Manas Khatua 48


Lessons Learned
 What is IEEE 802.15.4

 What is ZigBee

 IEEE 802.15.4. PHY


– Functionalities
– Spread Spectrum, DSSS
– Modulation, QPSK, OQPSK

 IEEE 802.15.4 MAC


– MAC Frame Formats
– Timeslot, Superframe
– Device Addressing
– Data Transfer Model
– Channel Access Methods
– Guaranteed time slot (GTS)
– Association Procedure
– Security

 Limitations of IEEE 802.15.4

10-09-2022 Dr. Manas Khatua 49


Figures and slide materials are taken from the following sources:

1. David Hanes et al., “IoT Fundamentals: Networking Technologies, Protocols,


and Use Cases for the Internet of Things”, 1st Edition, 2018, Pearson India.
2. Oliver Hersent et al., “The Internet of Things: Key Applications and Protocols”,
2018, Wiley India Pvt. Ltd.
10-09-2022 Dr. Manas Khatua 50
CS578: Internet of Things
IEEE 802.15.4e
IEEE 802.15.4e Standard: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=6185525
Article: “IEEE 802.15.4e: A survey” https://www.sciencedirect.com/science/article/pii/S0140366416301980

Dr. Manas Khatua


Assistant Professor, Dept. of CSE, IIT Guwahati
E-mail: manaskhatua@iitg.ac.in

“The best among you is the one who doesn’t harm others with his tongue and hands.” – Muhammad
Limitations of 802.15.4 MAC
 Unbounded latency  No protection against interferences
 Both BE and Non-BE mode use /multipath fading
CSMA/CA  Due to usage of single channel
 No bound on maximum delay to
reach destination
 Powered relay nodes in multi-hop
network
 Non-reliable communication
 Relay nodes keep their radio active always.
 Very low delivery ratio due to the
 complex synchronization and beacon
inefficiency of CSMA/CA
scheduling in BE mode for multihop
 Consume large energy

• So, IEEE 802.15.4 is unsuitable for many critical scenarios


• when applications have stringent requirements

13-09-2022 Dr. Manas Khatua 2


Requirements of Critical Applications
 Timeliness
 Deterministic latency for packet delivery

 Reliability
 Wire‐like reliability may be required, e.g., 99.9% or better

 Scalability
 Large network size

 Energy Efficiency
 Target battery lifetime: 5 years, or more

13-09-2022 Dr. Manas Khatua 3


Introduction to 802.15.4e
 IEEE 802.15 Task Group 4e was created in 2008

 To redesign the existing 802.15.4 MAC

 IEEE 802.15.4e MAC Enhancement Standard approved in 2012

 Contains idea from existing WirelessHART and ISA 100.11.a


 Time slotted access
 Shared and dedicated slots
 Multi-channel communication
 Frequency hopping

 Introduce five MAC behaviour modes to support specific applications

 General functional enhancements


 Not tied to any specific application domain

13-09-2022 Dr. Manas Khatua 4


MAC modes
 Time Slotted Channel Hopping (TSCH)
 Industrial automation and process control
 Delay sensitive applications

 Deterministic and Synchronous Multi-channel Extension (DSME)


 Industrial and commercial applications
 Non-delay tolerant and delay tolerant applications

 Low Latency Deterministic Network (LLDN)


 For single hop and single-channel networks
 Star topology
 Provides very low latency

13-09-2022 Dr. Manas Khatua 5


Cont..
 Asynchronous multi-channel adaptation (AMCA)
 For large network such as smart utility networks, infrastructure monitoring
 Used in non Beacon-Enabled PANs

 Device selects best link quality channel as its designated listening channel
 Sender node switch to receiver designated listening channel to transmit its data
 Beacon or Hello packet is used to advertise node designated listening channel

 Radio Frequency Identification Blink (BLINK)


 For Application like item/people identification, location and tracking
 Node communicate without prior association
 No ACK required
 Aloha protocol is used to transmit BLINK packet by “transmit only” devices

13-09-2022 Dr. Manas Khatua 6


General Functional Enhancements
These are not tied to any specific application domain:

 Low Energy (LE)


 Operate in very low duty cycle (<= 1%)
 Appearing always on to the upper layers
 Intended for applications that can trade latency for energy efficiency

 Information Elements (IE)


 Mechanism to exchange information at the MAC sublayer

 Enhanced Beacons (EB)


 Extension of the 802.15.4 beacon frames
 Allow to create application-specific frames, by including relevant IEs

13-09-2022 Dr. Manas Khatua 7


Cont..
 Multi purpose Frame
 MAC wise frame format, differentiate on Information Elements (IE)

 MAC Performance Metric


 To provide feedback on channel quality to upper layers
 IP protocol may implement dynamic fragmentation of datagrams depending on
the channel conditions

 Fast Association (FastA)


 Allows a node to associate in a reduced amount of time
 Critical application gives priority to latency over energy

13-09-2022 Dr. Manas Khatua 8


TSCH Mode
 Topology independent

 Time slotted access


 Increase throughput by eliminating collision
among competing nodes
• So, TSCH provides
• increased network capacity,
 Predictable and bounded latency
• high reliability, and
• predictable latency,
 Multi‐channel communication • while maintaining very low
 More nodes exchange their frames at the same duty cycles
time
 Increases network capacity

 Channel hopping
 Mitigates the effects of interference and multi-
path fading / multipath interference
 Improve reliability

13-09-2022 Dr. Manas Khatua 9


Slotframe Structure

• TsTxOffset: Timeslot
Transmission Offset
= TsCCAOffset + TsCCA + TsRxTx

13-09-2022 Dr. Manas Khatua 10


Synchronization
 In each slotframe, EB is broadcasted by PAN Coordinator or other FFDs
 For network advertisement and synchronization
 EB contains information of
 Channel hopping, timeslot details, and slotframe information for Synchronization

 A node can start sending its beacon only after getting a valid EB frame

 Nodes synchronize on a periodic slotframe

 Clock drift occurs due to


 Differences in manufacturing, temperature and supply voltage
 Clocks of different nodes typically pulse at a slightly different frequency

 Nodes need to periodically re-synchronize


 Frame-based synchronization
 ACK-based synchronization

13-09-2022 Dr. Manas Khatua 11


Channel Hopping
 The channel offset is translated in an operating frequency f using

𝑓 = 𝐹{ 𝐴𝑆𝑁 + 𝑐ℎ𝑂𝑓 mod 𝑛𝑐ℎ } ; ASN = k . S + t

 ASN (absolute slot number) : total # of slots elapsed since the network was deployed
 nch : number of physical channels presently available to consider
 F is implemented as a look‐up‐table containing the set of available channels
 k : count of slotframe cycle since the start of the network
 S : slotframe size
 t : timeslot in a slotframe
Max. no. of available
channel =16

Each channel is
identified by a
channelOffset

Channel could be
blacklisted because of
low quality
13-09-2022 Dr. Manas Khatua 12
Link and Schedule
 Link: Pairwise assignment of a directed communication between devices in a
specific slot, with a given channel offset

 Link is denoted by [ t, chOf ]


 t is timeslot no. in the slotframe
 chOf is channel offset

 Two types of Link


 Dedicated links
 Direct access
 One transmitter – One receiver
 Generally used for Data Packet
 Shared links
 TSCH CSMA‐CA protocol
 Multiple transmitters/receivers
 Generally used for Control Packet

13-09-2022 Dr. Manas Khatua 13


TSCH CSMA/CA
IEEE 802.15.4 default CSMA/CA v/s TSCH CSMA/CA algorithm

802.15.4 CSMA/CA TSCH CSMA/CA


Backoff Mechanism transmitting node waits for a backoff mechanism is activated only
random backoff time before after the node has experienced a
trying to transmit collision. By default no backoff
Backoff unit 320μs (~20 symbol duration) corresponds to a slot duration
duration (~10ms)
Clear Channel each node performs CCA to CCA is used to avoid the packet
Assessment (CCA) check the channel state, before transmission if a strong external
performing transmission interference is detected. Internal
collision is not possible due to TSCH.
Packet dropping If the sender consecutively only if it reaches the maximum
found channel busy for number of retransmissions i.e.,
macMaxCSMABackoffs times macMaxFrameRetries

13-09-2022 Dr. Manas Khatua 14


Cont…

(2BE –1)

Generally retransmission
in TSCH is not allowed.
It is handled by link
scheduling

CSMA/CA used in shared


link to avoid repeated
collisions.

In dedicated link, no
chance of collision.

13-09-2022 Dr. Manas Khatua 15


TSCH CSMA/CA

See the IEEE 802.15.4 –


2015 standard to get this
flowchart

13-09-2022 Dr. Manas Khatua 16


Network Formation
 PAN coordinator starts the process of network formation by sending EB frame
 Network advertisement

 EBs are special frames containing


 Synchronization information
 allows new devices to synchronize to the network

 Channel hopping information


 allows new devices to learn the channel hopping sequence

 Timeslot information
 describes when to expect a frame transmission and when to send an acknowledgment

 Initial link and slotframe information


 allows new devices to know:
o when to listen for transmissions from the advertising device
o when to transmit to the advertising device

13-09-2022 Dr. Manas Khatua 17


Cont..
 A new node starts listening for EB on a certain frequency

 Upon receiving an EB
 The MAC layer notifies the higher layer

 The higher layer initializes the slotframe and links


 Using information in the received EB message

 Switches the device into TSCH mode


 At this point the device is connected to the network

 The device allocates communication resources


 (i.e., slotframes and links)

 and starts advertising, on its turn

 the 802.15.4e standard did not define the EB advertising policy.

13-09-2022 Dr. Manas Khatua 18


Network Formation Goals
 Optimizing the network formation process
 Synchronized communication schedule consumes less energy of nodes by reducing
duty cycle

 Minimum Joining time


 Devices must keep the radio ON during the joining phase
 EBs should be sent frequently to reduce waiting time

 Minimize EB transmissions
 Frequent EB transmission consumes more communication resources
 Also Increases energy consumption at network and node level

A. Kalita and M. Khatua, "6TiSCH – IPv6 Enabled Open Stack IoT Network Formation: A Review",
ACM Transactions on Internet of Things, 2022.

13-09-2022 Dr. Manas Khatua 19


TSCH Link scheduling
 Assignment of unique link to node for data transmission

 Challenging in dynamic networks

 IEEE 802.15.4e standard does not specify how to derive an appropriate link
schedule

 Existing multi-channel scheduling schemes are not suitable for TSCH networks
 They do not allow per-packet channel hopping
 Not for resource-constrained nodes
 They are not efficient in terms of channel utilization

13-09-2022 Dr. Manas Khatua 20


Cont..
 Centralized Scheduling
 Link schedule computed and distributed by a special node
 Network coordinator
 Based on information received by all the nodes of the network
 Link schedule has to be re-computed and re-distributed every time a change in the
operating conditions occurs
 Not good for dynamic network and large scale network

 Distributed Scheduling
 Link schedule is computed autonomously by each node
 Based on local, partial information exchanged with its neighbors
 Limited Overhead
 Suitable for energy‐constrained nodes
 Good choice for dynamic network and large scale network

13-09-2022 Dr. Manas Khatua 21


TSCH: Open Issues
 Network Formation
 Current solution inefficient for
• Energy consumption
• Formation time
• Mobile Objects

 Security
 Selective Jamming (SJ) attacks
 Secure Beacons and Different Frequency hopping sequence

 TSCH network synchronization


 Energy consumption

 TSCH slot/cell scheduling


 Guaranteed QoS

13-09-2022 Dr. Manas Khatua 22


6TiSCH Network
 6TiSCH working group created by IETF
 Goal: integrate TSCH with the open source IP protocol stack
 To enable IPv6 over TSCH mode of IEEE 802.15.4e
 Defining a new functional entity in charge of TSCH scheduling

A new sublayer, called 6top


• Works on top of TSCH
• Build and manage TSCH
schedule
• add/delete links/cells
• 6top also collects
connectivity information
• Monitors the
performance of cells

Survey Article: “IETF 6TiSCH: A Tutorial” https://ieeexplore.ieee.org/document/8823863

13-09-2022 Dr. Manas Khatua 23


Need for 6TiSCH
 In 6TiSCH, the TSCH MAC mode is placed under an IPv6-enabled protocol stack:

• IPv6 over Low-Power Wireless Personal Area Network (6LoWPAN)


• IPv6 Routing Protocol for Low-Power and Lossy Networks (RPL), and
• Constrained Application Protocol (CoAP)

 TSCH does not define


 Policies to build and maintain the communication schedule

 Mechanisms to match the schedule to the multi‐hop paths maintained by RPL

 Mechanisms to adapt the resources allocated between neighbor nodes to the data
traffic flows

 Techniques to allow differentiated treatment of packets


 data packets & control packet

13-09-2022 Dr. Manas Khatua 24


6TiSCH Architecture
 Considers low-power lossy-network (LLN)

 Allow more than 1000 nodes

 Nodes are in same IPv6 subnet

 6LoWPAN Header compression (HC) is used to


transmit packet

 Presence of high-speed backbone (e.g. WiFi mesh) to


connect all nodes

 Constrained nodes are attached to backbone through


backbone router (BBR)

 Backbone is connected to the Internet through a


Gateway Fig. 6TiSCH Architecture

RFC 9030: An Architecture for IPv6 over the Time-Slotted Channel Hopping Mode of IEEE 802.15.4 (6TiSCH)

13-09-2022 Dr. Manas Khatua 25


6TiSCH Protocol Stack

RFC 9033

RFC 9031

Source: Xavier Vilajosana et al., “IETF 6TiSCH: A Tutorial” IEEE Communications Surveys & Tutorials, 22(1), 2020, pp. 595– 615.

13-09-2022 Dr. Manas Khatua 26


Lessons Learned

 Limitations of IEEE 802.15.4

 IEEE 802.15.4e
 MAC Modes
 Functional Enhancements

 IEEE 802.15.4 TSCH


– Functionalities
– TSCH CSMA/CA
– Network Formation
– Link Scheduling

 Introduction to 6TiSCH Networks

13-09-2022 Dr. Manas Khatua 27


13-09-2022 Dr. Manas Khatua 28

You might also like