In this section we contextualize the experiment carried out in terms of the state of the art and explain the methodology used, highlighting some theoretical aspects that support LoRa technology, as well as the components used to test the experiment.
2.2. Methods and Experiment
LPWANs are used in many different areas, particularly in the Internet of Things, such as environmental monitoring, smart cities, security and many others. As the name suggests, these networks have a relatively large coverage and require low consumption from the devices, but they also have advantages in terms of reduced costs and connectivity in remote or hard-to-reach areas.
Within the realm of LPWANs, there exists a diverse array of options, with the LoRa network emerging as the preferred choice in this project, owing to its distinct advantages when compared to alternative networks.
The LoRa network, short for Long Range network, represents a wireless communication technology originally developed by Semtech [
3]. It exhibits a particular suitability for the remote monitoring and control of sensors and actuators distributed across extensive geographical areas. The network itself is structured around a physical layer implementation, typically adopting a star architecture. This intricate system comprises three key components: the sensor nodes, often referred to as IoT devices, serving as the sensors; the intermediary sensor nodes, known as network gateways; and finally, the LoRa network server [
4].
This network operates on unlicensed frequency spectrum values, which vary depending on the continent, being between 863 MHz and 870 MHz in Europe. These values belong to a band called Industrial, Scientific, and Medical (ISM) which contains free values for the use of industrial, scientific and medical equipment.
In addition to the advantages of being an LPWAN, this network also provides other advantages, such as reduced costs as it is an implementation of the physical layer of the network, using air as a means of communication instead of cables, and operating in unlicensed frequency values.
To prepare the information to be transmitted, it needs to be coded. To do this, LoRa uses Chirp Spread Spectrum (CSS) modulation. CSS modulation encodes information using frequency chirps, where a chirp is a signal that varies linearly in frequency over time. The following figure shows an example of a signal encoded with CSS modulation, where fc is the center frequency of the channel [
5].
Figure 1.
Data coding through chirps (adapted from [
5]).
Figure 1.
Data coding through chirps (adapted from [
5]).
Bearing in mind that this is the physical layer of the network, certain parameters must be taken into account if communication is to be carried out as intended, namely bandwidth (BW), Spreading Factor (SF) and Coding Rate (CR), as these influence the binary rate of the modulation, the resistance of the transmitted signal to interference and noise and the ease with which the received signal can be decoded.
The use of chirps in the coding of the signal to be transmitted allows it to be spread out over the frequency spectrum, i.e. the frequency changes continuously over time, which increases the signal's resistance to noise and interference and gives the advantage of the signal being easily detected in dense urban environments or other areas with various obstacles in the way.
To choose the values of the different parameters, the environment in which the network will be applied must be considered, as well as the distance between the transmitter and receiver. The spreading factor can vary between 7 and 12 depending on this distance, i.e. the closer the transceivers are to each other, the lower the SF value, otherwise the higher the value, because with higher SF values, the processing gain and reception sensitivity increase, however, it also results in a lower binary throughput.
The following table shows the different possible values of the spreading factor and their relationship with the binary throughput, the transmission range, and the time the message spends in the air [
6].
From the point of view of transmission, the spreading factor corresponds to the number of bits that each symbol encodes, and each symbol can be made up of possible values, which corresponds to the entire frequency band.
The BW used is an indication of the channel on which you are operating by measuring the number of frequencies that can be used for data transmission on a given communication channel. The different values of this parameter directly affect the data transmission rate, the modulation rate, and the spreading factor, with higher BW values allowing for a higher transmission rate, but also requiring greater energy consumption for data transmission. As with the choice of values for the spreading factor, the bandwidth values must be chosen according to the needs of the application and considering the environment in question.
As previously mentioned, the LoRa network uses air as a means of communication. This leads to a high probability of error, which can result in various communication failures between the different nodes in the network. To "combat" this obstacle, it is necessary to treat errors, which is done by a technology called Forward Error Correction (FEC).
The CR makes it possible to correct any errors in communication between nodes, as it is a parameter that is directly related to the signal's resistance to noise and the ease with which the symbols can be decoded. The way this correction is carried out is by adding redundancy bits to the transmitted information bits, these bits being represented by a fraction, for example, a CR of 4⁄5 indicates that out of every five bits transmitted, four of these are data bits and one bit is redundancy. Therefore, the higher the CR value, the more reliable the data transmission, but the lower the spectral efficiency (lower transmission rate). Once again, the choice of CR values involves considering the application and the environment in question; however, this choice can be made in real time, which is an advantage compared to the conditions mentioned above [
7].
With the spreading factor, bandwidth and code rate valued, it is possible to determine the binary transmission rate and the period of each transmitted symbol.
This experiment (see
Figure 2) was based on LoRa communication between the two robots, one a transmitter and the other a receiver. As such, there are elements common to both robots, such as the Arduino development board and the LoRa communication module.
The front robot (vehicle A) is made up of an Arduino Mega, while the follower (vehicle B) has an Arduino Uno. This difference stems from the number of sensors incorporated in the former, namely: humidity and temperature sensor, pulse, gas, and ultrasonic.
In vehicle A, include temperature sensor connected to a digital pin on Arduino Mega, Pulse sensor using Inter-Integrated Circuit (I2C) protocol (Serial Data (SDA) and Serial Clock (SCL) pins on Arduino Mega), Gas sensor connected to analog pin using 10 bits Analog Digital Convert (ADC) integrated on microcontroller resident on Arduino Mega board and finally the two ultrasonic sensors connected to digital pins. In vehicle B, ultrasonic sensor, only one, is connected to 2 digital pins on Arduino Uno. For both vehicles we used L298 drive motor, using three bits (corresponding to 3 pins, digital pins for direction of the DC motor and enable pin, that use Pulse Width Modulation (PWM) to modulate velocity of the DC motor) for each DC motor. LoRa module in each Arduino is connected to Serial Peripheral Interface (SPI) pins.
2.2.1. Hardware used for proving of concept
This experiment was based on LoRa communication between the two robots, one a transmitter and the other a receiver. As such, there are elements common to both robots, such as the Arduino development board and the LoRa communication module.
The front robot is made up of an Arduino Mega, while the follower has an Arduino Uno. This difference comes from the number of sensors incorporated in the former, namely: humidity and temperature sensor, pulse, gas, and ultrasound.
Arduino development boards are based on high-performance, low-power RISC microcontrollers. They have flash, EEPROM and SRAM memory. For peripherals, these boards have PWM digital I/O pins, USART and SPI programmable interfaces and analogue pins. The information obtained from the sensors is interpreted by Arduino, which allows the robot's behavior to be adjusted using the algorithm.
Mobile robots adapt their behavior to certain parameters in their environment, so they need to collect this information via sensors. This information is converted into an electrical quantity so that it can be implemented by the microcontroller and control the actuators.
In the driving environment, the eyes are responsible for more than 90 % of the information gathered from the environment, allowing the driver to adjust their behavior and maintain safety. In mobile robotics, there are several ways to ensure that a robot recognizes its environment, from the use of GPS systems, cameras, or sensors, which allow it to dodge obstacles or meet its target.
In this experiment, it was intended that the two robots would each use a pair of HC-SR04 ultrasonic sensors. One would be responsible for dodging obstacles, while the other would act as a follower, simulating a traffic lane with two cars and no obstacles between them.
Figure 3.
Ultrasonic sensor HC-SR04 (adapted from [
8]).
Figure 3.
Ultrasonic sensor HC-SR04 (adapted from [
8]).
Table 1 presents the technical characteristics of HC-SR04 and the pins connected to Arduino board.
Fatigue is one of the main factors in road accidents and can be divided into three categories: cyclical, psychological or physiological [
9]. Cyclic fatigue is caused by too little rest, resulting in drowsiness. In this state, the driver's heart rate begins to slow down. On the other hand, psychological fatigue occurs when there is too much strain on the nervous system, resulting in distraction and, in some cases, an increase in heart rate.
Another factor that can lead to a sudden increase in heart rate occurs in unexpected risk situations, such as losing control of the car due to oil on the floor.
Therefore, for the purpose under study, the decision was made to incorporate a MAX30102 heartbeat sensor into one of the robots so that these variations could be detected and communicated to the robot following so that it could adjust its speed and avoid a collision.
Figure 4.
Pulse sensor MAX30102 (adapted from [
10]).
Figure 4.
Pulse sensor MAX30102 (adapted from [
10]).
Table 2 presents the technical characteristics of MAX30102 and the pins connected to Arduino board.
The humidity and temperature inside a vehicle can affect the driver's health and comfort, and consequently their ability to concentrate and react to stimuli. A hot and humid interior can lead to feelings of tiredness and drowsiness, as the body needs to work harder to regulate the temperature.
Table 3 presents the technical characteristics of DHT11 and the pins connected to Arduino board.
When the interior of the car is cold and damp, limb mobility can be affected, making it difficult to manipulate the steering wheel and pedals, resulting in loss of control of the car. Measuring humidity and temperature can help prevent accidents, especially on long journeys, as fatigue can build up over time. We chose to use the previously mentioned sensor, DHT-11, to monitor these two variables.
There are numerous causes that contribute to increased environmental pollution and consequently poorer air quality, one of the biggest being the burning of fossil fuels by motor vehicles. The emission of these particles fuses with the air we breathe and can cause respiratory health problems. A car's fan consists of a blower that ensures the flow of air from the outside to the inside of the vehicle. It consists of a fan, a drive motor and a device that controls the power. In a traffic queue scenario, the car in front burns fuel and releases gases and toxins through the exhaust, so the air that enters through the fan.
Vehicle exhaust produces a cocktail of harmful gases, one of which is Carbon Monoxide (CO), which is known to cause fatigue and drowsiness [
11].
Table 4 presents the technical characteristics of MQ2 and the pins connected to Arduino board.
In view of this risk, a combustible gas and alcohol detection sensor, MQ2, was used.
Since LoRa is the communication technology implemented in this experiment to achieve point-to-point information exchange between the two robots, we carried out a series of tests on its performance by changing some CSS modulation parameters and in different test environments.
Figure 7.
SX1276 – LoRa module.
Figure 7.
SX1276 – LoRa module.
Table 5 presents the technical characteristics of SX1276 and the pins connected to Arduino board.
Once an SF7 had been established to carry out the experiment, the LoRa communication network payload to be sent from the lead robot to the follower was built. The size of the payload is defined according to the type of variables used to construct the message (int, float, string). The payload has 33 bytes with sensor information, as well as a byte dedicated to informing the direction in which the robot in front has turned.
Since the entire plot is also made up of the preamble and the respective headers, which have predefined sizes, this results in a total size of 69 bytes. Based on the formula presented above, which allows the binary throughput to be calculated using the spreading factor and the coding rate, the following value was obtained for the maximum transmission rate.
The time the message is in the air is influenced by the bandwidth (125 kHz) and the total number of bytes in the plot, so it cannot be directly inferred that we have 713 bytes being transmitted every second. Therefore, when testing the robots, a message transmission interval of half a second was set.
Figure 8.
LoRa frame structure at the physical layer of the network.
Figure 8.
LoRa frame structure at the physical layer of the network.