ES Lecture 05

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

Lecture 05: Embedded System

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

• Simplest is Envelope Detection


o Detect changes in carrier freq.
o Complex require synchronization
• All require filtering
• Signals must be demodulated

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

• Why so many protocols for indoor and


outdoor applications?

• All radios have to make tradeoffs


o Short vs. long distance
o High vs. low power/energy
o High vs. low speeds
o Large vs. small number of devices
o Device-to-device, device-to-infrastructure
o Indoor vs. outdoor usages
24
Common Radio Protocols
Radios for indoor applications Radios for outdoor IoT applications
• Design requirements
 Design requirements – Long range
◼ Short range – Low data rate
– Large number of devices
◼ High data rate
– Low energy consumption
◼ Small number of • Common protocols
devices – GSM/GPRS
 Common protocols – LTE
◼ Bluetooth/Low Energy • Emerging protocols
– Sigfox/LoRA
◼ ZigBee – Narrow band LTE
◼ Ant – Backscatter
◼ WiFi
Bluetooth
• Radio band: 2.4-2.48 GHz
• Average 1 Mbps - Up to 3 Mbps
• Supports point-to-point and point-to-multipoint
o Creates personal area networks (PANs/Piconets)
o Connects up to 8 devices simultaneously
• Minimal interference between devices
o Devices alter frequencies arbitrarily after packet exchanges -
up to 1600 times/second - frequency hopping
• 3 classes of Bluetooth transmit power
Bluetooth Applications
• Wireless communication between devices
o Mobile phones, laptops, cameras, gaming controllers,
computer peripherals, etc
• Short range sensor transmission
• Share multimedia - pictures, video, music
• A2DP - Advanced Audio Distribution Profile
o Stream audio wirelessly
What tradeoffs were made?
The protocol is designed for transmitting tiny data
 4 operations: Read, Write, Notify, Indicate
 Maximum of 20 bytes of data per packet

From: How Low Energy is Bluetooth Low Energy - Siekkinen et al.

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?

• Low Power, Cost, and Size


• Straightforward configuration
• Good support and documentation
• Lots of products already on the market
• Mesh Networking
• Lends itself well to many different applications
• Very low wakeup time
• 30mS (Zigbee) vs. up to 3S (Bluetooth)

30
• Competes with Wi-Fi for bandwidth..
◼ Only four usable bands in Wi-Fi intensive scenarios

Image & Data Source


<http://fosiao.com/system/files/misc/zigbee.wifi_.channel.jpg>
31
Zigbee is usually used in mesh networks
 A mesh network consists of a series of nodes.

 Each node must acquire and transmit


its own data, as well as act as a relay for
other nodes to propagate data.

 ZigBee devices often form Mesh Networks.

 Examples: Wireless light switching, Music school


practice rooms.

Image Source:32
<http://kf5czo.blogspot.com/2012/03/ham-radio-and-mesh-
Mesh Networking

• Advantages of Mesh Networking:


 Allows devices to communicate to multiple other devices
in the network.
 Multiple paths to destination – greater flexibility against
interference.
 Allows overall network to grow to larger physical sizes
than possible with point-to-point networks.

• 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

Speed Moderate Low High

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

 Design requirements • Design requirements


◼ Short range – Long range
◼ High data rate – Low data rate
◼ Small number of – Large number of devices
devices
– Low energy consumption
 Common radios • Emerging radios
◼ Bluetooth
– Sigfox
◼ ZigBee
– Narrow band LTE
◼ WiFi
– Backscatter
Design requirement of outdoor radios for IoT applications

Power Indoor radios Range


IoT radios

IoT radios Indoor radios

Data rate Data rate

Number Life time


IoT radios IoT radios
of devices

Indoor radios Indoor radios

Data rate Data rate


SIGFOX
 Deploy its own base stations to support IoT
applications
◼ Kilo meter communication distance
◼ Connect thousands of devices
◼ 100 bits per second date rate
◼ 5 years life time
SIGFOX
 REPETITION OF THE MESSAGE
◼ Each message sent 3 times
◼ Repetition at 3 different time slot = time diversity
◼ Repetition at 3 different frequencies = frequency diversity
 COLLABORATIVE NETWORK
◼ Network deployed and operated to have 3 base stations
coverage at all times = space diversity
 MINIMIZATION OF COLLISIONS
◼ Probability of collisions are highly reduced
◼ Ultra Narrow Band
◼ 3 base stations at 3 different locations
Ultra Narrow Band
 Reduce the transmitted signal bandwidth
◼ Reduced noise power
◼ Therefore, we can reduce the transmission power
◼ Therefore, we can reduce the power consumption of
radio communication
Ultra Narrow Band
ULTRA NARROW BAND ALLOWS HIGH CAPACITY
@ 10message/day/device = 1.8M devices per base station

200 simultaneous messages within a 200kHz channel

COLLABORATIVE NETWORK AND REPETITIONS ALLOW HIGH


NB-IoT LTE

You might also like