You are on page 1of 27

IoT (Internet of Things)

The Internet of Things (IoT) is the network of physical objects embedded with electronics,
software, sensors, and network connectivity, which enables these objects to collect and
exchange data.
IoT allows objects to be sensed and controlled remotely across existing network
infrastructure
IoT enables any time, any place and any thing connection
NOTE : Things in IoT can be physical as well as virtual
Physical things include objects such as alarm system, water boiler, car, human beings, etc
Virtual things include online notification platforms, email, stocks, traffic, etc
All IoT systems contain the following elements :
1. Sensors and Actuators
Sensor – device that converts physical parameter to electrical output. Eg) light,
temperature, humidity, sound sensor, etc
Actuator – device that converts electrical signal to a physical output. Eg) creating
sound, vibrate, rotate

2. Communication infrastructure between servers or server platforms

3. Server/Middleware platforms

4. Data Analytics engines – they transform data to decisions

5. Apps (iOS, android, web)

Evolution of IoT

Data-Information-Knowledge in IoT
Data - Raw and unprocessed data obtained from IOT devices (generally does not have
meaning just on its own)
Information - Inferred/summarized from data by filtering, processing, categorizing data
Knowledge - Inferred from information by structuring information and is put into action to
achieve specific objectives.
Eg) Weather Monitoring system
Data - ((72,45);(84,56))
Information - Average temperature and humidity readings for last 5 minutes
Knowledge - An alert is raised if average temp in last 5 minutes exceeds 120F

Definition of IoT
A dynamic global network infrastructure with self-configuring capabilities based on
standard and interoperable communication protocols where physical and virtual “things”
have identities, physical attributes, and have virtual personalities and use intelligent
interface, and are seamlessly integrated into the information network, often communicate
data associated with users and their environments.
Characteristics of IoT :
1. Dynamic and self adapting – dynamically adapt to changing contexts and take action
based on environment conditions

2. Self-configuring – large number of devices can be connected & configured and thus,
can work together with minimal manual intervention

3. Interoperable Communication Protocols – IoT devices communicate and exchange


data

4. Unique identity – each device has unique identifier (such as IP address or URI)

5. Integrated into Information Network – makes IoT devices smart

Physical design of IoT


Communication Protocols – UART, I2C, SPI, CAN

UART(Universal Asynchronous Receiver/Transmitter)


It is not communication protocol but a physical circuit in microcontroller. Main purpose is to
transmit and receive serial data. (2 wires, one for transmitting and other to receive data)
Transmitting UART converts parallel data from CPU to serial data and transmits it to receiver
UART. Receiver UART converts serial data back to parallel form.

To send a char (8-bits) over UART, the char is enclosed within a start and a stop bit, so to
send 8-bits of char data, it would require 2-bit overhead. This 10-bit of information is called a
UART frame.
Advantages of UART :
 High speed not required
 Cheap communication
 Single wire for each direction
 2 UARTs communicate directly with each other

SPI (Serial Peripheral Interface)


An interface bus commonly used to send data between microcontrollers and small peripherals
such as shift registers, sensors, and SD cards.
Developed by Motorola to provide full-duplex synchronous serial communication.
It uses separate clock and data lines, along with a select line to choose the device you wish to
talk to.
It is a master – slave type protocol

I2C (Inter-Integrated Circuit)


Combines the useful features of both UART and SPI.
With I2C, you can connect multiple slaves to a single master (like SPI) and you can have
multiple masters controlling single, or multiple slaves.
This is really useful when more than one microcontroller logging data to a single memory
card or displaying text to a single LCD.

CAN (Controller Area Network)


It allows microcontroller and devices to communicate without a host computer.
It is a two wired half duplex high speed serial network technology.
IoT protocols
Link Layer - Determines how data is physically sent overthe network’s physical layer.
Eg) IEEE 802.3 (Ethernet-coaxial cable), IEEE 802.3i (Ethernet-twisted pair), IEEE 802.11
(WLAN), IEEE 802.16 (WifiMax)
Network Layer - Responsible for sending datagrams from “Source N/W to Destination
N/W” and performs host addressing and packet routing
Eg) IPv4 (32 bit) or IPv6 (128 bit)
Transport Layer - Provides end-to-end message transfer capability independent of
underlying N/W
Eg) TCP (Transmission control protocol) and UDP (User datagram protocol)
Application Layer - defines how app interface with lower layer protocols. Port numbers are
used for app addressing.
Eg) port 80 for HTTP, port 22 for SSH
MQTT (Message Queue Telemetry Transport) , CoAP, XAMP, Web sockets, DDS, AMQP
XAMP (Extensible Message and Presence Protocol)
Open XML technology for real time communication such as instant messaging, multi-party
chat, voice and video calls
Has a presence indicator that tells server that you are online/offline/busy

DDS(Data distribution service)


M2M communication. Uses publish subscribe model with brokerless architecture

AMQP (Advanced Message Queuing Protocol)


Supports both Point-to-Point Model and Publish-Subscribe Model. Either Broker will
distribute the messages or consumers pull the messages

Logical design of IoT


Abstract representation of the entities and processes without going into low level
specifications of the implementations.
Consists of 3 things :
 IoT Functional Blocks
 IoT Communication Models
 IoT Communication API

IoT Functional Blocks

IoT Communication Model


(1) Request Response model
(2) Publish-Subscribe model

(3) Push-Pull model

(4) Exclusive pair


IoT Communication APIs
There are 2 types of APIs : REST-based and WebSocket-based

REST-based Communication APIs


REST stands for REpresentational STate Transfer
WebSocket-based Communication APIs
IoT enabling technologies

(1) Wireless Sensor Network


Distributed Devices with sensors used to monitor the environmental and physical conditions.
Each node can have several sensors attached to it. Each node can also acts as a routers
Coordinator collects data from all nodes. Coordinator acts as gateway that connects WSN to
the internet.
Examples of WSNs :
Weather monitoring system, soil moisture monitoring system.
Protocols used :
wireless communication protocols such as IEEE802.15.4.
Zigbee is one of the most popular wireless technology used by WSNs and is based on
IEEE802.15.4.
Data rate: up to 250KBps. Range: upto 100 Meters

(2) Cloud Computing


Deliver applications and services over internet and provides computing, networking and
storage resources on demand.
Types of Cloud Computing services :
IaaS(Infrastructure as a Service) - Clients can use storage to install and manage operating
systems and any desired applications.( i.e Virtual machines + virtual storage)
Ex: Web Hosting.

PaaS(Platform as a Service) - Clients can install, build and modify or control applications.
Here, runtime, middleware, OS is provided by cloud.
Ex: Google App Engine
SaaS(Software as a Service) - Clients can access and use software at remote location using a
web browser.
Ex: Google documents
Advantages of cloud computing :
 Effectively infinite size, so no worry about running out of capacity
 Can access cloud-based applications from anywhere (device and platform
independent)
 Automated backup and maintenance
 Elastic, pay as you go – scale up or down policy

(3) Big data Analytics


Big Data - Collection of data whose volume, velocity or variety is too large and difficult to
store, manage, process and analyze the data using traditional databases.
3 Vs of Big Data :
1. Variety includes different types of data - structured, unstructured, semi-structured
2. Volume refers to amount of data - terabyte, records, transactions, tables
3. Velocity refers to speed at which data is processed - batch processing, real-time
processing, stream processing
Big Data Analytics involves :
1. Data cleansing – correcting, removing, replacing
2. Data munging (data wrangling) – convert from one form to another
3. Data processing
4. Data visualization
Example of Big data : Web data, E-commerce data, Social Network, Bank transactions

(4) Communication Protocols

(5) Embedded Systems


A microcontroller-based, software-driven, reliable, real- time control system, designed to
perform a specific task. It can be thought of as a computer hardware system having software
embedded in it.
Key components of embedded systems :
 Microprocessor or micro controller
 Memory (RAM, ROM ect.)
 Storage (Flash Memory)
 Networking units(Ethernet, Wifi adaptors)
 I/O units (Keyboard, display)
 Graphics processor … not so common
Embedded systems are found in industrial robots, set top boxes, photocopiers, microwave
ovens
IoT Levels and Deployment Templates
An IoT system comprises the following components:
Device, Resource, Controller Service, Database, Web service, Analysis Component and
Application.
 Device – allows identification, remote sensing and monitoring
 Resource – software components for IoT device
 Controller service – runs on device and interacts with web service. Sends data from
device to web service and receives commands from application (via web service)
 Database – can be local or cloud based
 Web service – link between IoT device, application, database and analysis
components. Can be implemented using HTTP and REST or WebSocket protocol
 Analysis component – analyze data
 Application – interface that users can use

IoT level-1
Single node/device that performs sensing, actuation, stores data, performs analysis and hosts
application.
Suitable for low-complexity and low-cost systems where data is not big
Eg) Home automation like smoke detector, lighting control

IoT level-2
Single node/device that performs sensing, actuation.
Data is stored in cloud and application is cloud-based
Suitable for systems where data involved is big, but data analysis is not computationally
intensive.
Eg) Smart irrigation

IoT level-3

Single node/device that performs sensing, actuation.


Data is stored in cloud and application is cloud-based
Suitable for systems where data involved is big and data analysis is computationally
intensive.
Eg) Delivery package tracking system (accelerometer senses movement/vibration, gyroscope
gives orientation info)
Web socket is used to send sensor data real time

IoT level-4
Multiple nodes/devices perform sensing, actuation
Data is stored in cloud and application is cloud-based
Contains local and cloud-based observer nodes which can subscribe and receive information
collected in the cloud from IoT devices.
Suitable for systems where multiple nodes are required, data is big and data analysis is
intensive
Eg) Noise monitoring (using sound sensors)

IoT level-5
Multiple end nodes and one coordinator node. End nodes perform sensing and actuation.
Coordinator node collects data from end nodes and sends it to cloud.
Data is stored in cloud and application is cloud-based.
Suitable for systems based on wireless sensor networks, data is big and analysis is intensive.
Eg) Forest fire detection

IoT level-6
Multiple end nodes. End nodes perform sensing and actuation.
Centralized controller is aware of status of all end nodes and sends control commands to end
nodes.
Data is stored in cloud and application is cloud-based.
Eg) Weather monitoring system (wind speed, temperature, humidity, pressure sensors)

IoT issues and challenges


 Security – Cyber attacks, data theft
 Privacy – controlling access and ownership of data
 InterOperability – integration inflexibility
 Legality and rights – data protection laws to be followed
 Economy and development – investment incentives, technical skill requirement
IoT and M2M
M2M – Machine-to-Machine refers to networking of machines for purpose of remote
monitoring and control and data exchange.

M2M area network – consists of machines which have embedded hardware for sensing,
actuation and communication
 Communication protocols include ZigBee, Bluetooth, 6LoWPAN, IEEE 802.15.4
 Provides connectivity between nodes within area network
 Non-IP based communication
 Cannot communicate with nodes of external network
 For communication with external network, M2M gateway are used

M2M communication network


Provides connectivity to remote M2M area network
Either wired or wireless, IP based communication

M2M gateway
M2M area networks use non-IP based protocols, hence M2M gateway is required to send data
from one network to another
Acts as a proxy providing translations from/to native protocols to/from Internet protocol(IP)
Within M2M gateway, each node in M2M area network appears as virtual node
IoT v/s M2M

NOTE : Communication within M2M area networks is based on protocols below the network
layer whereas IoT is based on protocols above the network layer.
Microcontroller - A microcontroller is a compact computer on a single integrated circuit
(chip) that is designed to control specific functions in embedded systems.

RP2040 Microcontroller

32-bit dual ARM Cortex-M0+ microcontroller integrated circuit.


The chip is 40nm in 7x7 mm QFN-56 package.
RAM – 264KB, External memory support - up to 16MB

CYW43439 WiFi+BLE Chip


Single-chip combo device featuring 1×1 single-band 2.4 GHz Wi-Fi 4 (802.11n) and
Bluetooth 5.2

Raspberry Pi Pico W
A low-cost Arm-based microcontroller based on RP2040 Microcontroller & CYW43439
WiFi+BLE Chip.
Raspberry Pi Pico W can be programed using C/C++ and MicroPython.
Raspberry Pi Pico W pairs RP2040 with 2MB of flash memory, and a power supply chip
supporting input voltages from 1.8–5.5V. It provides 26 GPIO pins, three of which can
function as analog inputs.
The CYW43439 wireless chip is connected via SPI to the RP2040, which supports both
802.11 wireless and Bluetooth.
Features of Raspberry Pi Pico W board :
 21 mm × 51 mm form factor
 RP2040 microcontroller chip and Dual-core Arm Cortex-M0+ processor
 264 KB on-chip SRAM and 2MB on-board flash memory
 2.4 GHz 802.11n wireless LAN and Bluetooth 5.2
 26 multifunction GPIO pins, including 3 analog inputs
 Micro USB B port for power and data
 2 × programmable I/O (PIO) blocks, 8 state machines in total
 2 × UART, 2 × SPI controllers, 2 × I2C controllers, 16 × PWM channels
 Supported input power 1.8–5.5V DC
 Operating temperature -20°C to +70°C
 Low-power sleep and dormant modes and accurate on-chip clock
 Temperature sensor

There are total 40 pins on Raspberry Pi Pico W


 General-purpose input/output pins.
Total 26 pins GP0-GP22 and GP26-GP28

 GND: This is a 0 volts ground. Several GND pins present to make wiring easier
Total 8 GND pins (including 1 AGND pind)

 RUN: It enables or disables Pico connection with other microcontroller.

 GPxx_ADCx: It can be used as an analog input as well as a digital input or output –


but not both at the same time. (GP26, GP27, GP28 i.e pin 31, 32, 34)

 ADC_VREF: Analog-to-digital converter (ADC) voltage reference. (Pin 35)

 AGND: Analog-to-digital converter (ADC) 0 volts ground. (Pin 33)


 3V3(O): 3.3 volts power.

 3v3(E): Enables or disables the power.

 VSYS: 2-5 volts power.

 VBUS: 5 volts power. Used to power hardware which needs more than 3.3 V.

Raspberry Pi Pico W using MicroPython programming

Onboard LED blinking program :

Scanning WiFi Access Points : The WiFi chip will scan all the available network and shows
the list of all the network in Shell window.

Connect to WiFi network :


DHT11 humidity-temperature sensor
It uses a capacitive humidity sensor and thermistor to measure the surrounding air and
outputs a digital signal on the data pins.
Includes resistive sense of wet component and an NTC temperature measurement device and
is connected with 8-bit microcontroller.
Features of DHT11
 Humidity measurement range: 20 - 90%RH (RH- Relative humidity)
 Humidity measurement accuracy: ±5%RH
 Temperature measurement range: 0 - 50°C
 Temperature measurement accuracy: ±2°C
 Output digital signals indicating temperature and humidity
 Working voltage: 3- 5.5V DC; PCB size: 2.0 x 2.0 cm
DATA line sends start signal to DHT11, which in turn returns answer signal.
Answer signal is 40-bit data (8-bit humidity integer + 8-bit humidity decimal + 8-bit
temperature integer + 8-bit temperature decimal + 8-bit checksum)

Pin diagram of DHT11

Temperature and Humidity measurement using DHT11 with Raspberry Pi Pico W


PIR Motion sensor
Often referred to as PIR, "Passive Infrared", "Pyroelectric", or "IR motion" sensors.
Used to detect whether a human has moved in or out of the sensors range.
Working of PIR :
Basically made up of pyroelectric sensor, which can detect levels of infrared radiations.
Everything emits low-level radiation, and hotter something is, the more radiation is emitted.
The sensor in a motion detector is actually split in two slots which are sensitive to IR.
When the sensor is idle, both slots detect the same amount of IR, the ambient amount radiated
from the room or walls or outdoors. When a warm body like a human or animal passes by, it
first intercepts one half of the PIR sensor, which causes a positive differential change
between the two halves. When the warm body leaves the sensing area, the reverse happens,
whereby the sensor generates a negative differential change. These change pulses are what is
detected.
HC-SR501 PIR sensor (usage : alerts in cctv camera)

Has a 3-pin connector :


 VCC – input from 4.5 to 20 V DC.
 OUTPUT – This is a 3.3-V logic output. LOW indicates no detection; HIGH means
someone has been detected.
 GND – This is the Ground connection.
Sensitivity – 3 to 7 meters
Time – how long will o/p remain high. Range [3s, 300s]

HC-SR04 Ultrasonic Distance Sensor (usage : robots navigating in a room)


sensor is capable of measuring the distance between itself and the nearest solid object.
Looks like a pair of Wall-E Robot eyes.
This ultrasonic distance sensor is capable of measuring distances between 2 cm to 500 cm
with a resolution of 0.3 cm
2 main components : UT and UR
UT – ultrasonic transmitter to transmit ultrasonic sound pulses
UR – ultrasonic receiver receives pulses, whose width is used to determine distance
Working of HC-SR04 :
1. A 5 volt pulse of at least 10 us is applied to the Trigger pin.
2. The HC-SR04 responds by transmitting a burst of eight pulses at 40 KHz. This 8-
pulse pattern makes the “ultrasonic signature” from the device unique, allowing the
receiver to discriminate between the transmitted pattern and the ultrasonic background
noise.
3. Echo pin goes high, forming the beginning of the echo-back signal.
4. If the pulse in NOT reflected back then the Echo signal will timeout after 38 ms,
indicating no obstruction.
5. If the pulse is reflected back the Echo pin goes low. This produces a pulse whose
width varies between 150 us to 25 ms
6. The width of the received pulse is used to calculate the distance to the reflected
object.
distance=(1/2)*(pulse_width)

You might also like