# Collision Detection in LoRaWAN Using Machine Learning

Nabil Abdoun, Samira Abboud, Haya Altaleb, Zoltán Rajnai

► To cite this version:

Nabil Abdoun, Samira Abboud, Haya Altaleb, Zoltán Rajnai. Collision Detection in LoRaWAN Using Machine Learning. 2024 IEEE 22nd Jubilee International Symposium on Intelligent Systems and Informatics (SISY), Sep 2024, Pula, France. pp.1 - 6, 10.1109/sisy62279.2024.10737620. hal-05514703

HAL Id: hal-05514703

https://hal.science/hal-05514703v1

Submitted on 17 Feb 2026

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons CC BY 4.0 - Attribution - International License
# Collision Detection in LoRaWAN Using Machine Learning

## Conference Paper · September 2024

DOI: 10.1109/SISY62279.2024.10737620

### CITATIONS

0

### READS

47

### 4 authors:

<figure><img src="image_2.png" /><figcaption>**Nabil Abdoun**
Lebanese American University</figcaption></figure>

17 PUBLICATIONS 116 CITATIONS

SEE PROFILE

<figure><img src="image_3.png" /><figcaption>**Haya Altaleb**
Óbudai Egyetem</figcaption></figure>

20 PUBLICATIONS 44 CITATIONS

SEE PROFILE

<figure><img src="image_4.png" /><figcaption>**Samira Abboud**
Ecole Super Elect Ouest ESEO, F-49107 Angers, France</figcaption></figure>

6 PUBLICATIONS 34 CITATIONS

SEE PROFILE

<figure><img src="image_5.png" /><figcaption>**Zoltan Rajnai**
Óbudai Egyetem</figcaption></figure>

113 PUBLICATIONS 742 CITATIONS

SEE PROFILE
# Collision Detection in LoRaWAN using Machine Learning

Nabil Abdoun, Department of Liberal Education, School of Arts and Sciences, Lebanese American University
(LAU), Beirut, Lebanon, nabil.abdoun@lau.edu.lb

Samira Abboud, Department of Computer Science, École Supérieure d'Électronique de l'Ouest (ESEO), Angers,
France, samira.abboud@eseo.fr

Haya Altaleb, Bánki Donát, Faculty of Mechanical and Safety Engineering, Óbuda University, Budapest,
Hungary, haya.altaleb@uni-obuda.hu

Zoltán Rajnai, Bánki Donát, Faculty of Mechanical and Safety Engineering, Óbuda University, Budapest,
Hungary, rajnai.zoltan@bgk.uni-obuda.hu

## Abstract—

In this paper, we investigate the application of machine learning techniques as a productive solution for carrying out LoRaWAN packet collision detection. Our focus is on a common channel that is shared by several LoRa end-devices via the asynchronous ALOHA protocol, with the aim of delivering data packets in IoT scenarios. We evaluate the effectiveness of two algorithms in this setup: Random Forest and Decision Tree. Higher efficiency is exhibited for identification and likelihood of False Positive Rate, even when packets transmissions collide.

## Index Terms—
LoRa, LoRaWAN, Machine Learning, Packet Detection, Packet Collision

## I. INTRODUCTION

CONNECTING a variety of objects to the Internet to facilitate data exchange and communication is known as the Internet of Things (IoT). IoT makes it possible to seamlessly merge the digital and physical worlds, changing a number of industries and sectors like industrial automation, transportation, healthcare, and agriculture. Many technologies have arisen in IoT networking to meet the various needs of IoT applications. These technologies include Long-Range Wide Area Networks (LoRaWAN) [1], [2], one of the most popular low-power wide area network (LPWAN) technologies that has attracted a lot of attention lately because of its capacity to offer low-power with long-range communication. The physical layer known as Long Range (LoRa) is primarily based on chirp spread spectrum (CSS) modulation, which enables it to achieve low power consumption and long range. LoRaWAN is the medium access control layer (MAC) that facilitates communication between LoRa gateways (GW) and end-devices (ED) in an effective manner. Furthermore, LoRaWAN is a scalable solution for IoT deployments because it provides features including bi-directional communication, strong security, and adaptive data rate (ADR) for effective resource management. LoRa and LoRaWAN are transforming the IoT environment by providing organizations and industries with seamless connection and allowing creative IoT applications across multiple sectors. These technologies are notable for their long range and low power consumption.

LoRa operates in the ISM bands (EU: 868 MHz and 433 MHz, USA: 915 MHz and 433 MHz) [3]. It offers different

configurations (data rates, transmission range, energy consumption and resilience to noise) according to the selection of five parameters which are Transmission Power (TP), Carrier Frequency (CF), Bandwidth (BW), Spreading Factor (SF) and Coding Rate (CR).

LoRaWAN Data rates (DR) for Europe range from 0.3 kbps to 50 kbps. For DR0 to DR5, the bandwidth of the channel is equal to 125 kHz, and for DR6, it is equal to 250 kHz. SF12 is used for DR0, and the SF is decreased by one for each increase of the DR, until DR5 (included). For DR6, SF7 is used [4]. The time on air (ToA), which represents the time for transmitting a packet, increases when the SF increases and vice versa. Therefore, the SF impacts the communication performance of LoRa. Larger SF increases ToA, which increases power consumption, reduces DR, and improves communication range [5].

## II. MACHINE LEARNING ALGORITHMS FOR LORAWAN
PACKET COLLISION DETECTION

Machine Learning (ML) is a subset of Artificial Intelligence (AI) that focuses on building systems capable of learning from data, identifying patterns, and making decisions with minimal human intervention. In the context of IoT and wireless communication, ML techniques can significantly enhance the performance and efficiency of networks by enabling the automatic detection and classification of signals. This section provides a brief overview of the two machine learning techniques used in this study: Random Forest (RF), and Decision Tree (DT). We chose these two ML techniques to focus our investigation and analysis on the application of machine learning to LoRaWAN packets' collision. These techniques provide a solid foundation for understanding the impact of ML in this context. We plan to explore other techniques in a future extension of this paper. Due to its immense scope and complexity, a good introduction to ML is way beyond the reach of this paper. Instead, to help in understanding the primary outcomes of our study, we present a brief review of the two algorithms, we use in this paper for LoRa packet recognition, emphasizing their key characteristics [6].

Supervised learning is the most common type of ML, where
the model is trained on a labeled dataset. Each training example is paired with an output label, and the algorithm learns to map inputs to the corresponding outputs. Supervised learning can be further divided into classification and regression tasks. In this paper, we focus on classification tasks where the goal is to identify whether a LoRa packet is detected correctly or not.

## A. Overview of Machine Learning Algorithms

1) **Decision Tree Algorithm Description:** A Decision Tree is a non-parametric supervised learning method used for classification and regression. It builds a model in the form of a tree structure, where each internal node represents a "test" on an attribute, each branch represents the outcome of the test, and each leaf node represents a class label. The paths from the root to the leaf represent classification rules. Decision Trees are easy to interpret and visualize, and they work well with large datasets. However, they are prone to overfitting, which can be mitigated by techniques such as pruning or by using ensemble methods like Random Forest [7].

2) **Random Forest Algorithm Description:** Random Forest is an ensemble learning method that constructs a multitude of decision trees during training and outputs the class that is the mode of the classes of the individual trees. It combines the simplicity of decision trees with improved accuracy by reducing overfitting. The algorithm works by creating multiple decision trees using different subsets of the training data and averaging their predictions. This approach provides a high accuracy, making it suitable for complex tasks such as LoRa packet detection [8].

## B. Application in LoRa Packet Collision Detection

By leveraging these machine learning techniques, we aim to improve the detection accuracy and reliability of LoRa packets in a crowded communication environment [9]. In the subsequent sections, we will delve deeper into the specifics of how these algorithms are applied and evaluated in our study.

1) **Decision Tree:** In the context of LoRa packet detection, DT algorithms offer a straightforward and interpretable approach for handling the classification tasks involved.
Here's how DT is applied in our study:
Raw signals from LoRa end-devices are processed to extract relevant features such as signal strength, frequency, bandwidth, spreading factor, and time on air, which are then labeled to indicate whether a LoRa packet is correctly detected or not. The labeled dataset is divided into training and testing sets, where the training set is used to build the DT model by recursively splitting the data based on feature values that maximize the separation between different classes at each node. This process continues until the terminal nodes or leaves represent the final classification outcomes. The trained DT model is evaluated on the testing set to measure its performance in terms of accuracy, precision, recall, f1-score and specificity, providing insights into how well the model detects LoRa packets under various conditions, including instances of packet collisions.

One of the key advantages of using DT in LoRa packet detection is its interpretability; the tree structure allows us

to easily understand the decision-making process and the importance of different features. Additionally, DTs are computationally efficient, making them suitable for scenarios where quick decision-making is required. However, DTs are prone to overfitting, which can be mitigated through techniques such as pruning or by setting a maximum depth for the tree.

By applying Decision Tree algorithms, we achieve an interpretable and efficient method for detecting LoRa packets, contributing to the reliability of IoT communications in varied environments. In the next subsection, we will explore the application of Random Forest in LoRa packet detection.

2) **Random Forest:** In the context of LoRa packet detection, Random Forest offers several advantages due to its ability to handle large and complex datasets with high-dimensional features.

Here's how RF is applied in our study:

Raw signals from LoRa end-devices are processed to extract relevant features such as signal strength, frequency, bandwidth, spreading factor, and time on air, which is then labeled to indicate whether a LoRa packet is correctly detected or not. The labeled dataset is divided into training and testing sets, where the training set is used to build the RF model by constructing multiple decision trees using the training data, each employing a random subset of features at each node to determine the best split. The RF algorithm then aggregates the predictions from all individual trees to form the final model. The trained RF model is evaluated on the testing set to measure its performance in terms of accuracy, precision, recall, and false positive rate, providing insights into how well the model detects LoRa packets under various conditions, including instances of packet collisions.

The ensemble approach of RF enhances the accuracy of packet detection, even in noisy environments with high interference. The randomness in feature selection and bootstrap sampling makes RF robust to noise and variations in the data, and RF effectively manages the high-dimensional feature space associated with LoRa signals, ensuring reliable detection performance. By leveraging the strengths of Random Forest, we achieve a reliable and accurate method for detecting LoRa packets, making it suitable for real-world IoT applications where communication environments can be unpredictable and challenging.

## C. Proposed Model with Scenarios

We consider a scenario in which multiple EDs connect to shared channels and send data packets to multiple gateways. End-devices send data packets asynchronously while the access to the medium is controlled by a straightforward ALOHA protocol. Large amount of end-devices may generate and transmit amounts of information toward a gateway in an uncoordinated manner. The gateway will detect the preamble of the packet sent from an ED. As previously indicated, LoRaWAN schedules up-link transmissions from EDs using a light MAC protocol based on Pure ALOHA. It is a straightforward multiple access protocol where a packet is transmitted without network coordination each time the ED has data to send while respecting a duty cycle.
Therefore, a collision will happen if two or more nodes transmit data at the same time. The frequency of collisions increases with the number of EDs in the network. As a result, this circumstance raises the packet error rate, which lowers network capacity as well as the overall performance; therefore, packet loss will further increase. In LoRa, frame collisions happen when two or more packets overlap in time and use the same LoRa parameters, i.e. the same SF, BW, and CF. Thanks to capture effect found in LoRa modulation, a packet received with a higher power level, at least 6 dB stronger, can still be decoded during collision [10]. In this paper, we consider the following two scenarios (see 1):

(a) Collision free: where no collisions are detected.

(b) Collision detection: where one or more collisions are detected between at least 2 LoRaWAN packets due to multiple transmissions overlapping in time and occurring with the same parameters as previously explained.

<figure><img src="image_6.png" /><figcaption>(a) Collision free</figcaption></figure>

<figure><img src="image_7.png" /><figcaption>(b) Collision detection</figcaption></figure>

<caption>Fig. 1. Illustration of our two considered scenarios.</caption>

## D. Methodology and Experimental Setup

In this section, we outline the comprehensive framework used to investigate the application of machine learning techniques for LoRa packet detection. We begin by describing the LoRaWAN simulation environment, which replicates real-world IoT conditions. Next, we detail the processes of data collection and preprocessing, essential for preparing high-quality datasets for model training. We then explain the training and testing protocols followed for each machine learning algorithm, ensuring consistency and robustness in our evaluations. Finally, we discuss the evaluation metrics used to measure the performance and effectiveness of our models in detecting LoRa packets under various conditions [11].

1) *Dataset and Preprocessing:* The LoRaWAN at the Edge Dataset (LoED)[12], an open dataset of LoRaWAN packets collected at gateways over a 4-month period from smart city applications and research deployments, was utilized as a case study in this work. We selected the LoED dataset due to its size and comprehensiveness, making it one of the most extensive datasets available, as identified through a thorough literature review. This unique dataset encompasses traffic from a variety

of IoT applications and is publicly accessible at [13]. Each data trace consists of multiple fields, with the most critical ones presented in Table I.

The dataset records all packets received by nine gateways covering different districts of London, regardless of the originating device or application. The dataset comprises 1,263,001 entries, capturing signals from numerous LoRa EDs. Key features extracted from these collected packets include RSSI signal strength, frequency, bandwidth, spreading factor, and size [14]. Each signal is labeled to indicate whether a LoRa packet is in collision or not, resulting in a labeled dataset suitable for supervised learning.

Data preprocessing involved several steps to ensure the dataset's quality and usability. We addressed missing or inconsistent data points using imputation and cleaning techniques, specifically imputing missing values in one column with the mean of that column. The dataset was then divided into training and testing sets using a typical 80-20 split to maintain a balanced and representative sample for model evaluation. Notably, 10,000 samples per class were used, as illustrated in Figure 1, both before and after imputation.

<table><caption>TABLE I
LOED DATASET.</caption><thead><tr><th>time</th><th>Time at which the packet was received</th></tr></thead><tbody><tr><td>physical payload</td><td>Payload received</td></tr><tr><td>gateway</td><td>Gateway where the packet was received</td></tr><tr><td>frequency</td><td>Radio frequency of the packet</td></tr><tr><td>spreading factor</td><td>Spreading factor of the packet</td></tr><tr><td>bandwidth</td><td>Bandwidth of the received packet</td></tr><tr><td>rssi</td><td>RSSI value at packet reception</td></tr><tr><td>snr</td><td>SNR value at packet reception</td></tr><tr><td>device address</td><td>Device address for the packet</td></tr></tbody></table>

2) *LoRaWAN Simulation Environment:* To assess the effectiveness of ML in detecting LoRaWAN collisions, we utilized the LoED dataset, which represents a typical IoT environment where multiple LoRa end-devices communicate with gateways using the asynchronous ALOHA protocol. The simulation was designed to account for key factors influencing signal transmission, such as channel conditions, interference, and packet collisions. It was configured to operate within the ISM bands (EU: 868 MHz and 433 MHz, USA: 915 MHz and 433 MHz) and included various settings for data rates, transmission ranges, and spreading factors. By closely replicating real-world conditions, this simulation environment offers a reliable platform for testing and validating our ML models.

3) *Training and Testing Protocol:* For each machine learning algorithm, we adhered to a standardized training and testing protocol. The training set was utilized to build the models, with hyperparameters optimized through cross-validation to enhance performance. Specifically, for the Random Forest and Decision Tree models, this involved selecting the appropriate number of trees and maximum depth, respectively. In the case of Random Forest, 500 trees were used, while the Decision Tree model was configured with a maximum depth of 7. Following training, the models were evaluated on the testing set to measure their performance. This approach ensured consistency and comparability of results
across different algorithms [15].

4) *Evaluation Metrics*: To comprehensively evaluate the performance of our machine learning models in detecting LoRa packets, we employed several evaluation metrics. Accuracy, precision, f1-score and recall were used to measure the models' ability to correctly identify true positives and minimize false positives and false negatives. The false positive rate (FPR) was particularly important in assessing the reliability of packet detection in noisy environments with high interference. Additionally, we analyzed the models' performance under varying conditions of packet collisions to understand their robustness and adaptability. These metrics provided a detailed and nuanced view of each algorithm's strengths and weaknesses, guiding our selection of the most effective model for real-world IoT applications. By systematically setting up our simulation environment, meticulously preprocessing our data, rigorously following training and testing protocols, and employing comprehensive evaluation metrics, we ensured that our study provides reliable and actionable insights into the application of machine learning techniques for LoRaWAN packets' collision detection.

### E. Performance Analysis

The performance analysis of our machine learning models for LoRa packet detection involves evaluating their accuracy, efficiency, and robustness under various conditions. We meticulously measured these aspects to determine the practical applicability and reliability of the Random Forest, and Decision Tree algorithms in real-world IoT scenarios [16].

1) *Accuracy and Efficiency*: The accuracy of each model was assessed by comparing the predicted packet detection against the actual labeled data [17]. Random Forest demonstrated the highest accuracy, consistently outperforming the other models due to its ensemble learning approach, which combines the outputs of multiple decision trees to improve prediction accuracy. Decision Tree, while straightforward and interpretable, showed slightly lower accuracy compared to Random Forest, primarily due to its tendency to overfit the training data. Efficiency was another critical factor, with Decision Tree models being the fastest to train and predict, followed by Random Forest.

2) *False Positive Rate*: The false positive rate (FPR) is a crucial metric in packet detection, indicating the proportion of non-packet signals incorrectly identified as packets. A low FPR is essential for reliable communication, especially in noisy environments. Random Forest exhibited the lowest FPR among the two models, benefiting from its robustness to noise and variability in the data. Decision Tree had a higher FPR, reflecting its sensitivity to overfitting. These results highlight the importance of selecting a model that balances detection accuracy with minimizing false alarms.

### F. Comparative Analysis of Algorithms

A comparative analysis of the Random Forest, and Decision Tree algorithms revealed distinct strengths and weaknesses. Random Forest has proven to be more balanced than Decision Tree, offering high accuracy and low FPR, making it suitable

for complex and noisy environments. Its ensemble approach mitigates the overfitting issues seen with individual decision trees. Decision Trees, while easy to interpret and computationally efficient, struggled with overfitting and higher FPR. However, their simplicity and speed make them viable for scenarios requiring quick, interpretable decisions.

As demonstrated in Table II, the Random Forest (RF) algorithm consistently outperformed the Decision Tree (DT) algorithm across all evaluation metrics. The RF model achieved a precision of 0.95, recall of 0.92, accuracy of 0.96, f1-score of 0.93, and specificity of 0.98. These results indicate that the RF algorithm is more effective at accurately identifying collisions while minimizing the occurrence of both false positives and false negatives.

Packet collisions are a common challenge in LoRaWAN networks, affecting the reliability of packet detection. Our analysis showed that the two machine learning models experienced some degradation in performance under high collision scenarios. However, Random Forest demonstrated better resilience compared to Decision Trees. Random Forest's ability to aggregate multiple decision paths helped maintain accuracy. Decision Trees, on the other hand, were more susceptible to performance drops due to their deterministic nature and lack of inherent mechanisms to handle variability. These findings underscore the need for robust algorithms in LoRaWAN environments to ensure reliable packet detection amidst frequent collisions.

<table><caption>TABLE II
PERFORMANCE METRICS FOR DECISION TREE AND RANDOM FOREST ALGORITHMS.</caption><thead><tr><td>Metric</td><td>Random Forest (RF)</td><td>Decision Tree (DT)</td></tr></thead><tbody><tr><td>Accuracy</td><td>0.96</td><td>0.90</td></tr><tr><td>Precision</td><td>0.95</td><td>0.79</td></tr><tr><td>Recall</td><td>0.92</td><td>0.85</td></tr><tr><td>F1-score</td><td>0.93</td><td>0.82</td></tr><tr><td>Specificity</td><td>0.98</td><td>0.92</td></tr></tbody></table>

## III. CONCLUSION

In summary, our results demonstrate that Random Forest outperforms Decision Tree for LoRa packet detection, providing a superior balance of accuracy, efficiency, and robustness. Although Decision Trees are less accurate, they offer advantages in speed and interpretability. Looking ahead, we plan to explore Neural Networks, which, despite their resource-intensive nature, are anticipated to deliver high accuracy and adaptability to complex patterns. Understanding the strengths and limitations of each algorithm is crucial for selecting the most suitable model based on specific application needs and environmental conditions.

## REFERENCES

[1] Lorawan 1.1 specification. LoRa Alliance, 11:2018-04, 2017.

[2] Alexandru Lavric and Adrian Ioan Petrariu. Lorawan communication protocol: The new era of iot. In 2018 International Conference on Development and Application Systems (DAS), pages 74-77. IEEE, 2018.

[3] Isa Avci and Murat Koca. Cybersecurity attack detection model, using machine learning techniques. Acta Polytechnica Hungarica, 20(7):29-44, 2023.
[4] Samira Abboud and Nabil Abdoun. Enhancing lorawan security: An advanced aes-based cryptographic approach. *IEEE Access*, 2023.

[5] Victor Malumbres, Jose Saldana, Gonzalo Berné, and Julio Modrego. Firmware updates over the air via lora: Unicast and broadcast combination for boosting update speed. *Sensors*, 24(7):2104, 2024.

[6] Nabil Abdoun and Mohammad Chami. Automatic text classification of pdf documents using nlp techniques. In *INCOSE International Symposium*, volume 32, pages 1320–1331. Wiley Online Library, 2022.

[7] B Barros, B Conde, M Cabaleiro, and B Riveiro. Design and testing of a decision tree algorithm for early failure detection in steel truss bridges. *Engineering Structures*, 289:116243, 2023.

[8] Qingyuan Cai, Peng Li, and Ruchuan Wang. Electricity theft detection based on hybrid random forest and weighted support vector data description. *International Journal of Electrical Power & Energy Systems*, 153:109283, 2023.

[9] Wali Ullah Khan, Seham Ibrahem Abd Elkarim, MM Elsherbini, Ola Mohammed, Omer Waqar, and Basem M Elhalawany. Deep learning based joint collision detection and spreading factor allocation in lorawan. *Authorea Preprints*, 2023.

[10] Ferran Adelantado, Xavier Vilajosana, Pere Tuset-Peiro, Borja Martinez, Joan Melia-Segui, and Thomas Watteyne. Understanding the limits of lorawan. *IEEE Communications magazine*, 55(9):34–40, 2017.

[11] Sean G Richardson. *LoRaWAN Sensor Network Jamming Detection and Mitigation Using Machine Learning in the Cloud*. PhD thesis, Morgan State University, 2023.

[12] Laksh Bhatia, Michael Breza, Ramona Marfievici, and Julie A McCann. Dataset: Loed: The lorawan at the edge dataset. *arXiv preprint arXiv:2010.14211*, 2020.

[13] LoED: The LoRaWAN at the Edge Dataset. https://zenodo.org/records/ 4121430. September 25, 2020 — Version v3

[14] Laksh Bhatia, Michael Breza, Ramona Marfievici, and Julie A McCann. Loed: The lorawan at the edge dataset: Dataset. In *Proceedings of the Third Workshop on Data: Acquisition To Analysis*, pages 7–8, 2020.

[15] Jakub Palša, Ján Hurtuk, Martin Chovanec, and Eva Chovancová. Using machine learning algorithms to detect malware by applying static and dynamic analysis methods. *Acta Polytechnica Hungarica*, 19(7), 2022.

[16] Markhaba Karmenova, Aizhan Tlebaldinova, Iurii Krak, Natalya Denissova, Galina Popova, Zheniskul Zhantassova, and G Györök. An approach for clustering of seismic events using unsupervised machine learning. *Acta Polytechnica Hungarica*, 19(5):7–22, 2022.

[17] Hayelom Gebrye, Yong Wang, and Fagen Li. Traffic data extraction and labeling for machine learning based attack detection in iot networks. *International Journal of Machine Learning and Cybernetics*, 14(7):2317–2332, 2023.