Data link layer

The data link layer contains the physical principles that are exploited to transmit information and send messages on a network. The choice of a given communication mean is crucial and will influence different parameters of a communication. This section describes the different key parameters of a data layer, and how their choice can influence the communication.

OOK and 64-QAM modulation schemes
The modulation is the way that information (i.e. binary encoded data) is translated into an electrical signal before it can be sent on a physical channel. We will analyze two major types of modulation, and describe their main differences. Aside their complexity level, these modulations have two main differences: their bandwidth efficiency and their noise robustness. Indeed, QAM modulation exploits at best the bandwidth by using two shifted carrier waves, resulting in a very good efficiency. In comparison, OOK with its very simple algorithm provides a significantly lower efficiency. On the other hand, OOK modulation is more robust to noise than QAM. This means that for the same noise level, OOK will have lower error rate than 64-QAM modulation. This can be seen on the following figures, representing on the X axis the signal-to-noise ratio (higher means less noise) and on the Y axis the error rate. So the choice will be influenced mainly by the noise level of the communication environment: if there is too much noise, a robust modulation such as OOK will be preferable but with less noise it will be better to improve efficiency with modulation schemes such as 64-QAM.
 * On-off keying (OOK) is a very simple amplitude modulation. It consists of multiplying the carrier wave by the bit sequence that is to be sent, resulting in the carrier being switched on and off depending on the binary information.
 * Quadrature amplitude modulation (QAM) is a more complex modulation. It consists of modulating two carrier waves with a phase shift of pi/2, each containing a part of the information. The two waves are then combined to form the signal that is to be sent.

Carrier frequency
The carrier frequency is the base frequency of the wave used to transmit data. This parameter must be chosen wisely because it influences different features of the communication: Moreover, the use of different bandwidths is regulated. Licenses are required to be allowed to use specific bands of the spectrum. That's why most IoT communications use the ISM bands, because they are license-free and so are less expensive to develop.
 * Range: high-frequency waves have shorter ranges. This effect is mainly due to diffraction on obstacles, and is expressed in Friis formula: the attenuation on a traveling wave is related to the traveled distance and to its frequency.
 * Antenna size: to maximize emission power, the size of the antenna must be a multiple of the carrier wavelength. This creates a resonating environment that improves the transmission. As the wavelength is the inverse of the frequency, the choice of the frequency is directly linked to the size of the antenna that must be used.
 * Data rate: high frequency communications allow higher data rates. Indeed, data rate increases with bandwidth and there is more "room" at high frequencies to use large bandwidths. It means that if you put 10 channels between 1MHz and 2MHz (high frequencies), their bandwidth will be 0.1MHz. But if you put 10 channels between 1kHz and 2kHz (low frequencies), their bandwidth will be 0.1kHz, much lower than the previous one and thus allowing lower data rate.

Single-hop and multi-hop
In a network, a message can be sent directly to its target or can transit by multiple hosts before reaching its final destination. These two strategies are very different from each other and are called single-hop and multi-hop.

In single hop, the communication between two hosts is direct. There is no intermediary between the sender and the receiver. In multi-hop networks, messages are sent to the closest host and are relayed host by host until they reach their destination. This process requires more complex routing as the message will go through multiple hosts between the sender and the receiver. However, it can be very power-efficient in some configurations: the total sending power required to transmit a message on several small paths is lower than the power required to send a message on one long path. This is due to the fact that attenuation is not linearly proportional to traveled distance. But the complex routing of multi-hop networks also requires power, and depending on the situation this strategy can prove to be more ore less efficient than single-hop.

Ad-hoc and infrastructure networks
Ad-hoc and infrastructure modes are two different ways to structure a network. They each posses advantages and drawbacks, and they are explained here.

Infrastructure networks are based on a central access point of the network. All the communications go through this global arbiter, or to the multiple entities assigned to that role. This means that the networked is based on a well defined infrastructure, built on the different "arbiters". This structure allows for a lot of security and control, since all messages must transit by at least one of the arbiters. However it is very rigid and requires a set-up process before being able to use a network.

Ad-hoc networks do not used fixed infrastructures. They are based on dynamic routing, where the nodes collaborate to establish a network map and routing instructions. These networks adapt when some hosts are connected or removed, meaning that they do not rely on fixed arbiters. All the hosts can act as clients or as access points, their role changing depending on the communication. These networks have the advantage to be dynamically set up. They can run everywhere without requiring an infrastructure. However, dynamic routing is more complex, and sharing the medium between multiple hosts without using a fixed arbiter can lead to collisions and security leaks.

Both ad-hoc and infrastructure networks have multiple possible topologies.

Medium sharing
Medium sharing is the strategy used to use the same medium for multiple hosts and multiple communications. There are different ways to allow several communications on one medium without having collisions. The three main ones are:
 * Time Division Multiplexing: all hosts speak on the same medium but at different times. The time slots allowed for different communications can be statically fixed or dynamically attributed by an arbiter (e.g. Aloha mechanism, beacons, RTS)
 * Frequency Division Multiplexing: all hosts are allowed to communicate at the same time but they use different frequencies. The messages do not collide because they are not in the same bandwidth
 * Code Division Multiplexing: all hosts are allowed to communicate simultaneously and at the same frequency, but their data coding is different for each communication. The codes are chosen to be orthogonal so that if two simultaneous messages are received, decoding will occur without interferences between the communications.

Categories
The different communication technologies used in the IoT combine these main parameters to provide different performances. They can be sorted into categories depending on the situation they fit the best. The different main categories are:
 * (W)PAN
 * BAN
 * LPWAN
 * WHAN
 * WSN