Unit - 3 Iot and Applications

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

IOT APPLICATION DEVELOPMENT

Sensors in Internet of Things(IoT)


Generally, sensors are used in the architecture of IOT devices. Sensors are used for sensing things and
devices etc. A device that provides a usable output in response to a specified measurement. The sensor attains a
physical parameter and converts it into a signal suitable for processing (e.g. electrical, mechanical, optical) the
characteristics of any device or material to detect the presence of a particular physical quantity. The output of the
sensor is a signal which is converted to a human-readable form like changes in characteristics, changes in resistance,
capacitance, impedance etc.

IOT HARDWARE

Transducer :
 A transducer converts a signal from one physical structure to another.
 It converts one type of energy into another type.
 It might be used as actuators in various systems.
Sensors characteristics :
1. Static
2. Dynamic
1. Static characteristics :
It is about how the output of a sensor changes in response to an input change after steady state condition.
 Accuracy –
Accuracy is the capability of measuring instruments to give a result close to the true value of the measured
quantity. It measures errors. It is measured by absolute and relative errors. Express the correctness of the output
compared to a higher prior system. Absolute error = Measured value – True value
Relative error = Measured value/True value
 Range –
Gives the highest and the lowest value of the physical quantity within which the sensor can actually sense. Beyond
these values, there is no sense or no kind of response.
e.g. RTD for measurement of temperature has a range of -200`c to 800`c.
 Resolution –
Resolution is an important specification towards selection of sensors. The higher the resolution, better the precision.
When the accretion is zero to, it is called threshold.
Provide the smallest changes in the input that a sensor is able to sense.
 Precision –It is the capacity of a measuring instrument to give the same reading when repetitively measuring the
same quantity under the same prescribed conditions. It implies agreement between successive readings, NOT
closeness to the true value. It is related to the variance of a set of measurements. It is a necessary but not sufficient
condition for accuracy.
 Sensitivity –Sensitivity indicates the ratio of incremental change in the response of the system with respect to
incremental change in input parameters. It can be found from the slope of the output characteristics curve of a
sensor. It is the smallest amount of difference in quantity that will change the instrument’s reading.
 Linearity –The deviation of the sensor value curve from a particular straight line. Linearity is determined by the
calibration curve. The static calibration curve plots the output amplitude versus the input amplitude under static
conditions. A curve’s slope resemblance to a straight line describes the linearity.
 Drift –The difference in the measurement of the sensor from a specific reading when kept at that value for a long
period of time.
 Repeatability –The deviation between measurements in a sequence under the same conditions. The measurements
have to be made under a short enough time duration so as not to allow significant long-term drift.

Dynamic Characteristics: Properties of the systems


 Zero-order system – The output shows a response to the input signal with no delay. It does not include energy-
storing elements. Ex. potentiometer measure, linear and rotary displacements.
 First-order system – When the output approaches its final value gradually. Consists of an energy storage and
dissipation element.
 Second-order system – Complex output response. The output response of the sensor oscillates before steady state.
Sensor Classification:
 Passive & Active
 Analog & digital
 Scalar & vector
1. Passive Sensor – Can not independently sense the input. Ex- Accelerometer, soil moisture, water level and
temperature sensors.
2. Active Sensor – Independently sense the input. Example- Radar, sounder and laser altimeter sensors.
3. Analog Sensor – The response or output of the sensor is some continuous function of its input parameter. Ex-
Temperature sensor, LDR, analog pressure sensor and analog hall effect.
4. Digital sensor – Response in binary nature. Design to overcome the disadvantages of analog sensors. Along with
the analog sensor, it also comprises extra electronics for bit conversion. Example – Passive infrared (PIR) sensor
and digital temperature sensor(DS1620).
5. Scalar sensor – Detects the input parameter only based on its magnitude. The answer for the sensor is a function
of magnitude of some input parameter. Not affected by the direction of input parameters. Example – temperature,
gas, strain, color and smoke sensor.
6. Vector sensor – The response of the sensor depends on the magnitude of the direction and orientation of input
parameter. Example – Accelerometer, gyroscope, magnetic field and motion detector sensors.

Actuators in IoT
An IoT device is made up of a Physical object (“thing”) + Controller (“brain”) + Sensors + Actuators + Networks
(Internet). An actuator is a machine component or system that moves or controls the mechanism or the system.
Sensors in the device sense the environment, then control signals are generated for the actuators according to the
actions needed to perform. A servo motor is an example of an actuator. They are linear or rotatory actuators, can
move to a given specified angular or linear position. We can use servo motors for IoT applications and make the
motor rotate to 90 degrees, 180 degrees, etc., as per our need. The following diagram shows what actuators do, the
controller directs the actuator based on the sensor data to do the work.

Working of IoT devices and use of Actuators


The control system acts upon an environment through the actuator. It requires a source of energy and a control signal.
When it receives a control signal, it converts the source of energy to a mechanical operation. On this basis, on which
form of energy it uses, it has different types given below.
Types of Actuators :

1. Hydraulic Actuators – A hydraulic actuator uses hydraulic power to perform a mechanical operation. They are
actuated by a cylinder or fluid motor. The mechanical motion is converted to rotary, linear, or oscillatory motion,
according to the need of the IoT device. Ex- construction equipment uses hydraulic actuators because hydraulic
actuators can generate a large amount of force.
Advantages :
 Hydraulic actuators can produce a large magnitude of force and high speed.
 Used in welding, clamping, etc.
 Used for lowering or raising the vehicles in car transport carriers.
Disadvantages :
 Hydraulic fluid leaks can cause efficiency loss and issues of cleaning.
 It is expensive.
 It requires noise reduction equipment, heat exchangers, and high maintenance systems.
2. Pneumatic Actuators – A pneumatic actuator uses energy formed by vacuum or compressed air at high pressure
to convert into either linear or rotary motion. Example- Used in robotics, use sensors that work like human fingers
by using compressed air.
Advantages :
 They are a low-cost option and are used at extreme temperatures where using air is a safer option than chemicals.
 They need low maintenance, are durable, and have a long operational life.
 It is very quick in starting and stopping the motion.
Disadvantages :
 Loss of pressure can make it less efficient.
 The air compressor should be running continuously.
 Air can be polluted, and it needs maintenance.
3. Electrical Actuators – An electric actuator uses electrical energy, is usually actuated by a motor that converts
electrical energy into mechanical torque. An example of an electric actuator is a solenoid based electric bell.
Advantages :
 It has many applications in various industries as it can automate industrial valves.
 It produces less noise and is safe to use since there are no fluid leakages.
 It can be re-programmed and it provides the highest control precision positioning.
Disadvantages :
 It is expensive.
 It depends a lot on environmental conditions.
Other actuators are –
 Thermal/Magnetic Actuators – These are actuated by thermal or mechanical energy. Shape Memory Alloys
(SMAs) or Magnetic Shape‐Memory Alloys (MSMAs) are used by these actuators. An example of a
thermal/magnetic actuator can be a piezo motor using SMA.
 Mechanical Actuators – A mechanical actuator executes movement by converting rotary motion into linear
motion. It involves pulleys, chains, gears, rails, and other devices to operate. Example – A crankshaft.
 Soft Actuators
 Shape Memory Polymers
 Light Activated Polymers
 With the expanding world of IoT, sensors and actuators will find more usage in commercial and domestic
applications along with the pre-existing use in industry.
I/O Interfaces
A parallel interface refers to a multi line channel with each line capable of transmitting several bits of data
simultaneously. They usually require buses of data — transmitting across eight, sixteen, or more wires. Data is
transferred in huge, crashing waves of 1’s and 0’s. Serial interfaces stream their data, one single bit at a time. These
interfaces can operate on as little as one wire, usually never more than four. Serial interfaces have certain advantages
over parallel interfaces. The most significant advantage is simpler wiring. In addition, serial interface cables can be
longer than parallel interface cables, because there is much less interaction (crosstalk) among the conductors in the
cable. Most hardware interfaces are serial interfaces sacrificing potential speed in parallel. Serial interfaces generally
use multiple wires to control the flow and timing of binary information along the primary data wire. Each type of
hardware interface defines a method of communicating between a peripheral and the central processor. IoT hardware
platforms use a number of common interfaces. Sensor and actuator modules can support one or more of these interfaces:

 USB. Universal Serial Bus is a technology that allows a person to connect an electronic device to a microcontroller.
It is a fast serial bus.

 GPIO. General-purpose input/output pins area generic pin on an integrated circuit or computer board whose
behavior — including whether it is an input or output pin — is controllable by the user at run time. GPIO pins have
no predefined purpose, and go unused by default. GPIO pins can be designed to carry digital or analog signals, and
digital pins have only two states: HIGH or LOW.

 Digital GPIO can support Pulse Width Modulation (PWM). PWM lets you very quickly switch a power source on
and off, with each “on” phase being a pulse of a particular duration, or width. The effect in the device can be a lower
or higher power level. For example, you can use PWM to change the brightness of an LED; the wider the “on”
pulses, the brighter the LED glows.

 Analog pins might have access to an on-board analog-to-digital conversion (ADC) circuit. An ADC periodically
samples a continuous, analog waveform, such as an analog audio signal, giving each sample a digital value between
zero and one, relative to the system voltage.

 When you read the value of a digital I/O pin in code, the value can must be either HIGH or LOW, where an analog
input pin at any given moment could be any value in a range. The range depends on the resolution of the ADC. For
example an 8-bit ADC can produce digital values from 0 to 255, while a 10-bit ADC can yield a wider range of
values, from 0 to 1024. More values means higher resolution and thus a more faithful digital representation of any
given analog signal.

 The ADC sampling rate determines the frequency range that an ADC can reproduce. A higher sampling rate results
in a higher maximum frequency in the digital data. For example, an audio signal sampled at 44,100 Hz produces a
digital audio file with a frequency response up to 22.5 kHz, ignoring typical filtering and other processing. The bit
precision dictates the resolution of the amplitude of the signal.

 I2C. Inter-Integrated Circuit serial bus uses a protocol that enables multiple modules to be assigned a discrete address
on the bus. I2C is sometimes pronounced “I two C”, “I-I-C”, or “I squared C”. I has two wires, a clock and data
wire.

 SPI. Serial Peripheral Interface/Interchange Bus devices employ a master-slave architecture, with a single master
and full-duplex communication.

 UART. Universal Asynchronous Receiver/Transmitter devices translate data between serial and parallel forms at
the point where the data is acted on by the processor. UART is required when serial data must be laid out in memory
in a parallel fashion.

 RS 232 Recommended Standard 232 is used for obtaining communication between the computer and circuit such to
transfer data between circuit and computer.

Software components in IOT


IoT software addresses its key areas of networking and action through platforms, embedded systems, partner
systems, and middleware. These individual and master applications are responsible for data collection, device
integration, real-time analytics, and application and process extension within the IoT network. They exploit
integration with critical business systems (e.g., ordering systems, robotics, scheduling, and more) in the execution of
related tasks.

Data Collection
This software manages sensing, measurements, light data filtering, light data security, and aggregation of
data. It uses certain protocols to aid sensors in connecting with real-time, machine-to-machine networks. Then it
collects data from multiple devices and distributes it in accordance with settings. It also works in reverse by
distributing data over devices. The system eventually transmits all collected data to a central server.

Device Integration
Software supporting integration binds (dependent relationships) all system devices to create the body of the
IoT system. It ensures the necessary cooperation and stable networking between devices. These applications are the
defining software technology of the IoT network because without them, it is not an IoT system. They manage the
various applications, protocols, and limitations of each device to allow communication.

Real-Time Analytics
These applications take data or input from various devices and convert it into viable actions or clear patterns
for human analysis. They analyze information based on various settings and designs in order to perform automation-
related tasks or provide the data required by industry.

Application and Process Extension


These applications extend the reach of existing systems and software to allow a wider, more effective system.
They integrate predefined devices for specific purposes such as allowing certain mobile devices or engineering
instruments access. It supports improved productivity and more accurate data collection.

IOT Communication protocols


Several Communication Protocols and Technology used in the internet of Things. Some of the major IoT
technology and protocol (IoT Communication Protocols) are Bluetooth, Wifi, Radio Protocols, LTE-A, and WiFi-
Direct. These IoT communication protocols cater to and meet the specific functional requirement of an IoT system.
There are 6 IoT Communication Protocols/ Technology, let us ook each one of them.
a. Bluetooth
An important short-range IoT communications Protocols / Technology. Bluetooth, which has become very
important in computing and many consumer product markets. It is expected to be key for wearable products in
particular, again connecting to the IoT albeit probably via a smartphone in many cases. The new Bluetooth Low-
Energy (BLE) – or Bluetooth Smart, as it is now branded – is a significant protocol for IoT applications.Importantly,
while it offers a similar range to Bluetooth it has been designed to offer significantly reduced power consumption.

Iot Technology – Bluetooth


b. Zigbee
ZigBee is similar to Bluetooth and is majorly used in industrial settings. It has some significant advantages
in complex systems offering low-power operation, high security, robustness and high and is well positioned to take
advantage of wireless control and sensor networks in IoT applications. The latest version of ZigBee is the recently
launched 3.0, which is essentially the unification of the various ZigBee wireless standards into a single standard.

Iot Technology – ZigBee


c. MQTT
MQTT is simple, lightweight messaging protocol used to establish communication between multiple
devices. It is TCP-based protocol relying on the publish-subscribe model. This communication protocol is suitable
for transmitting data between resource-constrained devices having low bandwidth and low power requirements.
Hence this messaging protocol is widely used for communication in IoT Framework.
Publish-Subscribe Model : This model involves multiple clients interacting with each other, without having any
direct connection established between them. All clients communicate with other clients only via third party known
as Broker.
MQTT Client and Broker : Clients publish messages on different topics to broker. The broker is the central server
that receives these messages and filters them based on their topics. It then sends these messages to respective clients
that have subscribed to those different topics.
Hence client that has subscribed to a specific topic receives all messages published on that topic.

Figure – Publish-Subscribe Model


Here the broker is central hub that receives messages, filters them, and distributes them to appropriate clients, such
that both message publishers, as well as subscribers, are clients.
Advantages :
1. Easy Scalability – This model is not restricted to one-to-one communication between clients. Although the
publisher client sends a single message on specific topic, broker sends multiple messages to all different clients
subscribed to that topic. Similarly, messages sent by multiple such publisher clients on multiple different topics
will be sent to all multiple clients subscribed to those topics. Hence one-to-many, many-to-one, as well as many-
to-many communication is possible using this model. Also, clients can publish data and at the same time receive
data due to this two-way communication protocol. Hence MQTT is considered to be bi-directional protocol. The
default unencrypted MQTT port used for data transmission is 1883. The encrypted port for secure transmission is
8883.
2. Eliminates insecure connections – In a complex system where multiple devices are connected with each other,
each device not only has to manage its connections with other devices but also has to ensure that these connections
are secure. But in the publish-subscribe model, the broker becomes central server managing all security aspects.
It is responsible for the authentication and authorization of all connected clients.
3. Lightweight Communication – Data transmission is quick, efficient, and lightweight because MQTT messages
have small code footprint. These control messages have a fixed header of size 2 bytes and payload message up to
size 256 megabytes.

User Datagram Protocol (UDP)


User Datagram Protocol (UDP) is a Transport Layer protocol. UDP is a part of the Internet Protocol suite,
referred to as UDP/IP suite. Unlike TCP, it is an unreliable and connectionless protocol. So, there is no need to
establish a connection prior to data transfer. Though Transmission Control Protocol (TCP) is the dominant transport
layer protocol used with most of the Internet services; provides assured delivery, reliability, and much more but all
these services cost us additional overhead and latency. Here, UDP comes into the picture. For real-time services like
computer gaming, voice or video communication, live conferences; we need UDP. Since high performance is needed,
UDP permits packets to be dropped instead of processing delayed packets. There is no error checking in UDP, so it
also saves bandwidth. User Datagram Protocol (UDP) is more efficient in terms of both latency and bandwidth.
UDP Header – UDP header is an 8-bytes fixed and simple header, while for TCP it may vary from 20 bytes to 60
bytes. The first 8 Bytes contains all necessary header information and the remaining part consist of data. UDP port
number fields are each 16 bits long, therefore the range for port numbers is defined from 0 to 65535; port number 0
is reserved. Port numbers help to distinguish different user requests or processes.

1. Source Port: Source Port is a 2 Byte long field used to identify the port number of the source.
2. Destination Port: It is a 2 Byte long field, used to identify the port of the destined packet.
3. Length: Length is the length of UDP including the header and the data. It is a 16-bits field.
4. Checksum: Checksum is 2 Bytes long field. It is the 16-bit one’s complement of the one’s complement sum of
the UDP header, the pseudo-header of information from the IP header, and the data, padded with zero octets at
the end (if necessary) to make a multiple of two octets.
Notes – Unlike TCP, the Checksum calculation is not mandatory in UDP. No Error control or flow control is
provided by UDP. Hence UDP depends on IP and ICMP for error reporting.
Applications of UDP:
 Used for simple request-response communication when the size of data is less and hence there is lesser concern
about flow and error control.
 It is a suitable protocol for multicasting as UDP supports packet switching.
 UDP is used for some routing update protocols like RIP(Routing Information Protocol).
 Normally used for real-time applications which can not tolerate uneven delays between sections of a received
message.
 Following implementations uses UDP as a transport layer protocol:
 NTP (Network Time Protocol)
 DNS (Domain Name Service)
 BOOTP, DHCP.
 NNP (Network News Protocol)
 Quote of the day protocol
 TFTP, RTSP, RIP.
 The application layer can do some of the tasks through UDP-
 Trace Route
 Record Route
 Timestamp
 UDP takes a datagram from Network Layer, attaches its header, and sends it to the user. So, it works fast.
 Actually, UDP is a null protocol if you remove the checksum field.
1. Reduce the requirement of computer resources.
2. When using the Multicast or Broadcast to transfer.
3. The transmission of Real-time packets, mainly in multimedia applications.

TCP (Transmission Control Protocol)


TCP (Transmission Control Protocol) is one of the main protocols of the Internet protocol suite. It lies
between the Application and Network Layers which are used in providing reliable delivery services. It is a
connection-oriented protocol for communications that helps in the exchange of messages between the different
devices over a network.

Working of TCP

To make sure that each message reaches its target location intact, the TCP/IP model breaks down the data
into small bundles and afterward reassembles the bundles into the original message on the opposite end. Sending the
information in little bundles of information makes it simpler to maintain efficiency as opposed to sending everything
in one go. After a particular message is broken down into bundles, these bundles may travel along multiple routes if
one route is jammed but the destination remains the same.

We can see that the message is being broken down, then reassembled from a different order at the destination For
example, When a user requests a web page on the internet, somewhere in the world, the server processes that request
and sends back an HTML Page to that user. The server makes use of a protocol called the HTTP Protocol. The HTTP
then requests the TCP layer to set the required connection and send the HTML file. Now, the TCP breaks the data
into small packets and forwards it towards the Internet Protocol (IP) layer. The packets are then sent to the destination
through different routes. The TCP layer in the user’s system waits for the transmission to get finished and
acknowledges once all packets have been received.

Features of TCP/IP

Some of the most prominent features of Transmission control protocol are


1. Segment Numbering System
 TCP keeps track of the segments being transmitted or being received by assigning numbers to each and every
single one of them.
 A specific Byte Number is assigned to data bytes that are to be transferred while segments are assigned sequence
numbers.
 Acknowledgment Numbers are assigned to received segments.
2. Flow Control
 Flow control limits the rate at which a sender transfers data. This is done to ensure reliable delivery.
 The receiver continually hints the sender on how much data can be received (using a sliding window)
3. Error Control
 TCP implements an error control mechanism for reliable data transfer
 Error control is byte-oriented
 Segments are checked for error detection
 Error Control includes – Corrupted Segment & Lost Segment Management, Out-of-order segments, Duplicate
segments, etc.
4. Congestion Control
 TCP takes into account the level of congestion in the network
 Congestion level is determined by the amount of data sent by a sender
Advantages
 It is a reliable protocol
 It provides an error-checking mechanism as well as one for recovery
 It gives flow control
 It makes sure that the data reaches the proper destination in the exact order that it was sent
 Open Protocol, not owned by any organization or individual
 It assigns an IP address to each computer on the network and a domain name to each site thus making each
device site to be distinguishable over the network.
Disadvantages
 TCP is made for Wide Area Networks, thus its size can become an issue for small networks with low resources
 TCP runs several layers so it can slow down the speed of the network
 It is not generic in nature. Meaning, it cannot represent any protocol stack other than the TCP/IP suite. E.g., it
cannot work with a Bluetooth connection.
 No modifications since their development around 30 years ago.

CoAP Protocol (Constrained Application Protocol)


CoAP Protocol (Constrained Application Protocol) is a web-based protocol that has been specifically
designed to connect small, semi-intelligent devices to the Internet of Things (IoT). CoAP Protocol works with
constrained nodes and constrained networks, to facilitate the compartmentalized deployment of machine-to-machine
(M2M) solutions comprising of a multitude of network-enabled devices. Or to put things a little more simply; CoAP
Protocol facilitates the rapid networking of hundreds of IoT-enabled devices, to build a single networked application,
such as could be used for automated manufacturing lines, or a smart building.
CoAP Protocol Basic Features
The most defining feature of CoAP Protocol is the fact that it leverages the tried and tested REST model.
These enable developers to make API style calls to GET, PUT, POST and DELETE data via a URL. This makes
CoAP very easy to develop for. The real power unlocked by implementing the full REST model is that CoAP enabled
devices can be integrated into to existing applications very simply. Existing applications that use the REST model can
already accept input from CoAP capable devices with little or no modification. CoAP also interfaces with many
common date delivery models including CBOR, XML, and JSON. Again, this makes the development of applications
that support CoAP enabled devices very easy.
The Benefits of the CoAP Protocol
CoAP is incredibly lightweight. It has been developed to RFC 7252 standards. This means it can be run on
devices with very limited resources. As low as 10k of memory and 100k of application space is all that a device needs
to run CoAP. Alongside this small resource footprint comes a comprehensive security suite. CoAP can use both TCP
and UDP to communication across a network. Inbuilt into the network stack of CoAP is full 30172 bit RSA encryption.
Due to the fact that CoAP Protocol uses so many tried and tested technologies such as REST, mature data
connectors and industry standard encryption, spin up time for new developers is very low. Any developer that has
worked on a web based application using these technologies in the past, will be able to get up to speed with CoAP
rapidly. In effect, the fact that the developer is dealing with IoT connected devices becomes almost transparent.
Where Can CoAP Protocol Be Used?
Due to the low resource requirements and standardized architecture, CoAP can be used in many ways.
Smartphone development is a good example of this. Regardless of platform, iOS or Google Android, CoAP delivers
a standardized protocol for application developers. CoAP can also be included as a library during application
development. A C implementation of the CoAP protocol is available as libcoap. A more in-depth integration can be
achieved with products such as Erbium, a framework for developing applications based on constrained nodes.
Many other languages also have CoAP libraries available including JavaScript, Python, C#, and Ruby. Most
of these libraries and integrations are published as open source, using the Apache 2.0 or MIT license. In effect, CoAP
makes a perfect go-to protocol for developers who want to incorporate IoT-enabled devices into their applications,
without resorting to buying in a proprietary transport. They simply need to make sure that the devices they choose are
CoAP capable.
Bluetooth Smart Connectivity
Bluetooth Overview
Bluetooth allows personal electronics devices such as smartphones, tablets, and laptops to wirelessly communicate
with each other. It also offers wireless connectivity with peripherals such as keyboards, mice, headphones, and
speakers. Apart from its core purpose of eliminating wires between desktop and portable devices, Bluetooth also
enables file transfers between devices over short distances—preferably in the same room or in closer proximity.

Much of Bluetooth’s success is attributed to it being a cohesive communications standard instead of a


proprietary technology. However, it almost ended up fragmenting into proprietary offerings that would’ve been
eventually forgotten. In the mid ‘90s, Ericsson, Nokia, and Intel were separately working on proprietary wireless
technologies to connect the then-emerging portable devices, such as mobile phones and laptops. Fortunately, they
had the good sense to pool their resources into developing an inter-compatible short-range wireless communication
platform under the Bluetooth banner. The protocol was initially standardised by IEEE (Institute of Electrical and
Electronics Engineers) as the 802.15.1 protocol. That’s the same IEEE that maintains the Wi-Fi standard. While
IEEE bowed out to concentrate on maintaining the Wi-Fi protocol, the task of developing and shepherding the
Bluetooth standard was taken up by the Bluetooth Special Interest Group (SIG). This now includes more than
35,000 member companies spread across consumer electronics, telecommunication, and networking domains. That
explains why it is almost impossible to find a modern consumer electronics product without Bluetooth connectivity.

How Does Bluetooth Work?


Bluetooth works in a similar manner to Wi-Fi (read more about that here) by converting data into radio frequency
waves in the 2.4GHz spectrum. But unlike Wi-Fi, which has a range of 50 metres indoors and twice as much
outdoors, Bluetooth is more concerned with keeping transmission power low to conserve battery life and avoid
radio interference with neighbouring devices. That’s primarily because it operates on the principle of creating a
personal area network (PAN), otherwise also known as the piconet.

A typical consumer-grade Bluetooth device has a minimum range of 10 metres, with the total transmission power
rated under 2.5 milliwatts. This allows tiny peripherals such as wireless earbuds and mice to operate wirelessly
without draining their limited battery reserves. The simple ad hoc (peer-to-peer) nature of a Bluetooth connection
also reduces the electronic complexity and therefore the cost of implementing it, which makes it perfect for
connecting devices to inexpensive peripherals such as headsets and input devices. Although the widely found Class
2 Bluetooth devices operate at a range of 10 metres and up, Class 3 Bluetooth radios are restricted to a maximum
range of a single metre for mostly wearable applications. However, such Class 3 devices are extremely rare at the
moment. Interestingly, while the Bluetooth specification mandates a range of 10 metres and up for Class 2 devices,
the Class 1 Bluetooth equipment used in industrial applications can be paired with high powered radios to extend
well beyond the 100-metre range.

Bluetooth vs W-Fi: What Separates the Two?


At a glance, you may wonder what’s the need for two separate wireless standards pertaining to networking
mobile devices and peripherals. However, both Wi-Fi and Bluetooth have fairly delineated use cases that justify
their coexistence in the consumer electronics space. The essential difference between Bluetooth and Wi-Fi is down
to the wireless communication range, power consumption, and network topology.

Bluetooth Wi-Fi
Carrier Frequency 2.4GHz 2.4GHz, 5GHz, 6GHz
Specifications Authority Bluetooth SIG IEEE
Network Topology Point-to-Point, Mesh, Broadcast Hub, Mesh
Maximum Bandwidth 3Mbps 9.8Gbps
Typical Range 1-30 meters 46-92 meters
Typical Latency 3-200ms 150ms
Cost of Implementation Low High
Ease of Use Simple Complicated

The Bluetooth protocol was primarily designed with the ad hoc or peer-to-peer network topology in mind.
This made sense since it was designed to connect computers and mobile devices with one another and with wireless
peripherals. It is also engineered to work with a reduced wireless connectivity range and therefore significantly
lower power consumption. This works well owing to the portable nature of devices supporting the Bluetooth
protocol and their proximity to the host machines. Wi-Fi, on the other hand, employs a hub network topology to
create a wireless local area network conducive to homes and small offices. This explains its heavy focus on higher
data transfer speeds and significantly longer range, not to mention the hardware complexity associated with running
a larger network with a far larger number of connected devices. Having said that, both Bluetooth and Wi-Fi have
added features that blur the lines between the two wireless communication standards. More recently, Bluetooth 5
and its various revisions have added limited mesh networking capabilities. Meanwhile, Wi-Fi, too, has tried its
hand at peer-to-peer connectivity with Wi-Fi Direct.

Understanding Bluetooth Classic and LE (Low Energy) Radios


Bluetooth devices have been around for more than two decades, but there’s a growing number of Bluetooth-capable
gadgets that are marketed as Smart Bluetooth devices. These devices support the Bluetooth Low Energy (BLE) or
Smart Bluetooth specification.

Bluetooth Low Energy (LE) Bluetooth Classic


2.4GHz ISM Band (2.402 – 2.480 GHz 2.4GHz ISM Band (2.402 – 2.480 GHz
Frequency Band Utilized) Utilized)
40 channels with 2 MHz spacing
(3 advertising channels/37 data
Channels channels) 79 channels with 1 MHz spacing
Frequency-Hopping Spread Spectrum Frequency-Hopping Spread Spectrum
Channel Usage (FHSS) (FHSS)
Modulation GFSK GFSK, π/4 DQPSK, 8DPSK
LE 2M PHY: 2 Mb/s
LE 1M PHY: 1 Mb/s EDR PHY (8DPSK): 3 Mb/s
LE Coded PHY (S=2): 500 Kb/s EDR PHY (π/4 DQPSK): 2 Mb/s
Data Rate LE Coded PHY (S=8): 125 Kb/s BR PHY (GFSK): 1 Mb/s
Tx Power ≤ 100 mW (+20 dBm) ≤ 100 mW (+20 dBm)
LE 2M PHY: ≤-70 dBm
LE 1M PHY: ≤-70 dBm
LE Coded PHY (S=2): ≤-75 dBm
Rx Sensitivity LE Coded PHY (S=8): ≤-82 dBm ≤-70 dBm
Asynchronous Connection-oriented
Isochronous Connection-oriented
Asynchronous Connectionless
Synchronous Connectionless Asynchronous Connection-oriented
Data Transports Isochronous Connectionless Synchronous Connection-oriented
Point-to-Point (including piconet)
Communication Broadcast
Topologies Mesh Point-to-Point (including piconet)
Presence (Advertising)
Proximity (RSSI)
Direction (AoA/AoD)
Positioning Features Distance (Coming) None
.
Different Bluetooth Versions Explained
Bluetooth has evolved over a span of twenty years since the inception of version 1.0 in 1999. Originally built to
replace wires between devices and peripherals, its primary goal was to deliver a high throughput data connection.
However, modern-day electronics have evolved to become much smaller. The focus for such portable devices has
since shifted from pure data throughput to battery conservation.

The Bluetooth standard adapted accordingly by shifting the focus from improving range and data throughput from
version 1.0 through 3.0 to subsequently committing a course correction towards power efficiency with Bluetooth
Low Energy in version 4.0 onwards. Let’s take a closer look at how the wireless communication protocol has
evolved over the years.

1. Bluetooth 1.0 (1999)


Although Bluetooth was formally announced in 1998, the first commercial Bluetooth compatible device didn’t
arrive until 1999. The initial release of Bluetooth, primarily 1.0 and 1.0B, suffered from teething troubles such as
lack of anonymity and product interoperability.

Bluetooth 1.1 fixed some of these glaring issues, but the standard didn’t become viable until the release of Bluetooth
1.2 which improved transmission speeds to 721Kbps with advanced signal processing techniques and faster
connection discovery.

2. Bluetooth 2.0 (2005)


The next major Bluetooth update tackled the important areas of speed, security, and range, while also making the
protocol more user friendly. Bluetooth 2.0 improved the protocol’s digital signal processing techniques further,
which enabled Enhanced Data Rate (EDR) support for data-heavy audio applications. Version 2.0 increased the
total data transfer speeds to 2.1Mbps, whereas Bluetooth 2.1 upped it to 3Mbps. The maximum range was also
increased from 10 metres to 100 metres while allowing multiple simultaneous connections with the PAN.
Meanwhile, Bluetooth 2.1 added features such as Sniff Substrating and an easier pairing process. Sniff Substrating
reduced the active duty cycle of connected devices to delive a five fold improvement in battery life. Meanwhile,
security improvements to the pairing process resisted common eavesdropping attacks.

Version Last Revision Bandwidth Range Release Year


Bluetooth 1.0 Version 1.2 721Kbps 10m 1999
Bluetooth 2.0 Version 2.1 3Mbps 10m 2005
Bluetooth 3.0 Version 3.0 24Mbps 10m 2009
Bluetooth 4.0 Version 4.2 24Mbps 100m 2010
Bluetooth 5.0 Version 5.2 48Mbps 300m 2016
3. Bluetooth 3.0 (2009)
While Bluetooth 2.1 introduced EDR, which took data throughput to 3Mbps, version 3.0’s High-Speed mode
allowed the Bluetooth protocol to piggyback on existing Wi-Fi infrastructure to enable theoretical speeds of up to
24Mbps. Collocating the existing 802.11 infrastructure available on modern devices to speed up Bluetooth devices
sounds great on paper, but it also resulted in a tremendous power draw on connected Bluetooth peripherals. The
consequent drop in battery life was drastic enough for most consumers and device manufacturers to prefer the older
Bluetooth 2.1 EDR standard over the newer and faster 3.0 update.

4. Bluetooth 4.0 (2010)


Bluetooth 4.0 was a total course correction given the unpopularity of the previous iteration’s power consumption.
The Bluetooth SIG, therefore, introduced a new power-efficient Bluetooth Low Energy mode that was then
marketed as Bluetooth Smart. It supported all the features of Bluetooth Classic with the ability to run on devices
powered by coin cells. This was followed by Bluetooth 4.1, which was designed to work with LTE mobile networks
of the time. However, the real potential of BLE was unlocked by the release of Bluetooth 4.2, which incorporated
support for several features conducive to Internet of Things (IoT). This included several security enhancements and
IoT-focused connectivity and handshake features to play well with the smart things boom prevalent at the time.

5. Bluetooth 5.0 (2016)

Marketed as Bluetooth 5, the current-gen iteration of the wireless protocol was geared largely around
improving the IoT features introduced by its predecessor. The bulk of the improvements is geared towards
increasing data transfer rates as well as range for BLE devices. Bluetooth 5 makes clever use of the inverse relation
between data transmission speed and range in wireless communication. So instead of limiting BLE to its previous
1Mbps data transfer limit, Bluetooth 5 splits the BLE protocol into 2Mbps, 1 Mbps, 500Kbps, and 125Kbps tiers.
This allows low range BLE devices such as headphones to achieve greater bandwidth, whereas industrial and home
automation sensors that don’t require transmitting large amounts of data can trade speed for an increased range.
This allows low-speed BLE devices to cover as much as 240 meters. However, the coolest addition to Bluetooth 5
was the “Dual Audio” feature that allows a single audio streaming device to broadcast content to two separate
Bluetooth devices, such as wireless headphones as well as speakers at the same time. The feature also all ows two
disparate audio streams to be broadcast to different Bluetooth devices.
In early 2019, Bluetooth 5.1 added a mesh-based model hierarchy. This is a potentially game-changing
upgrade that transforms the very behaviour of Bluetooth networks from simple peer-to-peer affairs to a more
complex topology, where multiple devices can communicate with the host as well as with each other. In a way, this
potentially blurs the lines between Wi-Fi and Bluetooth in terms of core networking architecture.
Bluetooth 5.2 is the latest launched version (with 5.3 in the works) as of this writing. Bluetooth Low
Energy Audio, which was unveiled at CES 2020 remains its most significant contribution, apart from minor quality-
of-life improvements. The new addition standardises audio transmission over BLE Audio, while also reducing
power consumption to improve battery life for TWS earbuds and wireless headsets with the new LC3 audio codec.
While Bluetooth 5 allowed streaming audio to two separate devices, version 5.2 allows one-to-many and many-to-
one broadcast. This enables multiple Bluetooth audio devices to play audio from a single source, while also allowing
multiple sources to simultaneously serve several audio streams to a single receiver.

The Future Of Bluetooth: What’s Next?


Although Bluetooth was originally created to enable wireless point-to-point communication between devices
primarily for data transfer, Bluetooth 5 has radically changed the game from ad hoc connections to full-blown mesh
capability rivalling Wi-Fi networks.

The wireless protocol’s shift to battery efficient low energy mode with BLE made it attractive for smart
home and industrial automation applications. However, the last few revisions have added interesting location-based
features such as angle of arrival (AoA) and angle of departure (AoD) detection. These allow Bluetooth networks
to estimate the signal direction and achieve a claimed centimetre-level positional accuracy. With distance
measurement coming in future Bluetooth revisions, the new positioning capability will open a host of interesting
applications in the realm of home automation as well as in the industrial domain. Imagine smart home devices that
detect and automatically react to your presence, instead of requiring manual human intervention. The possibilities
are limited by the imagination of device manufacturers at this juncture. Only time will tell how the industry reacts
to these new exciting features that Bluetooth puts at its disposal.
Bluetooth Low Energy Architecture:

The architecture of Bluetooth Low Energy is divided into three important layers:

 Application
 Host
 Controller

Refer to the following figure:

Bluetooth Low Energy architecture


We shall touch on every segment/layer briefly before delving deeper into each of the layers.

Application
We will develop multiple applications for several IoT and Bluetooth Low Energy use cases throughout the
course of this book and these applications will be hosted in the application layer of a Bluetooth Low Energy compatible
device. This is the layer which will contain the user interface, application logic, and the overall application
architecture. A working knowledge of this layer is necessary to start building Bluetooth Low Energy oriented
applications. However, it is always good to know what goes under the hood and how our application talks to the
underlying Bluetooth Low Energy hardware/chipset; hence, we will also explore the host and the controller layers.

Host

Lying just the following Application layer is the Host layer, which has the following layers:
 Generic Access Profile (GAP): This defines how Bluetooth Low Energy devices access and communicate
with each other. Bluetooth Low Energy devices can connect to each other in one of the following roles:
o Broadcaster: Also referred to generically as peripheral, this is a role where a Bluetooth Low Energy
device broadcasts/advertises information packets.
o Observer: Also referred to generically as central, this is a role where a Bluetooth Low Energy
device listens for the packets and then decides to initiate a connection, or not, depending on the use
case.
 Generic Attribute Profile (GATT): This defines how data or attributes are formatted, packaged, and sent
across connected devices according to its described rules. Similar to GAP, there are certain roles that
interacting devices can adopt:
o Client: This typically sends a request to the GATT server. The client can read and/or write
attributes/data found on the server.
o Server: One of the main roles of the server is to store attributes/data. Once the client makes a
request, the server must make the attributes/data available.
 Attribute Protocol: This defines rules for accessing attributes/data on a device. A GATT profile is built on
top of the attribute protocol. Although GATT implements the client server roles, these are defined by
the Attribute Protocol. This protocol also defines the fact that data on a server will be arranged in the form
of attributes each of which will have:
o A 16-bit attribute handle
o A UUID
o A set of permissions
o A value
Next, the protocol also defines various read and write operations for attributes also known as ATT operations:
 Read Operations
 Write Operations: These are of type Write Requests with Response (write to an attribute and expect a
response), Write (write without expecting acknowledgement), Signed Write (similar to write but uses a
signature to authenticate the data)
 Indications: These are asynchronous notification operations initiated by the server for the client. This is
initiated if the client has subscribed to the updates of attribute values. It requires an acknowledgement from
the client.
 Notifications: are similar to an indication. The only difference is that they do not require an
acknowledgement from the client.
All in all, Attribute Protocol is just a set of rules related to accessing data. Don't worry if you don't understand the
specifications, that is, characteristics, services, and profiles, which help Bluetooth Low Energy devices to discover
significance of it at this stage. We will be covering the significance of these characteristics/attributes and related
operations in the upcoming sections:
 Security Manager Protocol: This defines rules regarding authentication processes such as pairing
 Logical Link Controller and Adaptation Protocol (L2CAP): This defines the following rules:
o Fragmentation and defragmentation of application data
o Multiplexing and demultiplexing of multiple channels over a shared logical link
The Host layer defines three very important, identify, and talk to each other It really can't be stressed enough that a
thorough understanding of these three specifications is absolutely imperative to design robust Bluetooth Low Energy
oriented applications. We will go over each of these in detail, right after we have briefly touched on the controller
layer.
Controller: Simply speaking, the controller is the actual Bluetooth chip or hardware, which facilitates transmission
and receipt of Bluetooth signals:
TI CC2540 Bluetooth Low Energy SoC

It consists of the Link Layer and the Physical Layer. As the name already suggests, the Physical layer consists of
all the complex analog circuits, which transmit and receive the digital data over the air. The Link Layer, on the other
hand, is responsible for scanning, advertising, creating, and maintaining links (connections) between devices. The link
layer can have five states: Standby, Advertising, Scanning, Initiating, and Connection (master- slave):

Link Layer States, source: www.bluetooth.com

Delving deeper into the three main pillars of the Bluetooth Low Energy technology should have already given
you an idea of what lies under the hood. Now, as promised, let's discuss the important specifications defined by
the Host layer, starting with profiles.

PSoC4 BLE architecture and Component Overview


Features

The PSoC 4xxx-BL family has these major components:


■ BLE radio and subsystem
■ 32-bit Cortex-M0 CPU with single-cycle multiply, delivering up to 43 DMIPS at 48 MHz
■ Up to 256 KB flash and 32 KB SRAM
■ Direct memory access (DMA)
■ Four independent center-aligned pulse-width modulators (PWMs) with complementary, dead-band
programmable outputs
■ Twelve-bit SAR ADC with hardware sequencing for multiple channels
■ Up to four opamps that can be used for analog signal conditioning and as a comparator
■ Two low-power comparators
■ Two serial communication blocks (SCB) that can work as SPI, UART, I2C, and local interconnect
network (LIN) slave serial communication channels
■ Up to four programmable logic blocks, known as universal digital blocks (UDBs)
■ CapSense

Interrupt Controller
The CPU subsystem includes a nested vectored interrupt controller (NVIC) with 32 interrupt inputs and a
wakeup interrupt controller (WIC), which can wake the processor from Deep-Sleep mode. The Cortex-M0 CPU of
PSoC 4 implements a non-maskable interrupt (NMI) input, which can be tied to digital routing for general-purpose
use.

Direct Memory Access


The DMA engine is capable of independent data transfers anywhere within the memory map (peripheral-to-
peripheral and peripheral-to/from-memory) with a programmable descriptor chain. Note: DMA is available only in
PSoC 41x8-BL5xx and PSoC 42x8-BL5xx families

Memory
The PSoC 4 memory subsystem consists of flash and SRAM. A supervisory ROM, containing boot and
configuration routines, is also present

Flash
The PSoC 4 has a flash module, with a flash accelerator tightly coupled to the CPU, to improve average
access times from the flash block. The flash accelerator delivers 85 percent of single-cycle SRAM access performance
on an average.

SRAM
The PSoC 4 provides SRAM, which is retained during Hibernate mode.

System-Wide Resources

Clocking System
The clocking system for the PSoC 4 device consists of the internal main oscillator (IMO) and internal low-
speed oscillator (ILO) as internal clocks and has provision for an external clock, external crystal oscillator (ECO), and
watch crystal oscillator (WCO). The IMO with an accuracy of ±2 percent is the primary source of internal clocking in
the device. Multiple clock derivatives are generated from the main clock frequency to meet various application needs.
The ILO is a low-power, less accurate oscillator and is used as a source for LFCLK, to generate clocks for peripheral
operation in Deep-Sleep mode. Its clock frequency is 32 kHz with ±60 percent accuracy.

Power System
The PSoC 4 operates with a single external supply in the range 1.71 V to 5.5 V. PSoC 4 has four low-power
modes – Sleep, Deep-Sleep, Hibernate, and Stop – in addition to the default Active mode. In Active mode, the CPU
runs with all the logic powered. In Sleep mode, the CPU is powered off with all other peripherals functional. In Deep-
Sleep mode, the CPU, SRAM, and high-speed logic are in retention; the main system clock is OFF while the low-
frequency clock is ON and the low-frequency peripherals are in operation. In Hibernate mode, even the low-frequency
clock is OFF and low-frequency peripherals stop operating. Multiple internal regulators are available in the system to
support power supply schemes in different power modes.

GPIO
Every GPIO in PSoC 4 has the following characteristics:
■ Eight drive strength modes
■ Individual control of input and output disables
■ Hold mode for latching previous state
■ Selectable slew rates
■ Interrupt generation – edge triggered
■ CapSense and LCD drive support
PSoC 4 also has two over-voltage tolerant ports , which enable I2C Fast Mode power down specification
compliance and have the ability to connect to higher voltage buses while operating at lower VDD. The pins are
organized in a port that is 8-bit wide. A high speed I/O matrix is used to multiplex between various signals that may
connect to an I/O pin. Pin locations for fixed function peripherals are also fixed.

Bluetooth Low-Energy Subsystem


PSoC 4xxx Bluetooth Low-Energy (BLE) subsystem integrates the RF transceiver, digital PHY
modem, and link layer controller.
RF Transceiver
The RF transceiver contains an integrated balun, which provides a single-ended RF port pin to drive a 50-
ohm antenna via a matching/filtering network. In the receive direction, this block converts the RF signal from the
antenna to a 1-MHz intermediate frequency and digitizes the analog signal to 10- bit digital signal. In the transmit
direction, this block takes 1 Mbps GFSK modulated from digital PHY, up-converts it to radio frequency, and transmit
it to air through antenna.
Digital PHY Modem
In the transmit direction, this sub-block takes the 1-Mbps serial data from the link layer controller, generates
GFSK direct modulated data, and sends it to the BLE analog section. On the receive side, it takes the 1-MHz IF ADC
data from the BLE analog section and uses digital demodulator to generate the 1-Mbps serial data.
Link Layer Controller
The link layer controller implements all timing critical functions specified in the Bluetooth Low-Energy Link
Layer specifications (packet framing/de-framing, CRC generation/ checking, encryption/decryption, state machines,
and packet transmission); it also provides interface to the digital PHY. The communication between link layer
hardware and firmware is done through interrupt, FIFO, and registers.
Programmable Digital
The PSoC 42xx-BL has up to four UDBs. Each UDB contains structured data-path logic and uncommitted
PLD logic with flexible interconnect. The UDB array provides a switched routing fabric called the digital signal
interconnect (DSI). The DSI allows routing of signals from peripherals and ports to and within the UDBs. The UDB
arrays in PSoC 42xx-BL enable custom logic or additional timers/PWMs and communication interfaces such as I2C,
SPI, I2S, and UART. Note PSoC 41xx-BL does not have UDBs.

Fixed-Function Digital

Timer/Counter/PWM Block
The Timer/Counter/PWM block consists of four 16-bit counters with user-programmable period length. The
functionality of these counters can be synchronized. Each block has a capture register, period register, and compare
register. The block supports complementary, dead-band programmable outputs. It also has a kill input to force outputs
to a predetermined state. Other features of the block include centeraligned PWM, clock prescaling, pseudo random
PWM, and quadrature decoding.

Serial Communication Blocks


The device has two SCBs. Each SCB can implement a serial communication interface as I2C, UART, local
interconnect network (LIN) slave, or SPI.
The features of each SCB include:
■ Standard I2C multi-master and slave function
■ Standard SPI master and slave function with Motorola, Texas Instruments, and National (MicroWire) mode
■ Standard UART transmitter and receiver function with SmartCard reader (ISO7816), IrDA protocol, and LIN
■ Standard LIN slave with LIN v1.3 and LIN v2.1/2.2 specification compliance
■ EZ function mode support for SPI and I2C with 32-byte buffer

Analog System

SAR ADC
PSoC 42xx-BL has a configurable 12-bit 1-Msps SAR ADC and PSoC 41xx-BL has a similar 12-bit SAR
ADC with 806 ksps. The ADC provides three internal voltage references (VDDA, VDDA/2, and VREF) and an
external reference through a GPIO pin. The SAR hardware sequencer is available, which scans multiple channels
without CPU intervention .
Continuous Time Block mini
The Continuous Time Block mini (CTBm) provides continuous time functionality at the entry and exit points
of the analog subsystem. The CTBm has two highly configurable and high-performance opamps with a switch routing
matrix. The opamps can also work in comparator mode. PSoC 42xx-BL has two such CTBm blocks, while PSoC
41xx-BL has one CTBm block. The block allows open-loop opamp, linear buffer, and comparator functions to be
performed without external components. PGAs, voltage buffers, filters, and trans-impedance amplifiers can be
realized with external components.CTBm block can work in Active, Sleep, and Deep-Sleep modes.

Low-Power Comparators
The PSoC 4xxx-BL has a pair of low-power comparators, which can operate in all device power modes. This
functionality allows the CPU and other system blocks to be disabled while retaining the ability to monitor external
voltage levels during low-power modes. Two input voltages can both come from pins, or one from an internal signal
through the AMUXBUS.

Special Function Peripherals

LCD Segment Drive


The PSoC 4 has an LCD controller, which can drive up to four commons and every GPIO can be configured
to drive common or segment. It uses full digital methods (digital correlation and PWM) to drive the LCD segments,
and does not require generation of internal LCD voltages
CapSense
PSoC 4 devices have the CapSense feature, which allows you to use the capacitive properties of your fingers
to toggle

You might also like