The number of IoT devices is growing exponentially and making the usable frequency spectrum busier than before. Wi-Fi, Bluetooth, and ZigBee operate in the unlicensed 2.4-GHz (2.4 GHz to 2.4835 GHz) Industrial Scientific and Medical (ISM) band. Bluetooth and Wi-Fi are almost non-competing technologies. Each of these have their own applications based on their merits. Many IoT applications require both be present in the same network. Some applications even require both of these technologies to be collocated in the same system. This collocation makes things worse if not handled well.
Devices are considered collocated if the distance between a Wi-Fi and a Bluetooth device is less than two meters. In this case, interference is considered internal. If devices are not collocated, interference is considered external. An internal interference can saturate each receiver, causing issues in communication. In contrast, external interference deals primarily with transmissions at same frequency that can corrupt packets and result in packet loss.
Challenges in coexistence are well-known to mobile phone manufactures and laptop/tablet manufacturers. However, they are often new to IoT developers. Coexistence must not be overlooked while designing systems that have collocated Wi-Fi and Bluetooth. In this article, we will talk about challenges in coexistence, methods that are adapted to address the issue, and best practices that can help both Wi-Fi and Bluetooth perform well while sitting next to each other.
Before we get into the details of Bluetooth/Wi-Fi coexistence, let’s look how each of these technologies use the 2.4GHz band. Both Bluetooth and Wi-Fi use spread spectrum techniques to spread a narrow band signal over a wider frequency band. There are various advantages offered by spread spectrum, including increased resistance to jamming/interference and higher security.
Bluetooth uses frequency hopping spread spectrum (FHSS) to spread the narrow band signal across 79 channels, hopping from one channel to another. It uses 2.402 GHz to 2.48 GHz spectrum and divides it in 79 1-MHz channels (see Figure 1). BLE uses 2-MHz channel spacing and has a total of 40 channels.
[Figure 1 | Bluetooth Channels]
As per 802.11b, Wi-Fi uses direct sequence spread spectrum (DSSS) while all other versions (for example 802.11n) use Orthogonal Frequency Division Multiplexing (OFDM) modulation. With DSSS, a narrow band signal is spread by multiplying it by a high-frequency noise signal (pseudorandom sequence of +1 and -1). At the receiving end, the same pseudorandom sequence is used to regenerate the signal. With OFDM, data is modulated over multiple career frequencies within the channel frequency. Channel width varies based on the Wi-Fi technology specification version. 20 MHz width channels are available in almost all versions (802.11b has 22 MHz channels). Each channel is separated by 5 MHz, for a total of 14 Wi-Fi channels. However, all 14 channels may not be allowed in some countries. For example, only the first 11 channels are allowed by the FCC. Also, out of the allowed channels, only three channels are non-overlapping – channel 1, channel 6, and channel 11. IEEE 802.11n also allows 40 MHz channels in the .4 GHz band. This leaves only one 40-MHz non-overlapping channel.
[Figure 2 | Wi-Fi Channels]
Wi-Fi uses carrier sense multiple access (CSMA) collision avoidance (CA) mechanisms to avoid collision with other devices using the same band. Whenever a Wi-Fi device needs to transmit, the medium access control (MAC) first checks if the channel is free. If it finds the channel is free, it transmits data (see Figure 3). Otherwise, it waits for some time determined by a random backoff factor.
[Figure 3 | Data transmission when channel is free]
This backoff period can be anywhere from 0 to the contention window (CW) size measured in slots. As it is unlikely that two devices will pick the same backoff period, the chances of a repeated collision are minimized. Initially, the devices waits for channels to be idle and then waits based on the distributed coordination function interframe spacing (DIFS). DIFS is a short interframe space (SIFS) + 2*SLOT, where SLOT is the minimum time required for all basic service set (BSS) to hear the transmission. The backoff value is decremented by one after each idle backoff slot. After each TX failure/collision, the contention window size is doubled, up to the maximum contention window size (CWMax). Figure 4 shows a device that finds the channel busy when data is ready to be transmitted. As shown, Sender 1 is using the channel when Sender 2 wants to transmit a frame. As it finds channel busy, Sender 2 waits until the channel is free, then waits for SIFS and starts the contention window. After the backoff timer expires, it transmits the data.
[Figure 4 | Data transmission when channel is busy]
This scheme impacts Wi-Fi performance drastically in an environment that has very high interference either due to noise or other wireless devices. Wi-Fi also adapts data rate based on interference. If packet drop is very high, it adapts to lower data rates to minimize the drop. However, reduced data rate can further complicate the situation by taking longer to transmit small amounts of data. CSMA helps avoid collation with most nodes. However, if there are any hidden nodes in the network that remain undetected during career sense, it can still cause a collision. To address this, collision avoidance is used by Wi-Fi. Whenever a Wi-Fi device transmits, collision will not be detected during transmission. The only way to detect and avoid collision is to wait for an expected response. If an expected response is not heard back by the transmitting node, it indicates a collision. Wi-Fi uses Request to Send (RTS) and Clear to Send (CTS) to avoid collisions. This method helps several Wi-Fi devices co-exist in the same network.
In the next part of this article, I will discuss the basics of Bluetooth and Wi-Fi coexistence, types of coexistence, and adaptive frequency hopping.
The articles that will follow are:
- Connecting things easily and reliably
- Smart Mesh
- Device specifications for IoT
- Security in IoT