ES Lecture 05
ES Lecture 05
ES Lecture 05
Communication
1
Communication Methods
Communication methods
◼ Media and signaling conventions used to transmit
data between digital devices
◼ Different physical layers methods including:
wires, radio frequency (RF), optical (IR, fiber)
◼ Different encoding schemes including:
amplitude, frequency, and pulse-width modulation
2
Communication…
Dimensions to consider:
◼ bandwidth – number of wires – serial/parallel
◼ speed – bits/bytes/words per second
◼ timing methodology – synchronous or
asynchronous
◼ number of destinations/sources
◼ arbitration scheme – daisy-chain, centralized,
distributed
◼ protocols – provide some guarantees as to correct
communication
3
Bandwidth
Serial:
◼ Single wire or channel to trasmit information one
bit at a time
◼ Requires synchronization between sender and
receiver
◼ Sometimes includes extra wires for clock and/or
handshaking
◼ Good for inexpensive connections (e.g., terminals)
◼ Good for long-distance connections (e.g., LANs)
◼ Examples: RS-232, Ethernet, I2C, IrDA, USB,
Firewire, Bluetooth
4
Bandwidth…
Parallel
◼ Multiple wires to transmit information one byte or
word at a time
◼ Good for high-bandwidth requirements (CPU to
disk)
◼ More expensive wiring/connectors/current
requirements
◼ Examples: SCSI-2, PCI bus (PC), PCMCIA
(Compact Flash)
Issues
◼ Encoding, data transfer rates, cost of connectors and
wires, modularity, error detection and/or correction
5
Speed…
Parallel
◼ low-speed, not too wide
SCSI-2 10M bytes/sec, 8 bits wide
PCI bus, 250M bytes/sec, 32 bits wide
PCMCIA (CF+), 9-10M bytes/sec, 16 bits wide
◼ high-speed, very wide – memory systems in large
multi-processors
200M-2G bytes/sec, 128-256 bits wide
6
Speed
Serial
◼ low-speed, cheap connections
RS-232 1K–20K bits/sec, copper wire
◼ medium-speed efficient connections
I2C 10K-400K bits/sec, board traces
IrDA 9.6K-4M bits/sec, line-of-sight, 0.5-6.0m
◼ high-speed, expensive connections
USB 1.5M bytes/sec, USB2 60M bytes/sec, USB3 625M
bytes/s
Ethernet 1.5M-1G bits/sec, twisted-pair or co-axial
Firewire 12.5-50M bytes/sec
7
Speed…
Issues
◼ length of the wires (attenuation, noise, capacitance)
◼ connectors (conductors and/or transducers)
◼ environment (RF/IR interference, noise)
◼ current switching (spikes on supply voltages)
◼ number and types of wires (cost of connectors,
cross-talk)
◼ flow-control (if communicating device can’t keep
up)
8
Timing Methodology
Asynchronous
◼ Fewer wires (no clock)
◼ no skew concerns
◼ synchronization overhead
◼ appropriate for loosely-coupled systems (CPU and peripherals)
◼ common in serial schemes
Synchronous
◼ clock wires and skew concerns
◼ no synchronization overhead
◼ can be high-speed if delays are small and can be controlled
◼ appropriate for tightly-coupled systems (CPU and memory/disk)
◼ common in parallel schemes
9
Serial Peripheral Interface
Common serial interface on many
microcontrollers
Simple 8-bit exchange between two devices
◼ Master initiates transfer and generates clock signal
◼ Slave device selected by master
One-byte at a time transfer
◼ Data protocols are defined by application
◼ Must be in agreement across devices
10
SPI Block Diagram
8-bits transferred in each direction every time
Master generates clock
Shift enable used to select one of many slaves
11
Data Payload on SPI
Data is exchanged between master and slave
◼ Master always initiates
◼ May need to poll slave (or interrupt-driven)
Decide on how many bytes of data have to move in each
direction
◼ Transfer the maximum for both directions
◼ One side may get more than it needs
Decide on format of bytes in packet
◼ Starting byte and/or ending byte?
◼ Can they be distinguished from data in payload?
◼ Length information or fixed size?
SPI buffer
◼ Write into buffer, specify length, master sends it out, gets data
◼ New data arrives at slave, slave interrupted, provides data to go to
master, reads data from master in buffer
12
Inter Integrated Circuit Bus (I2C)
Modular connections on a printed circuit board
Multi-point connections (needs addressing)
Synchronous transfer (but adapts to slowest device)
Similar to Controller Area Network (CAN) protocol used in
automotive applications
Similar to TWI (Two-Wire Interface) on ATmegas
13
I2C…
Supports data transfers from 0 to 400KHz
◼ microcontrollers with built-in interface
◼ A/D and D/A converters
◼ parallel I/O ports
◼ memory modules
◼ LCD drivers
◼ real-time clock/calendars
◼ DTMF decoders
◼ frequency synthesizers
◼ video/audio processors
14
Serial Data Format
SDA going low while SCL high signals start of
data
SDA going high while SCL high signals end of
data
SDA can change when SCL low
SCL high (after start and before end) signals that a
data bit can be read
15
Clock Synchronization
Synchronous data transfer with variable speed
devices
◼ go as fast as the slowest device involved in transfer
Each device looks at the SCL line as an input as
well as driving it
◼ if clock stays low even when being driven high then
another device needs more time, so wait for it to finish
before continuing
◼ rising clock edges are synchronized
16
Arbitration
Devices can start transmitting at any time
◼ wait until lines are both high for some minimum time
◼ multiple devices may start together - clocks will be
synchronized
All senders will think they are sending data
◼ possibly slowed down by receiver (or another sender)
◼ each sender keeps watching SDA - if ever different (driving
high, but its really low) then there is another driver
◼ sender that detects difference gets off the bus and aborts
message
Device priority given to devices with early 0s in their address
◼ 00….111 has higher priority than 01…111
17
Free Scale I2C Module
18
Wireless Com. & Ubiquitous
Bluetooth/WiFi/Cellular
Device-to-Device (Bluetooth-Low-Energy)
Device-to-infrastructure (LTE or WiFi)
Bluetooth Low Energy
the most popular wireless protocol.
19
RF Transmision
• Modulation
o Converts digital bits to an analog signal
o Encodes bits as changes in a carrier frequency:
o Frequency, Amplitude, Phase, etc.
20
Example of modulating digital data onto an analog signal
1 0 1 0 1
21
RF- Reception
22
RF…
• Antenna picks up
modulated radio waves
• Tuner filters out specific
frequency ranges
• Amplitude variations
detected with
demodulation
• Amplifier strengthens the
clipped signal and sends it
through the speaker 23
RF Characteristics
28
Zigbee/802.15.4
Zigbee is built on top of 802.15.4
Radio bands: 868MHz in Europe, 915MHz in US and
Australia. 2.4GHz else worldwide.
Low data-rate - 250 kbps, low power – Up to 1000 days
Transmits over longer distances through mesh networks
Why ZigBee?
30
• Competes with Wi-Fi for bandwidth..
◼ Only four usable bands in Wi-Fi intensive scenarios
Image Source:32
<http://kf5czo.blogspot.com/2012/03/ham-radio-and-mesh-
Mesh Networking
• Mesh Characteristics:
Self-forming – ZigBee devices can establish
communication pathways when new devices appear.
Self-healing – If a node is removed from the network
(either intentionally or not) the remaining network will
look to establish alternate routes of communication.
33
Zigbee/802.15.4 Applications
Wireless environmental sensors
o Temperature, pressure, sound, luminous intensity
Medical devices
o Glucose meters, heart monitors
Household automation
o Security/temperature controllers
o Smoke/motion detectors
WiFi
Dual Bands: 2.4GHz and 5GHz
802.11a/b/g/n
o Cost vs Speed vs Interference tradeoff
Roaming
Global standard
High speed
o Up to 300 Mbps
High power consumption
o Concern for mobile devices
Range
o Up to 100m
WiFi – example (802.11g)
Protocol Comparisons
Protocol Comparisons
Zigbee/802.1
Bluetooth WiFi
5.4
Moderate -
Range High High
High
Power Low -
Low High
Consumption Moderate
Design requirement of outdoor radios
for IoT applications
Can we use WiFi/Bluetooth/ZigBee/Ant radios to support IoT
applications deployed outdoor?
◼ Can we achieve kilo meter communication distance?
◼ Can we support 3~5 years lifetime with a coin battery?
◼ Can we support the communication with thousands of IoT
devices with the coverage of a base station?
◼ We only need to transmit 100 bits per second data compared
to the mega bits per second case in WiFi
We are wiling to trade data rate for range, lifetime, and the
number of devices supported.
Common Radio Protocols
Radios for indoor applications Radios for outdoor IoT applications