## 3 Materials and Methods
### Design and Development of the LoRa Evaluation Experiments
#### 3.3.1 Fixed Distance Experiments  
Initially, three experiments were performed to verify the performance of LoRa subject to specific values of SF, BW, and CR, with the devices in fixed locations. These three initial experiments were designed to select the sets of LoRa settings with the best performance, to use them in the prototype setting (devices inside moving vehicles).  
The initial experiments featured three different distances between the LoRa device and the gateway: 7 m, 20 m and 550 m. Figure 3 illustrates this. In the 550 m experiment, it was necessary to place the gateway at a height of 18.5 m in a building near a road.  
In the first two experiments, all possible settings of the LoRa link were tested: SF was varied between 7 and 12, BW set to either 125, 250 or 500 kHz, and CR set to either 4/5, 4/6, 4/7 or 4/8, for a total of 72 possible combinations. For each setting, a total of 20 packets were sent from a LoRa device, with a pause of 5 s between packets. The following data was recorded for each one of the sent packets:  
* Setting number
* Distance
* Spreading factor
* Bandwidth
* Coding rate
* RSSI
* Information in the received packet  
\begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline \begin{tabular}{c} **Exp.** \\ **Number** \\ \end{tabular} & **Exp. Type** & \begin{tabular}{c} **Distance between** \\ **GW and Devices** \\ **(m)** \\ \end{tabular} & \begin{tabular}{c} **Number** \\ **of Devices** \\ \end{tabular} & \begin{tabular}{c} **Number of** \\ **Settings** \\ **Used** \\ \end{tabular} & \
\begin{tabular}{c} **Settings Not** \\ **(km/h)** \\ \end{tabular} &
\begin{tabular}{c} **Max. Speed** \\ **between** \\ **packets (sec)** \\ \end{tabular} \\ \hline
1 & Fixed distance & 7 & 1 & 72 & 0 & 0 & 5 \\
2 & Fixed distance & 20 & 1 & 72 & 0 & 0 & 5 \\
3 & Fixed distance & 550 & 4 & 44 & 28 settings were discarded & 0 & 10 \\  & & 255–1245 (the & & & 28 settings were & & \\
4 & Variable distance & vehicle traveled & 1 & 44 & 28 settings were discarded & 20 & 10 \\  & & 1100 m) & & & & & \\
5 & 255–1245 (the & & & 27 settings were & & \\
5 & Variable distance & vehicle traveled & 3 & 17 & discarded & 20 & 10 \\  & & 1100 m) & & & & & \\
6 & Variable distance & 60–900 (the vehicle traveled 1800 m) & 3 & 17 & 27 settings were discarded & 60 & 7 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Characteristics of the performed experiments.  
A total of 44 settings out of the initial 72 were chosen to perform Experiment 3. Such chosen settings were the ones that had the best results in the two previous experiments, regarding the percentage of packets received and the average RSSI level received at the gateway. In Experiment 3, four LoRa devices were used. At the start of the experiment, packets were sent from only one of the LoRa devices and the other devices were added to the experiment one by one, every five seconds. The packet sending frequency was one packet every ten seconds. Twelve packets were sent from each one of the four LoRa devices. At the end, the devices were disconnected one by one, every five seconds. Once the delivery of the packets of the three devices for a setting was finished, a new setting was configured into each of the devices and the gateway, and packet delivery was started again. Figure 4 shows the location of the gateway and LoRa devices (on a map) in Experiment 3.