程序代写 AD 940-981). He was fondly called Blatand, which blue-tooth in Danish, beca

Chapter 10
Bluetooth is the oldest and the most pervasive technology to connect a wide range of devices and ‘things’ around us. Since its inauguration decades ago, it has gone through several upgrades and is continuing to play a dominant role in providing short- range connectivity for smart objects. In this chapter, we cover its history, markets and applications, followed by the core technologies behind the three generations of Bluetooth.
10.1 Bluetooth History
The history of Bluetooth started with Ericsson’s Bluetooth Project in 1994 for radio communication between cell phones over short distances [NIST-BT]. It was named after Danish king Herald “Blatand” Gormsson (AD 940-981). He was fondly called Blatand, which blue-tooth in Danish, because of his dead tooth that looked blue [BT- SIG-ORG].

Copyright By PowCoder代写 加微信 powcoder

Intel, IBM, Nokia, Toshiba, and Ericsson formed Bluetooth SIG in May 1998 [NIST- BT,WIKI-BT]. Soon after, Version 1.0A of the specification came out in late 1999. IEEE 802.15.1, which was approved in early 2002, was based on Bluetooth [NIST- BT]. However, all later versions of Bluetooth were handled by Bluetooth SIG directly.
The key features of the original Bluetooth were low power, low cost, and small form factor. Bluetooth now comes built-in with many systems on chip and microcomputer boards, such as Intel Curie, , Arduino, and so on.
10.2 Wireless Personal Area Networks
Figure 9.1 shows the IEEE networking technologies stacked according to their communication ranges. At the bottom, we have the networks that cover the last 10m. These are collectively referred to as Wireless Personal Area Networks (WPANs), as historically these protocols were designed to serve devices within the vicinity of the person. In the IoT era, with the growing dependence on machine-to-machine communications, the name “personal” may not be very relevant for all scenarios, but the main criteria of 10m coverage will remain. Within WPAN, we have several competing solutions, such as Bluetooth, Zigbee, and Body Area Networks (BANs). In this chapter, we will focus on Bluetooth.

Figure 10.1 Networking technologies with different communication range. 10m or less technologies are at the bottom
All WPAN protocols follow a set of basic design principles:
Battery powered: The devices run on coin cell batteries with a couple of hundred mAh capacity, which has to last for a few years. Maximizing the battery life therefore is one of the major challenges.
Dynamic topologies: Because the devices have to conserve energy, they usually turn on for a short duration and then goes back to sleep. For example, a temperature monitor may wake up every 10 seconds and connects with the WiFi AP to send the temperature reading and then it goes back to sleep again. Therefore, connections are very short.
No infrastructure: They do not depend on any access point or base station.
Avoid Interference: These devices share the same ISM bands, such as 2.4GHz, with the high-power LAN devices, such as WiFi. How to avoid interference with such high-power communications in the same area therefore is a major issue to tackle.
Simple and Extreme Interoperability: As there are billions of devices, we have more variety than LAN or MAN. The interoperability challenge therefore is more severe than LAN or MAN.
Low-cost: Communication technology must be affordable as many low-cost devices, such as a $2 electric bulb may need such communication capabilities.
10.3 Bluetooth market

According to a recent report from Bluetooth SIG [BT-SIG], 48 billion devices will be connected to the Internet by 2021, of those 30% are forecasted to include Bluetooth technology. This includes a wide range of market segments including cars, wearables, factory instruments, and smart home products. The forecast further shows that Bluetooth shipments are expected to grow at a rate of 8% CAGR from 2019 to 2024.
10.4 Bluetooth Versions
Since the first release of Bluetooth 1.1 endorsed by the IEEE in 2002, there have been many updates over the years. The current version is 5.0. Table 10.1 provides a chronological list of Bluetooth versions and their capabilities [NIST-BT, BT-SIG]. Bluetooth versions prior to 4.0 are often referred to as Bluetooth Classic. Bluetooth 4.0 is also known as Bluetooth Smart and Bluetooth Low Energy (BLE).
Table 10.1 Chronological list of Bluetooth versions
Bluetooth Version Bluetooth 1.1 (2002) Bluetooth 1.2 (2003)
Description
IEEE 802.15.1-2002. Classical. Adaptive frequency hopping to avoid frequencies with interference.
Make BLE go faster and farther.
Bluetooth 2.0 + (2004)
Enhanced Data Rate (EDR); 3 Mbps using DPSK. Suitable for video applications. Reduced power due to reduced duty cycle.
Bluetooth 4.0 (2010)
Low energy. Smaller devices requiring longer battery life (several years). New incompatible PHY. A.k.a. Bluetooth Smart or BLE.
Bluetooth 5.0 (2016)
Bluetooth 5.3 (2021)
Faster transitions between low and high duty cycle modes, enhanced key size control between host and controller, more efficient periodic advertisements, channel classification enhancement for arriving at more optimal channel map between peripheral and central devices.
10.5 Bluetooth Classic
We will start with Bluetooth 1.1 to understand the basic details of Bluetooth.
10.5.1 Bluetooth piconet
A Bluetooth network is called a piconet, which is formed by a master device communicating with one or more slave devices [PRAVIN2001]. Any Bluetooth device can become a master. Basically, the device that initiates the communication becomes the master and the devices that respond to the initial call becomes the slaves. For example, when a computer is turned on, it may advertise a message looking for a Bluetooth keyboard. If a nearby keyboard responds and subsequently pairs with the

computer, then the keyboard becomes a slave. Slaves can only transmit when requested by the master. Active slaves are polled by the master for transmissions. Slaves can only transmit/receive to/from the master, i.e., slaves cannot talk to another slave in the piconet. There can be up to 7 active slaves per piconet at a time.
Beyond the active slaves within a piconet, Bluetooth allocates an 8-bit parked address to any device wishing to join the piconet at some time in the future. This allows up to 255 parked slaves per piconet that sleep most of the time but may join the piconet from time to time. All parked stations are then uniquely identifying, and they are usually referred to using some mnemonic identifiers for human use. Any parked stations can join the piconet in 2ms and become active at any time. For other stations which are not parked yet, it usually takes much longer than 2ms to join. Figure 10.2 shows examples of Bluetooth piconets with both active and parked slaves.
Master Active Slave
Parked Slave
Figure 10.2 Bluetooth piconet with active and parked slaves.
For more densely deployed IoT scenarios, Bluetooth can use a more complex network topology, called scatternet, to allow a device to participate in multiple piconets as shown in Figure 10.3. However, for a device to participate in multiple piconets, it has to timeshare and must synchronize to the master of the current piconet, i.e., it can be active in only one piconet and in park mode in the other.

Master Active Slave
Parked Slave
Figure 10.3 Bluetooth scatternet.
Note that there is no routing protocol defined, so nodes can only talk to other nodes which are directly within the Bluetooth communication range of about 10m.
10.5.2 Bluetooth spectrum and channels
Bluetooth operates in the same ISM band of 2.4 GHz as WiFi. Bluetooth classic divides the entire spectrum between 2402-2480 MHz (total 79 MHz) into 79 1-MHz channels as shown in Figure 10.4.
Figure 10.4 Bluetooth classic channels.
10.5.3 Modulation and data rates
Modulation and data rates for Bluetooth classic are classified into two groups, basic rate (BR) and enhanced data rate (EDR).

For BR, it uses a binary frequency shift keying to achieve only 1 bit per symbol. Bluetooth uses a symbol duration of 1μs, which gives 1Mbps for the BR. The EDR also uses 1μs symbols, but it supports more advanced modulations, namely μ/4- DQPSK with 2 bits/symbol and 8DPSK with 3 bits/symbol. Thus, under EDR, Bluetooth classic can deliver 2Mbps and 3Mbps data rates using μ/4-DQPSK and 8DPSK, respectively.
10.5.4. Frequency hopping
Unlike WiFi, Bluetooth constantly switches channel within the same connection to avoid interference with other nearby WiFi or Bluetooth communications using the same 2.4GHz band. Figure 10.5 shows how two Bluetooth networks can share the same frequency band without interfering with each other by hopping between channels (only 4 available channels are shown for illustration purposes). As we can see, the two networks are selecting different channels at each time slot, which avoids interference and collision.
Figure 10.5 Two close by Bluetooth piconets sharing the same frequencies without interreference by hopping between channels; in this ideal hopping scenario, the same channel is never selected by both piconets.
So, how frequently Bluetooth switches the channel? Because it is rather complex to switch the channel within a packet transmission, Bluetooth only changes channels at packet boundaries effectively achieving a frequency hop per packet. No two successive packets are transmitted over the same channel. The effective frequency hopping rate therefore is a function of the packet duration.
In Bluetooth, time is slotted to 625μs using a 3200Hz clock, where 1 slot is determined by 2 clock ticks (1 clock tick = 312.5μs for a 3200Hz clock). Packet transmission can start only at the beginning of a time slot and it can last for 1, 3, or 5 slots. Other packet durations are not permitted.
The communication between the master and slave uses the entire frequency band, so both of them cannot transmit at the same time, i.e., full-duplex communication is not possible in Bluetooth. The master and the slave therefore alternate in using the channel, i.e., they implement half-duplex using time-division duplexing (TDD). Master-to-slave is called downstream and slave-to-master is called upstream. With TDD, downstream and upstream alternates in time.

The slots are numbered starting at zero. Master starts communicating first in slot 0 and the slaves can transmit right after receiving a packet from the master. Given that the allowed packet lengths are only 1, 3, or 5 slots, masters can only use the even numbered slots and the slaves the odd numbered slots. Frequencies switch only at the start of the slot that starts after a packet transmission is completed, which may not align with slot boundaries. Finally, the packet lengths between the master and the slaves may not have to be symmetrical. For example, it is perfectly OK for a master to use a short 1-slot packet, while a slave transmits a 3-slot packet. Figure 10.6 shows such symmetric vs. asymmetric packet lengths. Figures 10.7 illustrates that the minimum and maximum frequency hopping rates in Bluetooth are 320Hz (all packets are 5-slot) and 1600Hz (all packets are 1-slot).

M=master, S = slave
Figure 10.6 Frequency hopping for symmetric vs. asymmetric packet lengths
Figure 10.7 Dependency of hopping rate on the packet length. The maximum and minimum hopping rates are 1600Hz and 320Hz, respectively [BT-RS].
Example 10.1
Consider a Bluetooth link where the master always transmits 3-slot packets. The transmission from the master is always followed up by a single-slot transmission from

a slave. Assuming 625μs slots, what is the effective frequency hopping rate (# of hopping per second)?
Given that frequency hopping cannot occur in the middle of a packet transmission, we only have 2 hops per 4 slots, or 1 hop per 2 slots.
The effective hopping rate = 1/(2x625x10-6) = 800 hops/s = 800Hz
Bluetooth is very popular for listening to music as well as for voice calls with earphones. Such traffic is synchronous generating packets at fixed intervals, where the interval depends on the audio codecs. To support such synchronous traffic, Bluetooth reserves slots ahead of time. For asynchronous traffic, the master simply polls each active station. Note that there is no contention avoidance mechanism; all traffic is controlled by the master. If there are contentions, packets get lost, which are eventually retransmitted by the higher layer.
10.5.5 Bluetooth Packet Format and MAC address
In Bluetooth, packets can be up to 5 slots long. Thus, with 625μs slots, a packet is allowed to last for a maximum of 625×5=3125μs. As BR and EDR have different data rates, their packet formats are also different. The packet format for BR is shown in Figure 10.8, which has only three fields [BT-NI]: It has a 68/72b access code, 54b control header and the rest is payload, which can be up to 2745b. The maximum size of a packet therefore can be 72+54+2745 = 2871b, which lasts for 2871μs when data is transmitted at the rate of 1Mbps.
Figure 10.8 Bluetooth classic packet format for BR
There are 3 types of access codes: Channel access code (CAC) identifies the piconet, Device access code (DAC) is used for paging requests and response, and inquiry access code (IAC) can be used to discover particular Bluetooth devices in the vicinity. CAC is 72 bits long, but DAC and IAC can be either 68 or 72 bits long. There is an 18-bit header comprising member address (3b), type code (4b), flow control (1b), ack/nack (1b), sequence number (1b), and header error check (8b). This 18b Header is encoded using 1/3 rate coding resulting in 54b.
The packet format for EDR is more complex, which is shown in Figure 10.9. A notable feature of an EDR packet is that the modulation changes within the packet. While GFSK is used for the access code and header fields, it switches to DPSK (DQPSK for 2Mbps and 8DPSK for 3Mbps) after a guard interval lasting between 4.75μs to 5.25μs. EDR payload can accommodate more data than BR, but still fits within the maximum 5-slot due to higher data rates.
Access Code (68/72 bits)
Header (54 bits)
0μs 72μs 126μs 2871μs
BR Payload (2745 bits)

Access Code (72 bits)
Header (54 bits)
Sync (30 bits)
Payload Header (16 bits)
EDR Payload Body (8168 bits)
Trailer (6 bits)
0μs 72μs 126μs 131.25μs 142.25μs 147.25μs 2870.25μs 2872.25
Figure 10.9 Bluetooth classic packet format for EDR
How many slots are needed to transmit a Bluetooth Basic Rate packet if the payload is (a) 400 bits, (b) 512 bits, and (c) 2400 bits. Assume that the non-payload
portions do not change.
Bluetooth transmissions are 1, 3, or 5 slots (2, 4, 6, etc. not allowed) Non-payload bits (max) = 54+72 = 126 bits
Each slot can carry 625 bits at most
(a) 400b payload results in 400+126 = 526b packet, which requires 1 slot
(b) 512b payload results in 512+126 = 638b packet for which 2 slots would be sufficient, but will have to be padded for a 3-slot transmission because 2-slot packets are not allowed
(c) 2400b payload results in 2400+126 = 2526b packet which fits in 5 slots
Each Bluetooth device has a unique 48-bit MAC address included in the access code field of the packet header. As shown in Figure 10.10, the most significant 24 bits represent the OUI (Organization Unique Identifier) or the Vendor ID. Typically, the vendors convert each 4b into a decimal number and show the MAC address as a string of 12 decimal digits. For example, Figure 10.11 shows the label of a Bluetooth chip from Roving Networks with a MAC address of 000666422152 where 000666 would uniquely identify Roving Networks. Here, the decimal digits for the most significant bits are written from the left. While the main purpose of the Bluetooth MAC address is for identification and authentication, specific parts of it are also used to seed the frequency hopping pseudorandom generator for synchronizing the master and slave clocks as well as to pair the devices at the beginning, which we shall examine shortly.
Figure 10.10 Bluetooth MAC address format
Example 10.2
Vendor Allocated Vendor ID (OUI)
4b 4b 4b 4b 4b 4b 4b 4b 4b 4b 4b 4b

000666 identifies Roving Networks
Figure 10.11 Example of a real Bluetooth MAC
10.5.6 Pseudorandom frequency hopping
In Bluetooth Classic, frequency hopping is defined by a pseudorandom generating algorithm seeded with the following values from the master device: UAP and LAP of the MAC address, and bits 1-26 (27 bits) of the 28-bit Bluetooth clock. As the master communicates these values to the slaves during connection set-up, the Master and the slaves generate the same frequency hopping patterns and switch to the same frequency values at every instant of the hop. As such, Bluetooth is both time and frequency synchronized at all times as illustrated in Figure 10.12.
Figure 10.13 shows an example trace of pseudorandom frequency hopping between a Bluetooth master and slave device that both uses single-slot packets and uses the first 16 channels for hopping. We can see that with single-slot packets, the master and slave take turns after every 612μs and switch randomly to a new channel within the 16-channel set.
The pseudorandom pattern has a finite length and hence technically it would run out of the original pattern and then repeat itself. To be more precise, with 27 clock bits to define the pattern, Bluetooth pseudorandom pattern would repeat itself after 227 hops, which would take at least 23.3 hours to repeat at the maximum hopping rate of 1600Hz. In practice, the Bluetooth connections last much shorter than 23 hours, hence the pseudorandom sequence is not at risk of being repeated.

Figure 10.12 Time and frequency synchronization of Bluetooth [BT-RS]
Figure 10.13 An example trace of Bluetooth pseudorandom frequency hopping
10.5.7 Adaptive frequency hopping
Because Bluetooth operates in the free unlicensed ISM spectrum, it is likely to face interference from other wireless sources, such as a 2.4GHz WiFi, sharing the same frequency of Bluetooth in the same time period. Especially, the interference from WiFi can be really harmful as WiFi uses much higher transmission power than Bluetooth. Therefore, some of the 79 channels can become unusable at certain times

and should be avoided by Bluetooth during frequency hopping. This is illustrated in Figure 10.14 where a WiFi transmission heavily interferes with the first 20 channels of Bluetooth. A Bluetooth device that always use the 79 channels for hopping would end up with transmitting some packets within those 20 interfered channels at some time causing packet and throughput loss.
Figure 10.14 Collision with WiFi for non-adaptive Bluetooth hopping
The Adaptive Frequency Hopping (AFH) technique was proposed for Bluetooth to avoid hopping into channels that are experiencing interference. Basically, AFH requires a mechanism to measure channel states and mark interfering channels as bad channels when the interference is considered beyond certain threshold. How to implement this is left to the vendors, i.e., it is not part of the standard. Vendors usually measure metrics such as received signal strength (RSS) and signal-to-noise ratio (SNR) etc., to decide whether a channel is good or bad. Then, the hopping is constrained only within the good channels as illustrated in Figure 10.15. The standard specifies that a minimum of 20 channels are needed for hopping, i.e., a maximum of 59 channels can be marked as bad.
Figure 10.15 AFH Illustration: hopping only between good channels [BT-RS]

Because the interference can be dynamic, the set of good chann

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com