I2C
Embedded
CAN
Networking Protocols
BLUETOOTH, ZIGBEE
COMMUNICATION PROTOCOLS
INTRODUCTION
Protocols are sets of rules and conventions that
dictate how devices or components exchange
data and control information in a communication
network
define the format of the exchanged data, the
timing of communication, error-handling
mechanisms, and the roles of the communicating
entities
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 2
I2C
62
INTER-INTEGRATED CIRCUIT
INTRODUCTION
I2C is invented in 1989 by Philips semiconductor
It is a serial protocol with only two wire interface like UART
Widely used for short distance and intra-board communication
I2C has the best features of both SPI and UART protocols
It can support multi-master and
multi-slave configuration
Operate upto 400kpbs
[Link]
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 37
INTER-INTEGRATED CIRCUIT
INTRODUCTION
I2C protocol use only two pins Serial Data (SDA) and
Serial Clock (SCL)
Data is transmitted bit by bit along SDA in I2C
SDA (Serial Data) – Bidirectional connection between
master and slave
SCL (Serial Clock) – clock signal
5
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 40
INTER-INTEGRATED CIRCUIT
INTRODUCTION
I2C is also a synchronous protocol, hence the output
is synchronized using clock signal
Common clock signal is shares between master and
slave
Master always controls the clock signal
Master device addresses the slave devices via SCL
6
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 41
INTER-INTEGRATED CIRCUIT
HOW I2C WORKS
Data is transferred as messages in I2C
Messages are broken to frames of data
Each message contains a binary address frame of the
slave and data frames
One or many data frames with data can be
transferred in one message
The message has start and stop conditions, read,
write, ACK & NACK bit between each data frame
7
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 42
INTER-INTEGRATED CIRCUIT
HOW I2C WORKS
[Link]
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 43
INTER-INTEGRATED CIRCUIT
HOW I2C WORKS
Start Condition: The SDA pin switches from high to
low voltage level before the SCL pin switches from
high to low
Stop Condition: The SDA pin switches from low to
high voltage after SCL pin switches from low to high
Address Frame: 7 or 10 bit unique address is
assigned to each slave for identifying when master
wants to connect to it 9
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 44
INTER-INTEGRATED CIRCUIT
HOW I2C WORKS
Read/Write Bit: This bit defines the state of master,
whether it is sending data (low) or receiving data
(high)
ACK/NACK Bit: Each frame is followed by a ACK bit.
If message is successfully received, an ACK bit is
returned
10
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 45
INTER-INTEGRATED CIRCUIT
INTRODUCTION
11
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 39
INTER-INTEGRATED CIRCUIT-
Open drain
12
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 39
INTER-INTEGRATED CIRCUIT-
Open drain
13
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 39
INTER-INTEGRATED CIRCUIT
STEPS OF I2C DATA TRANSMISSION
STEP-1: The master
sets the start
condition by setting
all SDA pin to low
before setting SCL pin
14
[Link]
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 46
INTER-INTEGRATED CIRCUIT
STEPS OF I2C DATA TRANSMISSION
STEP-2: The master
sends 7 or 10 bit
address to each slave
with which it wants to
communicate with,
along with the
read/write bit
15
[Link]
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 47
INTER-INTEGRATED CIRCUIT
STEPS OF I2C DATA TRANSMISSION
STEP-3:
After receiving address
from master, slave
compare the address
with its own address
If the address matches,
ACK bit is sent and SDA
pin is switched to low
If address does not
matches slave keeps 16
the SDA pin high [Link]
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 48
INTER-INTEGRATED CIRCUIT
STEPS OF I2C DATA TRANSMISSION
STEP-4: The master
sends or receives the
data frame
17
[Link]
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
INTER-INTEGRATED CIRCUIT
STEPS OF I2C DATA TRANSMISSION
STEP-5: After each
successful data
reception the receiving
device sent a ACK bit
18
[Link]
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
INTER-INTEGRATED CIRCUIT
STEPS OF I2C DATA TRANSMISSION
STEP-6: To end the
data transmission, the
master sets the SCL pin
high before setting SDA
pin high
19
[Link]
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
INTER-INTEGRATED CIRCUIT
STEPS OF I2C DATA TRANSMISSION
Multiple Master
with Multiple
Slaves
Single Master with
Multiple Slaves
20
[Link]
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
INTER-INTEGRATED CIRCUIT
ADVANTAGES:
Only uses two wires
Supports multiple masters and slaves
Use chip addressing
ACK/NACK bit for successful transmission
it can work well with both slow and fast ICs.
DISADVANTAGES:
Slower data transfer rate than SPI
Clock speed limitation & power dissipation because of pull-
up resistor
hardware complexity increases with multi master/slave
configuration 21
Frame overhead due to ack bits and device address bits
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
INTER-INTEGRATED CIRCUIT
I2C Line Pin in
Arduino
SDA A4
SCL A5
22
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
INTER-INTEGRATED CIRCUIT
Arduino function for I2C protocol (Wire Library)
[Link]() - Initialize the I2C bus
[Link](address, quantity)
address- 7 bit address of the device to request bytes
quantity- The number of bytes to request
[Link]() – receives a byte of data transmitted from slave to master
[Link]() – sends data to master from slave on request
[Link](handler) – register a function to call when master request data from
slave
[Link](handler) - Registers a function to be called when a slave device receives a
transmission from a master
[Link]() – reads a byte transmitted form slave to master
[Link]() – writes data to slave on request from master
[Link]()- modifies the clock frequency of I2C
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 32
INTER-INTEGRATED CIRCUIT
Master read I2C – Arduino Interface
include <Wire.h>
void setup()
{
[Link](); // join i2c bus (address optional for master)
[Link](9600); // start serial for output
}
void loop()
{
[Link](8, 6); // request 6 bytes from slavedevice #8
while ([Link]())
{
// slave may send less than requested
char c = [Link](); // receive a byte as character
[Link](c); // print the character
}
delay(500); 24
}
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
INTER-INTEGRATED CIRCUIT
Slave sender I2C – Arduino Interface
#include <Wire.h>
void setup()
{
[Link](8); // join i2c bus with address #8
[Link](requestEvent); // register event
}
void loop()
{
delay(100);
}
// function that executes whenever data is requested by master
// this function is registered as an event, see setup()
void requestEvent()
{ [Link]("hello "); // respond with message of 6 bytes // as expected by
master
} 25
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
PROGRAM
Read the switch state on Master and control LED on
Slave
Write a program to implement a I2C communication between two
Arduino Uno. Configure one of the Arduino as master and other as
slave. Master is interfaced with Switch (Push button) and slave is
connected with LED. Establish a I2C communication between
master and slave, blink a LED on slave whenever switch is pressed
on Master. Simulate and verify this logic on Arduino Uno using
Tinkercad circuits simulator.
LAB- ECE4003-Embedded System Design 26
LAB TASK-1
Program Program Design
(Master) (Slave)
LAB- ECE4003-Embedded System Design 27
QUIZ
28
QUIZ
29
QUIZ
30
CAN
31
CONTROL AREA NETWORK
INTRODUCTION
Controller Area Network (CAN) protocol is developed
by Robert Bosch in 1986
Later CAN was standardized as ISO-11898 and ISO-
11519
It is a two-wired , serial half-duplex and
asynchronous type of communication protocol.
Needs only two wires named CAN_H and CAN_L.
Operates at data rates of up to 1 Megabit per
second. 32
No host computer
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CAN-INTRODUCTION
33
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CONTROL AREA NETWORK
INTRODUCTION
34
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CONTROL AREA NETWORK
Host controller (MCU) is responsible for the functioning of the
respective node.
CAN controller convert the messages in accordance with the CAN
protocols for transmitting via CAN transceiver
CAN controller can either be connected separately or embedded inside
the host controller
35
MODULE - 4
CONTROL AREA NETWORK
36
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CAN-INTRODUCTION
37
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CAN ARCHITECTURE
CAN uses the existing OSI reference model for data
transmission
OSI reference model represents a set of seven layers
CAN protocol uses lower two layers of OSI physical layer and
data link layer.
38
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CAN ARCHITECTURE
DATA LINK LAYER:
LLC is responsible for frame acceptance filtering,
overload notification, and recovery management
Once, framing is done it is followed by arbitration,
error detection and acknowledgement handled by
MAC layer
PHYSICAL LAYER:
responsible for the transmission of raw data.
It defines the specifications for the parameters such
39
as voltage level, timing, data rates, and connector.
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CONTROL AREA NETWORK
MESSAGE FRAME - TYPES
There are four different message frames in CAN
Data frames
Remote frames
Error frames
Overload frames
Data and remote frame are set by user and other two
are set by CAN hardware 40
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CONTROL AREA NETWORK
MESSAGE FRAME - TYPES
Data frames
41
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CONTROL AREA NETWORK
STANDARD CAN - MESSAGE FRAMING
SOF 11 bit RTR IDE r0 DLC 0…8 CRC ACK EOF IFS
identifier byte
data
Various fields in standard CAN
42
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CONTROL AREA NETWORK
STANDARD CAN - MESSAGE FRAMING
SOF - Start of Frame bit. It indicates start of
message and used to synchronize the nodes on a
bus. A dominant bit (logic 0) in the field marks the
start of frame.
IDENTIFIER-It serves dual purpose, one to determine
which node has access to the bus and second to
identify the type of message.
RTR - Remote Transmission Request. It identifies 43
whether it’s a data frame or a remote frame. RTR is
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CONTROL AREA NETWORK
STANDARD CAN - MESSAGE FRAMING
IDE – Identifier Extension. It is used to specify the
frame format. Dominant bit is for standard and
recessive for extended frame.
R0 - Reversed bit. Not used currently and kept for
future use.
DLC – Data Length Code. It is 4 bit data length code
that contains the number of bytes being transmitted.
44
DATA – Used to store up to 64 data bits of application
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 149
CONTROL AREA NETWORK
STANDARD CAN - MESSAGE FRAMING
CRC– Cyclic Redundancy Check. The 16-bit (15 bits
plus delimiter) cyclic redundancy check (CRC)
contains the checksum of the preceding application
data for error detection.
ACK – Acknowledge (ACK) field. It compromises of
the ACK slot and the ACK delimiter. When the data is
received correctly the recessive bit in ACK slot is
overwritten as dominant bit by the receiver.
45
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CONTROL AREA NETWORK
STANDARD CAN - MESSAGE FRAMING
EOF– End of Frame (EOF). The 7-bit field marks the
end of a CAN frame (message) and disables
IFS - Inter Frame Space that specifies minimum
number of bits separating consecutive messages
IFS provides the intermission between two frames
and consists of three recessive bits known as
intermission bits. This allows nodes for internal
processing before the start of next frame. 46
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CONTROL AREA NETWORK
EXTENDED CAN - MESSAGE FRAMING
S 11-bit SRR IDE 18-bit R r1 r0 DLC 0…8 CRC ACK EOF IFS
O identifier Identifier T Bytes
F R Data
Various fields in EXTENDED CAN
47
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CONTROL AREA NETWORK
EXTENDED CAN - MESSAGE FRAMING
It is same as 11-bit identifier with some added fields
SRR- Substitute Reverse Request- always
transmitted as a recessive bit to make sure standard
data frame always have the same priority
R1- It is another bit not used currently and kept for
future use.
48
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CONTROL AREA NETWORK
MESSAGE FRAME - TYPES
Error frames – If transmitting or receiving node detects an
error, it will immediately abort transmission and send error
frame consisting of an error flag made up of six dominant bits
and error flag delimiter made up of eight recessive bits.
Field within DATA or Error Frame Interface space or
Error Frame overload frame
Error Active
0……5 8
Error Flag Field Error Delimiter Field
Error Passive
49
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CONTROL AREA NETWORK
MESSAGE FRAME - TYPES
Overload frame-It is similar to error frame but used for
providing extra delay between the messages. An Overload
frame is generated by a node when it becomes too busy and
is not ready to receive.
50
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
CONTROL AREA NETWORK
Future of CAN bus
Need to accommodate increasing advanced vehicle
Role of Internet of Things in vehicles
Development of autonomous vehicles
The advancement of cloud computing
To address security issues
Vehicle telematics
51
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
52
BLUETOOTH
INTRODUCTION
Bluetooth is a transceiver protocol works in 2.4GHz
wireless link
It’s a secure protocol, and it’s perfect for short-
range, low-power, low-cost, wireless transmissions
Bluetooth is a dynamic standard where devices can
automatically find each other, establish connections,
and discover what they can do for each other on an
ad hoc basis
Bluetooth networks can be referred as piconet and
scatternet 53
It uses a master/slave model
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH NETWORKS
INTRODUCTION
54
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
A single master device can be connected to up to
seven different slave devices
The master coordinates communication
throughout the piconet. It can send data to any of its
slaves and request data from them as well
Slaves are only allowed to transmit to and receive
from their master. They can’t talk to other slaves in
the piconet
55
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH ADDRESS AND NAMES
Every single Bluetooth device has a unique 48-bit
address, commonly abbreviated BD_ADDR.
presented in the form of a 12-digit hexadecimal
value.
The most-significant half (24 bits) of the address is
an organization unique identifier (OUI), which
identifies the manufacturer.
The lower 24-bits are the more unique part of the
address.
56
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH VERSIONS
57
MODULE - 4
BLUETOOTH PROTOCOL STACK
MODULE - 4 171
BLUETOOTH
Radio: This layer defines the requirements for a
transceiver to operate in the 2.4 GHz ISM band. (air
interface, frequency bands, FHSS)
Baseband: The Baseband layer describes the
specification of the Bluetooth Link Controller (LC),
and carries baseband protocol. Two types of link can
be created in baseband are ACL and SCO.
(addressing schemes, packet format, timing control)
59
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN 172
BLUETOOTH
Two types of link between master and slave
Asynchronous Connection Less (ACL)
Packet switched data
Slave can have only one ACL link to master
Used for correct delivery over fast delivery
Maximum data rate of 721 kbps
Synchronous Connection Oriented (SCO)
Real time data transmission
Damaged packet cannot be retransmitted
Data rate of 64 kbps 60
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
LMP: Used by the Link managers for link set-up
and control. (Authentication, message encryption)
Host Controller Interface (HCI): HCI provides a
command interface to the Baseband LC and Link
Manager, to access hardware status and control
registers.
L2CAP: Logical Link Control and Adaptation
Protocol (L2CAP) supports higher level protocol
multiplexing, packet segmentation and 61
reassembly, and also conveys the quality of service
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
RFCOMM: The RFCOMM protocol provides
emulation of serial ports over the L2CAP
protocol. The protocol is based on the ETSI standard
TS 07.10.
SDP: The Service Discovery Protocol (SDP) provides a
means for applications to discover, which services
are provided by or available through a Bluetooth
device
62
TCS: telephony control protocol for telephony service
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
72 bits 54 bits 0-2744 bits
Access Code Header Data
Preamble Synchronisati Traile Header Payload body CRC
(4) on (64) r (4)
Access code (AC) Data - contains data or
Used for packet identification control information from
Once packet is received, receiver in piconet will upper layer
compare the incoming signal with AC, if any mismatch Header – identifies logical
is found packet will be ignored channel
72 bit AC is derived from master identity Payload body – contains user
It is used for synchronization data
Three types CRC- 16 bit checksum
Channel AC – targets piconet ID
Device AC – individual devices 63
Inquiry AC – used during pairing
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
3 bits 4 bits 1 bits 1 bits 1 bits 8 bits
AM_ADDR Type Flow ARQN SEQN HEC
Header
Address – it can address up to 7 slave devices, if it is 0, then messages will
broadcasted
Type – defines type of incoming data
ACL – Data medium (DM) or Data High (DH)
SCO - Data Voice (DV) and High Quality Voice (HV)
12 types of packet for each SCO and ACL
4 common control packets
Flow- 1 bit flow control
ARQN – 1 bit acknowledgement
SEQN – 1 bit sequential numbering scheme for packet ordering
HEC – Header error check
64
Header = 3 X 18 bits = 54 bits
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
BONDING AND PAIRING
When two Bluetooth devices want to connect, they
can be bonded together.
Bonded devices automatically establish a connection
whenever they’re close enough.
Bonds are created through a one-time process called
pairing.
On pairing devices share their addresses, name,
profiles and they are stored in memory.
The also share a common secret key, which allows
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
BONDING AND PAIRING
Pairing requires an authentication process to
establish connection between devices.
Sometimes pairing is a simple “Just Works”
operation, where the click of a button is all it takes to
pair (this is common for devices with no UI, like
headsets).
Older, legacy (v2.0 and earlier), pairing processes
involve the entering of a common PIN code on each
device. The PIN code can range in length and 66
complexity fromECE4003
MODULE - 4
four numbers (e.g. “0000” or
– EMBEDDED SYSTEM DESIGN
BLUETOOTH
CONNECTION PROCESS
Creating a Bluetooth connection between two
devices is a multi-step process involving three
progressive states.
Step-1 Inquiry: If two Bluetooth devices know
absolutely nothing about each other, one must run an
inquiry to try to discover the other
On receiving the inquiry the device which listens to
such a request will send back address, name and
67
other informationECE4003 – EMBEDDED SYSTEM DESIGN
MODULE - 4
BLUETOOTH
CONNECTION PROCESS
Step-2 Paging (Connecting) – Paging is the process of
forming a connection between two Bluetooth devices.
Step-3 Connection – After a device has completed the
paging process, it enters the connection state.
The mode of operation of device is decided in
connection phase
68
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
CONNECTION MODES
69
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
CONNECTION MODES
Active Mode – regular connected mode, where device
send and receive data ( regular connection up-to 7
devices)
Sniff Mode – power saving mode, less active mode
(frees slave for predetermined period of time,
recurring fixed time slot)
Hold Mode – temporary mode, device will be sleeping
for a particular period of time (frees slave for
predetermined period of time, one time slot)
Park Mode – sleep mode with infinite time, slave will
70
wake only if master
MODULE - 4
tells it to wake up (maximum of
ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
POWER CLASSES
The transmit power determines the range of a
Bluetooth module and it is defined by its power class.
There are three defined classes of power:
Class Number Max Output Max Output Max Range
Power Power
Class 1 20 dBm 100 mW 100 m
Class 2 4 dBm 2.5 mW 10 m
Class 3 0 dBm 1 mW 10 cm
71
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
HC05 – BLUETOOTH MODULE
HC‐05 module is an easy to use Bluetooth SPP (Serial
Port Protocol) module, designed for transparent
wireless serial connection setup.
The HC-05 Bluetooth Module can be used in a Master
or Slave configuration, making it a great solution for
wireless communication.
This serial port Bluetooth module is fully qualified
Bluetooth V2.0+EDR (Enhanced Data Rate) 3Mbps
modulation with complete 2.4GHz radio transceiver
72
and baseband. ECE4003 – EMBEDDED SYSTEM DESIGN
MODULE - 4
BLUETOOTH
HC05 – BLUETOOTH MODULE
The Bluetooth module HC-05 is a MASTER/SLAVE
module. By default the factory setting is SLAVE.
The Role of the module (Master or Slave) can be
configured only by AT COMMANDS.
Master module can initiate a connection to other
devices. The user can use it simply for a serial port
replacement to establish connection between MCU
and GPS, PC to your embedded project, etc. 73
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
HC05 – BLUETOOTH MODULE
Hardware Features
Up to +4 dBm RF transmit power.
3.3 to 5 V I/O.
PIO(Programmable Input/Output) control.
UART interface with programmable baud rate.
With integrated antenna.
Software Features
Slave default Baud rate: 9600, Data bits:8, Stop
bit:1,Parity:No parity.
Auto‐connect to the last device on power as default. 74
Permit pairing device to connect as default.
MODULE - 4 Auto‐pairing PINCODE:”1234” as default
ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
HC05 – BLUETOOTH MODULE
75
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
HC05 – BLUETOOTH MODULE – Arduino
#define ledPin 7
int state = 0;
void setup() {
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
[Link](38400); // Default communication rate of the Bluetooth module
}
void loop() {
if([Link]() > 0){ // Checks whether data is comming from the serial port
state = [Link](); // Reads the data from the serial port
}
76
if (state == '0') {
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
BLUETOOTH
HC05 – BLUETOOTH MODULE – Arduino
digitalWrite(ledPin, LOW); // Turn LED OFF
[Link]("LED: OFF"); // Send back, to the phone, the String "LED: ON"
state = 0;
}
else if (state == '1') {
digitalWrite(ledPin, HIGH);
[Link]("LED: ON");;
state = 0;
}
}
77
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE
78
ZIGBEE
INTRODUCTION
ZigBee protocol is mostly used in the power
constraint short distance communication
Why another short range communication protocol ?
Bluetooth
Wi-Fi
?
ZigBee is specially build for control and sensor
applications
ZigBee is a standard with- very low cost, low power79
device, low data rate and short range
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE
INTRODUCTION
Most commonly used standard in IoT
Open source standard developed by ZigBee Alliance
It works on IEEE 802.15.4 standard for wireless
personal area networks
ZigBee operates at 868 MHz (Europe), 902-928MHz
(US & Australia) and 2.4 GHz (worldwide) frequencies
Data rate of 250 kbps, supports low data rate
applications
80
provides a 128-bit AES encryption
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE
ZigBee devices can cover a distance range between
10-100 meters.
It supports master-slave configuration or master-
master configuration
ZigBee architecture consist of coordinator, router and
end device
ZigBee supports star, tree and mesh topologies
Modes of operation – Beacon and Beacon less
81
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE NETWORK
82
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE
Coordinator
Root of network
One coordinator in each network
It performs channel selection, assigning node ID,
allocation of unique address
Routers
Intermediate node between coordinator and end
node
Route traffic between different nodes 83
MODULE - 4
Allows otherECE4003
end– EMBEDDED
devices to join network
SYSTEM DESIGN
ZIGBEE
End Node
They may be at sleep mode to increase battery
efficiency
All traffic to end device is first routed to parent
node
84
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE- STATES AND MODES
85
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE
Channel Access
The coordinator assigns only one channel to the
network
Methods of channel access
Contention based - need not synchronized and used
CSMA
CSMA: Channel goes to receive mode and check for
any signal, if no signal is detected then it will start
data transmission or else wait for a random period
86
of time
-4
MODULE ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE
ZigBee characteristics
Low power consumption – extended battery life
Low data rate – 200-250 kbps
Wi-Fi- 11 Mbps, Bluetooth – 1 Mbps
Short range
75-100 meter indoor
Up to 300 meters outdoor
Network join time- 30 sec
Large and small networks – 65000 (theoretical)
Low cost
87
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE
Zigbee protocol stack 88
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE-PHYSICAL LAYER
89
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE-MAC LAYER
90
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE-NETWORK LAYER
91
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE-Application Support Sub-
layer
92
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE-Application Framework
93
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE
Advantages of ZigBee Protocol
Simple setup and maintenance
Low power consumption, low data rate ideal for long
lifetime devices
It can be used for lighting, security, appliance and
home access
It offers network flexibility and scalability 94
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE-APPLICATIONS
95
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE-APPLICATIONS
96
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE-APPLICATIONS
97
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN
ZIGBEE
ZigBee connection with Arduino
98
MODULE - 4 ECE4003 – EMBEDDED SYSTEM DESIGN