1 Introduction

Sensors are capable of measuring various parameters, including temperature, humidity, pressure, and more. Wireless sensor networks (WSNs) are utilized in measurement and monitoring applications such as environmental monitoring, military surveillance, and industrial automation [1]. Moreover, WSNs play a crucial role in IoT applications such as smart cities, smart buildings, agriculture, industries, healthcare, asset tracking, and smart metering. Efficient energy management in WSNs poses a significant challenge that requires meticulous modeling and analysis [2]. LoRa technology is widely adopted for enabling low-power wide area networks (LPWANs) on unlicensed frequency bands. Despite its modest data rates, LoRa provides extensive coverage for low-power devices, making it an ideal communication system for numerous IoT applications [3].

In many applications, sensor nodes are equipped with non-rechargeable batteries and deployed in challenging and inaccessible environments. As a result, sensor nodes are required to operate for extended periods without the ability to access and replace their batteries [4]. Sensor nodes perform various tasks, including event sensing, local processing of collected information, and transmission of data packets to the access point. Each task performed by the sensor node consumes a certain amount of energy. Energy consumption is a critical concern in sensor nodes, and efforts are focused on increasing the network lifetime. This is a vital factor in prolonging the lifespan of edge devices. LoRa gateways are expected to operate for 5–10 years with minimal maintenance. However, one of the major challenges associated with LoRa connectivity is power usage. The LoRa system employs two strategies to conserve energy: (1) Efficient bandwidth utilization for the chirp signal and (2) avoidance of complex medium access control (MAC) methods for scheduling. Despite these measures, peripherals still consume more energy than anticipated due to unforeseen events, such as packet forwarding caused by fading channels [5].

Energy consumption analysis and modeling are crucial topics that can assist network designers in optimizing energy consumption during the design and implementation of wireless sensor networks (WSNs). Therefore, it is important to provide a comprehensive energy consumption model for sensor nodes to accurately estimate the wireless network lifetime.

LoRa is a suitable option among low-power wide area network (LPWAN) technologies for sensor networks. Due to its utilization of unlicensed frequency bands (specifically, the Industrial Scientific Medical band), LoRa is considered a noteworthy solution for IoT systems [6]. With its unique modulation technique, LoRa technology can be versatile and compatible with various IoT applications [7]. The LoRaWAN protocol was specifically developed for IoT applications, and the attributes of LoRaWAN significantly impact the battery lifetime of sensor nodes [8]. In LoRa, energy consumption can be optimized by accurately determining the key parameters of LoRaWAN technology.

In this paper, we present a comprehensive model for LoRa-based sensor nodes and the LoRaWAN protocol. The proposed model investigates and analyzes the impact of various parameters, including bandwidth (BW), spreading factor (SF), coding rate (CR), payload size, and radio range, on the energy consumption of sensor nodes. The notation used in the article is provided in Table 1. The subsequent sections of the paper are organized as follows: Sect. 2 describes the characteristics of LoRaWAN technology, Sect. 3 provides a review of related works, Sect. 4 presents the energy consumption analysis and modeling, Sect. 5 evaluates the model, and finally, the paper is summarized and concluded in the last section.

Table 1 Notations of the article

2 LoRa/LoRaWAN technology

LoRa/LoRaWAN is a spread spectrum (SS) modulation technology derived from chirp spread spectrum (CSS) technology. LoRa, developed by Semtech, is a remote, low-power wireless platform that has emerged as a prominent choice in the field of IoT. The spread spectrum modulation of LoRa enables robust communication in challenging environments. Additionally, LoRa exhibits excellent resilience to burst random interference, allowing demodulation even for burst lengths shorter than 1/2 symbol or interference duty cycles below 50% of the source of interference. The sensitivity degradation of LoRa is minimal, with a loss of less than 3 dB. LoRa relies on its unique spread spectrum modulation technology to transmit data information in environments with noise levels below 25 dB [9]. This section provides a detailed description of the features of LoRa/LoRaWAN technology. Figure 1 illustrates the characteristics of the LoRa/LoRaWAN technology.

Fig. 1
figure 1

Features of LoRaWAN

2.1 LoRaWAN network architecture

LoRa operates within the ISM frequency bands. The utilization of LoRa aims to reduce energy consumption in sensor nodes, thereby increasing their overall lifetime [10]. In addition to its low power consumption feature, LoRa employs the chirp spread spectrum (CSS) technique to further minimize power usage [8]. To address various challenges in long-range IoT applications, LoRa has developed a wireless communication protocol known as LoRaWAN. The architecture of a LoRaWAN network is depicted in Fig. 2. The communication between sensors and the gateway is facilitated through the LoRaWAN radio frequency interface. Data frames from the gateway can be transmitted to the network server using conventional networks such as Long-Term Evolution/Fourth Generation (LTE/4G), Wi-Fi, Ethernet (ENET), and others [11].

Fig. 2
figure 2

LoRaWAN network architecture

2.2 LoRaWAN protocol

The LoRaWAN network's physical layer is defined within the ISM band, with operating frequencies of 915 MHz for America, 868 MHz for Europe, and varying frequencies in other regions of the world. The modulation technique employed in LoRa is CSS. The protocol layer characteristics of LoRaWAN are determined by LoRa [12]. Figure 3 illustrates the stack structure in the LoRaWAN protocol. Within the protocol layer, three classes are defined for LoRa, and these will be described in the subsequent sub-sections.

Fig. 3
figure 3

Stack structure in LoRaWAN protocol

2.3 LoRaWAN classes

LoRaWAN can be defined using three application classes, namely A, B, and C, which offer different strategies for energy consumption [12]. These classes are illustrated in Fig. 4.

Fig. 4
figure 4

Different classes of LoRaWAN

2.3.1 Class A

In Class A, two-way communication is established between the sensor and the gateway. The sensor can initiate an uplink transmission based on its requirements. Following the uplink transmission, two downlink short messages are sent. Class A is widely used in most IoT applications due to its low energy consumption [12]. In Class A, all transactions are initiated by the sensor, while the network server only sends two downlink time slots, and the radio receiver remains in active mode until the downlink frame is demodulated [13]. If a frame is detected, demodulated, and passes the address and message integrity code (MIC) check in the first receiving window, the second window will not be opened for the sensor.

Class A, being the class with the lowest energy consumption, is the most commonly used class in LoRa networks. Therefore, we will now describe the possible scenarios that can occur in Class A. Figure 5 illustrates the possible scenarios in the sensor node in Class A based on LoRaWAN. In the first scenario, data is sent to the gateway without receiving RX1 and RX2. In the second scenario, sending and receiving occur only in RX1 without receiving RX2. In the third scenario, after sending the data, RX1 is received, and if RX1 contains an error, RX2 will be received.

Fig. 5
figure 5

Possible states in class A

2.3.2 Class B

Class B is less commonly used compared to Class A due to its higher energy consumption. In Class B, communication begins with the transmission of downlink messages from the gateway. As a result, the sensor can receive additional windows, known as ping slots, at fixed programmed time intervals. In this class, a periodic beacon is sent for synchronization purposes. Class B exhibits average power consumption [14].

2.3.3 Class C

Compared to Class A and Class B, Class C has higher power consumption, which is why it is rarely used. In Class C, the sensor receive windows are typically open and only closed during transmission. This means that the sensors remain in active mode for the majority of the time, except during sending. Despite its higher power consumption, Class C offers the lowest delay in terms of server-sensor communication [15].

2.4 LoRa modulation

LoRa is a CSS modulation technique that utilizes broadband linear frequency-modulated pulses to encode information by varying the frequency over a given period. This approach offers two key advantages: high tolerance to frequency inconsistencies between the transmitter and receiver, and a significant increase in receiver sensitivity due to the processing gain achieved through the wide spectrum technique. The LoRa radio module incorporates various parameters, including carrier frequency, spreading factor (SF), bandwidth (BW), coding rate (CR), and bit rate (BR), which can be configured in different combinations [16]. These parameters play a crucial role in determining the transmission range and energy consumption of the LoRa radio module. In the following sections, we will briefly introduce the important parameters of LoRa modulation.

2.4.1 Central frequency

The central frequency is utilized for transmitting data and messages. The specific range of central frequencies in LoRa depends on the type of radio module and the geographical region of use. For instance, in Europe, the frequency range of 868–870 MHz is commonly designated for LoRa communication.

2.4.2 Chirp

A chirp is a signal characterized by its frequency increasing (chirp-up) or decreasing (chirp-down) over a defined time period. Unlike other types of digital modulation such as quadrature phase-shift keying (QPSK) or binary phase-shift keying (BPSK), which employ sine waves as symbols, chirp spread spectrum (CSS) utilizes chirps that dynamically change in frequency over time.

2.4.3 Chip

In the context of wide spectrum transmission, a chip refers to the fundamental binary element of a data sequence. It is named differently from a bit to avoid confusion. The chip rate (CR) represents the number of chips transmitted or received per unit of time and is typically much higher than the symbol rate (SR). This means that multiple chips may be used to represent a single symbol.

2.4.4 Bandwidth

The chip rate (CR) is always numerically equal to the bandwidth (BW) in LoRa modulation. Therefore, if a bandwidth of 125 kHz is chosen, the chip rate will be 125,000 chips per second. As a result, the terms BW and CR are often used interchangeably. Typically, LoRa applications have a bandwidth that ranges up to 500 kHz, which encompasses three options: 125, 250, and 500 kHz. For faster transmission requirements, a bandwidth of 500 kHz is utilized, while a bandwidth of 125 kHz is employed for long-range communication needs. Figure 6 illustrates the corresponding LoRa bandwidth for two-way transmission across the spectrum, considering the BW options of 125, 250, and 500 kHz.

Fig. 6
figure 6

Transmission spectrum for 125, 250 and 500 kHz BWs

2.4.5 Spreading factor (SF)

A symbol represents one or more bits of data and can be in the form of a waveform or a code. The symbol rate, also known as the baud rate, refers to the number of symbol changes that occur per unit of time and can be equal to or less than the bit rate. The spreading factor (SF) indicates the number of chips per symbol and takes a value between 7 and 12. Figure 7 illustrates the relationship between SF and symbol rate (SR), demonstrating that each unit increase in SF results in a doubling of the SR. Increasing the SF enhances the receiver's ability to mitigate noise in the signal. However, higher SF values lead to longer transmission times for data packets. The spreading of each symbol is achieved through a chip code with a length of 2SF. SF is related to chip and symbol as: 1 Symbol = 2SF Chips. Upon receiving the code in blocks of length 2SF/SF, the receiver can decode them accordingly. The symbol rate (\({R}_{s})\) and the chip rate (\({R}_{C})\) are defined according to the SF as follows:

Fig. 7
figure 7

SF and the symbol duration; for each unit increase in the SF, the symbol duration doubles

$$R_{s} = {\raise0.7ex\hbox{${BW}$} \!\mathord{\left/ {\vphantom {{BW} {2^{{SF}} }}}\right.\kern-\nulldelimiterspace} \!\lower0.7ex\hbox{${2^{{SF}} }$}}$$
(1)
$${R}_{C}={R}_{s}\times {2}^{SF}$$
(2)

2.4.6 Coding rate (CR)

The coding rate (CR) in LoRa modulation enhances the robustness of the communication link by employing cyclic error coding (CRC), which adds redundancy to the encoding process of the transmitted packet. In LoRa modulation implementation, every 4 data bits are encoded as 5, 6, 7, or 8 bits in total using forward error correction (FEC). The specific coding rate is determined by setting the value of n as 1, 2, 3, or 4, corresponding to the different FEC schemes available.

$$CR=\frac{4}{4+n}$$
(3)

2.4.7 Bit rate (data rate)

The bit rate (BR) or data rate represents the number of bits transmitted or processed per unit of time. The bit rate or data rate, typically measured in bits per second, is influenced by factors such as bandwidth, expansion factor, and coding rate. It can be defined as follows:

$${R}_{b}=SF.\frac{BW}{{2}^{SF}}.CR$$
(4)

2.5 Packet structure (LoRa frame)

The beginning of each LoRa frame includes a preamble section that is used to synchronize the receiver and transmitter [16]. After the preamble, an optional header is included, which contains the payload size and LoRa information. The header is encoded with a coding rate (CR) of 4/8. Following the header, there is a payload with a variable coding rate (CR). An optional CRC can also be sent at the end of the LoRa frame. The structure of a LoRa frame is shown in Fig. 8.

Fig. 8
figure 8

LoRa packet structure

In LoRa, the calculation of the time on air, which represents the duration of the packet transmission, begins with the calculation of the payload size [17]. The number of payload symbols can be expressed in terms of SF (Spreading Factor) and CR (Coding Rate) as follows:

$${N}_{payload }=8+max\left(ceil\left(\frac{8{n}_{payload}-4SF+28+16-20H}{4\left(SF-2DE\right)}\right)\left(CR+4\right), 0\right);$$
(5)

The symbols "ceil" and "\({n}_{payload}\)" represent the ceiling function and the number of payload bytes, respectively. When H = 0, it indicates that the header is active, whereas H = 1 signifies the absence of a header. In the case of enabling the "Low Data Rate Optimization," DE = 1; otherwise, DE = 0. The duration of the preamble is expressed as follows:

$${T}_{preamble}=\left(4.25+{N}_{preamble}\right)\times {T}_{symbol}$$
(6)

In the given context, "\({N}_{preamble}\)" represents the number of preamble symbols, and "\({T}_{symbol}\)" refers to the symbol period, which is the time taken to transmit \({2}^{SF}\) chips. It is important to note that the chip rate is equal to the bandwidth (BW). Therefore, "\({T}_{symbol}\)" can be expressed using Eq. (7).

$${T}_{symbol}=\frac{{2}^{SF}}{BW}$$
(7)

The duration of the payload can also be expressed with the following Equation:

$${T}_{payload}={N}_{payload}\times {T}_{symbol}$$
(8)

As a result, the duration of a packet, or in other words, the time on air, is equal to the sum of the durations of the preamble, payload, and header (if present). In a simple case where there is no header, the Equation becomes:

$${T}_{packet}={T}_{preamble}+{T}_{payload}$$
(9)

where "\({T}_{preamble}\)" represents the duration of the preamble, and "\({T}_{payload}\)" represents the duration of the payload, both measured in a specific unit of time.

2.6 Acknowledgement (ACK) structure

As shown in Fig. 8, in Class A, after each uplink transmission (from the sensor to the gateway), two receive time slots are opened, namely RX1 and RX2. In the first receive slot (RX1), the same frequency channel as the uplink frame is used. The second receive window (RX2) utilizes an adjustable frequency and data rate for the LoRa receiver [18]. The RX messages can be considered as acknowledgments (ACKs) for the transmission. Figure 9 illustrates the structure of an ACK packet. The ACK packet is concluded with a message integrity code (MIC).

Fig. 9
figure 9

ACK structure in LoRa

2.7 Bit energy

In this section, we will calculate the energy of each bit (\({E}_{bit})\). \({E}_{bit}\), is a parameter to measure the sensor node energy consumption and defined as follows:

$${E}_{bit}=\frac{{E}_{total}}{8\times {n}_{payload}}=\frac{{P}_{consump }\times {T}_{packet}}{8\times {n}_{payload}}$$
(10)

In this section, we will calculate the energy of each bit (\({E}_{bit}\)). \({E}_{bit}\) is a parameter used to measure the energy consumption of the sensor node. It is defined as follows:

where \({E}_{total}\) represents the total energy used to send the packet, and \({P}_{consump}\) represents the total power consumption associated with the sending power. \({n}_{payload}\) is the number of payload bytes. Using Eq. (6), the expression for the energy of each bit provided in Eq. (10) can be rewritten as Eq. (11).

$${E}_{bit}=\frac{{P}_{consump}\times ({N}_{payload}+{N}_{preamble}+4.25)\times {T}_{symbol}}{8\times {n}_{payload}}$$
(11)

Using Eq. (7), \({E}_{bit}\) can be expressed as a function of SF in Eq. (12). \({E}_{bit}\) is an increasing function based on SF.

$${E}_{bit}=\frac{{P}_{consump}\times \left({N}_{payload}+{N}_{preamble}+4.25\right)\times {2}^{SF}}{8\times {n}_{payload}\times BW}$$
(12)

2.8 Receiver sensitivity

The minimum received power required to detect the signal is determined by the sensitivity of the receiver and depends on the Spreading Factor (SF) and Bandwidth (BW). The receiver sensitivity for the minimum Signal-to-Noise Ratio (SNR) is defined as \({SNR}_{0}=\frac{{E}_{bit}}{{N}_{0}}\), where \({N}_{0}\) represents the noise power spectral density. In this case, the following relationship holds:

$${E}_{bit}={P}_{receive}\times {T}_{bit}$$
(13)

where \({P}_{receive}\) and \({T}_{bit}\) are the received power and bit duration, respectively. Assuming that \({T}_{chip}=1/BW\), the relationship between \({T}_{bit}\) and \({T}_{chip}\) can be defined as follows:

$${T}_{bit}={T}_{chip}\times {2}^{SF}=\frac{{2}^{SF}}{BW}$$
(14)

Now, \({SNR}_{0}\) can be expressed as follows based on the aforementioned assumptions:

$${SNR}_{0}=\frac{{E}_{bit}}{{N}_{0}}=\frac{{P}_{receive}\times {T}_{bit}}{{N}_{0}}=\frac{{P}_{receive}\times {T}_{chip}\times {2}^{SF}}{{N}_{0}}=\frac{{P}_{receive}\times {2}^{SF}}{BW\times {N}_{0}}$$
(15)

Equation (15) can be rewritten as Eq. (16), taking into account the relationship \({N}_{0}=NF\times K\times T\), where NF, K, and T represent the noise figure of the receiver, the Kelvin constant, and the temperature, respectively.

$${SNR}_{0}=\frac{{P}_{receive}\times {2}^{SF}}{BW\times NF\times K\times T}$$
(16)

In this case, from Eq. (16), the received power can be expressed as follows:

$${P}_{receive}=\frac{{SNR}_{0}\times N\times K\times T\times BW}{{2}^{SF}}$$
(17)

The sensitivity of the receiver can be expressed by Eq. (18):

$${Sen}_{receive}={SNR}_{SF}\times {N}_{0}={SNR}_{SF}\times NF\times k\times T\times BW$$
(18)

The variables \({SNR}_{SF}\), NF, k, and T represent the signal-to-noise ratio for a specific Spreading Factor (SF), receiver noise figure, the Kelvin constant (1.380649 × 10−23 Joule per Kelvin), and temperature (in Kelvin), respectively. The sensitivity of the LoRa receiver at room temperature can be obtained using the following relationship:

$${Sen}_{receive}=-174+10\mathit{log}BW+NF+{SNR}_{SF}$$
(19)

The first term (-174) represents the thermal noise in a 1 Hz bandwidth and is influenced solely by the receiver temperature. The noise figure (NF) remains constant for a given hardware, and \({SNR}_{SF}\) denotes the required signal-to-noise ratio of the underlying modulation method. Both SNR and bandwidth (BW) can be adjusted by the LoRa designer as design variables. To achieve significant SNR improvement, LoRa modulation schemes, Forward Error Correction (FEC) techniques, and spread spectrum processing gain are combined [19]. By comparing Eqs. (17) and (18), we establish the relationship \({SNR}_{SF}=\frac{{SNR}_{0}}{{2}^{SF}}\).

2.9 Link budget

The link budget can be defined as \({Link}_{budget}=\frac{{P}_{transmit}}{{Sen}_{receive}}\), where \({P}_{transmit}\) represents the transmission power. To estimate the maximum range of LoRa, it is assumed that there is no antenna gain, resulting in the path loss being equal to the link budget.

$${Loss}_{path}={Link}_{budget}=\frac{{P}_{transmit}}{{Sen}_{receive}}$$
(20)

By inserting Eq. (18) into Eq. (20), the link budget can be shown as the following relationship.

$${{Link}_{budget}=Loss}_{path}=\frac{{P}_{transmit}}{{SNR}_{SF}\times NF\times K\times T\times BW}=\frac{{P}_{transmit}{\times 2}^{SF}}{{SNR}_{0}\times NF\times K\times T\times BW}$$
(21)

2.9.1 Transmission range

Using the Equation \({Loss}_{path}={(\frac{4\pi f}{c})}^{2}.{R}^{m}\), the transmission range can be estimated as follows:

$$R={ \left(\frac{{Loss}_{path}}{{ \left(\frac{4\pi f}{c}\right)}^{2}}\right)}^\frac{1}{m}$$
(22)

where f, c, and m represent the LoRa frequency, speed of light, and path loss exponent, respectively. Now, utilizing Eq. (22), the range of LoRa can be estimated as follows.

$$R={ \left({ \left(\frac{4\pi f}{c}\right)}^{2}\times \frac{{P}_{transmit}\times {2}^{SF}}{{SNR}_{0}\times NF\times k\times T\times BW}\right)}^\frac{1}{m}$$
(23)

The path loss exponent (m) is considered to be 2, 3, and 6 for free space, urban areas, and areas with numerous obstructions, respectively. The transmission range of the LoRaWAN system can reach up to 15 km [15]. \({SNR}_{0}\) in LoRa falls within the range of −7.5 to −20 dB. As shown in Eq. (23), since the LoRaWAN range is an increasing function based on the Spreading Factor (SF), greater ranges can be achieved by using different SF values. The power required for transmission per LoRa sensor can be obtained from the following Equation:

$${P}_{transmit}= \frac{{({c}^{2}R}^{m}\times {SNR}_{0}\times NF\times k\times T\times BW)}{{(4\pi f)}^{2}{ \times 2}^{SF}}{ }$$
(24)

3 Related works

Due to the energy consumption challenges in sensor nodes, many studies have focused on energy consumption in sensor technologies. Several state-of-the-art surveys on LoRaWAN have been proposed that cover various aspects [20]. For instance, [21] reviews the scalability issues of LoRaWAN and proposed solutions in massive IoT networks. In [22], the authors provide a technical overview of LoRaWAN technology and discuss state-of-the-art studies. [23] provides an overview of LPWAN technologies, discusses the challenges and critical aspects of LoRaWAN, presents recent solutions, and compares commonly used LoRaWAN simulation tools. [24] presents a general discussion of long-range (LoRa) technology, explores different applications, and proposes a solution to integrate edge computing in IoT-based applications. [25] presents a brief overview of LoRa, investigates the challenges and recent solutions, and discusses open issues. [26] reviews state-of-the-art works on LoRaWAN, focusing on aspects that affect network performance and categorizes them. [27] provides an overview of different routing protocols, discusses challenges in routing protocols, and addresses issues faced by multi-hop communication. [28] presents LoRa technology, discusses design and research challenges, as well as research issues. Finally, [29] presents LPWAN solutions, describes LoRaWAN technology and its main characteristics, describes LoRaWAN use-cases, and discusses research challenges compared to other technologies.

Most of the existing research on LoRa/LoRaWAN technologies concentrates on attributes such as sensor range, delay, and network capacity [7, 30,31,32]. For example, [33] proposes the Adaptive Data Rate (ADR) algorithm, which is a mechanism to configure the transmission parameters of end devices (sensors) aiming to improve the packet delivery rate (PDR) in LoRaWAN. In the study, a new algorithm using the Multi-Armed Bandit (MAB) technique is presented to configure the end devices' transmission parameters in a centralized manner on the Network Server (NS) side while also improving energy consumption.

It should be noted that some studies conducted on energy consumption in LoRa/LoRaWAN sensor nodes have certain weaknesses. These studies often extract values from datasheets or rely on results obtained from experimental tools [34,35,36], without presenting an energy model for estimating sensor energy consumption. However, in [37], an energy model based on LoRa/LoRaWAN is presented, which estimates the power consumption of various parts of a sensor node. The authors introduce different sensor node parts and present an energy model for the communication modes of the sensor node. The goal is to compare different LoRaWAN modes to find the best sensor design for achieving energy independence. In [38], power tests were performed on hardware, specifically "very low-power" devices, and significant changes in power were observed. The test results present an empirical model that emphasizes the effects of important parameters such as data rate and transmission power on sensor power consumption. In [17], an energy estimation model is presented to achieve low power consumption in sensors. The results of this research show that to conserve power, communication modules and microcontrollers should remain inactive for as long as possible. In [10], models are presented to describe the LoRaWAN sensor lifetime and the cost of energy. However, the study does not investigate the energy consumption of processing and sensing units. In [13], energy consumption of different LoRaWAN classes is investigated for comparison in various LoRa operating modes. The study does not consider the effects of important LoRaWAN parameters such as coding rate (CR), sensor range, and transmission power. In [39], an energy model is presented for very low-power sensor nodes, where a sensor node is modeled by defining a sensor allocated to network applications. It's important to note that some studies estimating energy consumption in sensors do not include LoRa technology in their energy models and instead use radio frequency (RF) transmitters allocated to short-range communications.

The optimization of LoRa/LoRaWAN parameters is crucial for reducing energy consumption and achieving accurate estimation and optimization of energy consumed by the sensor node. In this study, we propose a comprehensive energy model based on LoRaWAN, taking into account important parameters such as Spreading Factor (SF), Coding Rate (CR), Bandwidth (BW), communication range, and transmission power.

4 Comprehensive modeling of LoRaWAN sensor

In order to provide a comprehensive model for energy consumption in a sensor node, we need to first present the different operation modes of the node based on its structure. Next, we can calculate the energy consumption of each mode and finally present the proposed energy consumption model. To achieve this, we will begin by explaining the structure of a sensor node.

4.1 Sensor node structure

Generally, a sensor node is composed of three main units: the computation unit, the communication unit, and the power supply unit [1]. The computation unit comprises the microcontroller and sensor sections. Figure 10 illustrates the structure of a sensor node.

Fig. 10
figure 10

Structure of a sensor node

4.1.1 Computation unit

In the computation unit, the sensor is responsible for measuring various environmental data such as light, temperature, pressure, etc. Typically, the input signal is in analog form and needs to be converted to a digital format using an analog-to-digital converter (ADC). As depicted in Fig. 10, the ADC is integrated into the sensor. Both the measurement of environmental data and the ADC conversion processes consume time and energy [30]. Within the computation unit, the processing subunit manages all the resources used for the operation of the sensor node [40]. It receives the output signal from the sensor, processes the data, and subsequently transmits it to the LoRa radio module.

4.1.2 Communication unit

Once the necessary data processing is completed, it can be transmitted to the gateway [40]. In recent years, numerous standards have been introduced for IoT applications [31]. Particularly, low-power long-range radios have garnered significant attention due to their high receiver sensitivity. These technologies enable data transmission over long distances.

4.2 Modeling

Figure 11 illustrates the possible working arrangements in the sensor, highlighting the various operating modes controlled by the processing unit.

Fig. 11
figure 11

Work order in the sensor

The energy consumption model proposed in this study is based on the following assumptions:

  • Sensor duty sequences are allocated fixed durations.

  • Initially, the processing unit is turned on.

  • Information packets are transmitted by the radio module at a constant power level.

  • All measured data is sent in real-time.

Additionally, Fig. 12 depicts the power consumption of the sensor node in different modes. It is evident that the sensor node exhibits the lowest power consumption in sleep mode, while the highest power consumption occurs during transmission mode.

Fig. 12
figure 12

Sensor node power consumption in different modes

4.3 LoRa energy modeling

While analyzing the different operation modes of the sensor node, it is important to investigate the energy consumption in these modes. Since the sensor node spends most of its time in sleep mode, the energy consumed in this mode can significantly impact the total energy consumption of the sensor node. The total energy consumption of a sensor node can be expressed using Eq. (23):

$${E}_{Total}={E}_{sleep}+{E}_{active}$$
(25)

where \({E}_{sleep}\) and \({E}_{active}\) are the energy consumed by the node in sleep mode and the total energy consumed by the node in the active mode, respectively. \({E}_{sleep}\) can be expressed as follows:

$${E}_{sleep}={P}_{sleep}\times {T}_{sleep}$$
(26)

where \({P}_{sleep}\) represents the power consumption of the sensor node in sleep mode, and \({T}_{sleep}\) indicates the duration of the sleep mode. The total energy consumption, \({E}_{active}\), is calculated by summing up the energy consumption of all energy-consuming units within the sensor node. This can be expressed as Eq. (25).

$${E}_{active}={E}_{wakeup\_sys}+{E}_{measure}+{E}_{process}+{E}_{wakeup\_TRX}+{E}_{transmit}+{E}_{receive}$$
(27)

where\({E}_{wakeup\_sys}\),\({E}_{measure}\),\({E}_{process}\),\({E}_{wakeup\_TRX}\), \({E}_{transmit}\), and \({E}_{receive}\) are energy consumed during node awakening, data measurement, processing, transmitter/receiver awakening, sending and receiving, respectively. The processing unit manages wake-up of the sensor node. During the wake time, the energy consumption is given by Eq. (26).

$${E}_{wakeup}={P}_{micro}\times {T}_{wakeup\_sys}$$
(28)

where \({P}_{micro}\) represents the power consumption of the microcontroller, and \({T}_{wakeup\_sys}\) denotes the initial wake-up time of the sensor node. It should be noted that the power consumption of the microcontroller is dependent on its frequency. Once the sensor node wakes up, the sensor begins measuring the data. The energy wasted during this step can be expressed as follows:

$${E}_{micro}={E}_{measure}+({P}_{micro}\times {T}_{measure})$$
(29)

The energy consumed during the measurement of environmental data by the sensor can be obtained from Eq. (28).

$${E}_{measure}={P}_{measure}\times {T}_{measure}$$
(30)

where \({P}_{measure}\) represents the power consumption during data measurement, and \({T}_{measure}\) denotes the duration of the measurement process. Additionally, Eq. (27) can be expressed as follows, considering the information from Eq. (28):

$${E}_{micro}=({P}_{micro}+{P}_{measure})\times {T}_{measure}$$
(31)

After the data is measured, the microcontroller initiates the data processing step. The duration of data processing depends on the operating frequency of the microcontroller and the number of instructions involved. The processing time can be expressed as Eq. (30).

$${T}_{process}=\frac{{M}_{instruction}}{{f}_{micro}}$$
(32)

In this context, \({M}_{instruction}\) represents the number of microcontroller instructions, and \({f}_{micro}\) denotes the frequency of the processor. Assuming that one instruction is executed per clock pulse, the energy consumed by the processing unit can be calculated using Eq. (31).

$${E}_{process }={P}_{process}\times {T}_{process}$$
(33)

In this case, \({P}_{process}\) refers to the power consumption of the processor, and \({T}_{process}\) represents the processing time. The energy consumed during the wake-up of the transmitter/receiver can be expressed using Eq. (32).

$${E}_{wakeup\_TRX}=({P}_{micro}+{P}_{wakeup\_TRX})\times {T}_{wakeup\_TRX}$$
(34)

where \({P}_{wakeup\_TRX}\) denotes the power consumption during the wake-up of the transmitter/receiver. The energy consumption of the transmitter in the sending mode can be expressed using Eq. (33).

$${E}_{transmit}=({P}_{micro}+{P}_{transmit})\times {T}_{transmit}$$
(35)

where \({P}_{transmit}\) represents the power dissipated in the transmit mode, and \({T}_{transmit}\) is the transmission time, which can be calculated using Eq. (34).

$${T}_{transmit}={N}_{bit}\times {T}_{bit}$$
(36)

where \({N}_{bit}\) represents the number of bits sent, and \({T}_{bit}\) denotes the duration of sending one bit. The energy consumed by the sensor node during reception can be obtained using the following Equation:

$${E}_{receive}=({P}_{micro}+{P}_{receive})\times {T}_{receive}$$
(37)

where \({P}_{receive}\) represents the power consumed in the receiving mode, and \({T}_{receive}\) denotes the receiving time. When the sensor node is in the ON state, the energy consumed by the microcontroller can be calculated using the following Equation:

$${E}_{micro}={P}_{micro}\times {T}_{micro}$$
(38)

where the duration of the microcontroller is denoted by \({T}_{micro}\), and it is dependent on the total working time in different states of the sensor node. This can be expressed as follows:

$${T}_{micro}={T}_{wakeup\_sys}+{T}_{measure}+{T}_{process}+{T}_{wakeup\_TRX}+{T}_{transmit}+{T}_{receive}$$
(39)

Based on the analysis of energy consumption in the sensor node, the comprehensive energy modeling can be depicted as shown in Fig. 13. This model illustrates the energy consumption in the active mode during different time steps.

Fig. 13
figure 13

Energy model of a LoRa sensor node

5 Evaluation of the model

In this section, we will explore the impact of varying influential parameters on the LoRa modulation scheme and the LoRaWAN protocol. These parameters play a crucial role in striking a balance between power consumption and the nominal data rate. By optimizing these parameters, it is possible to achieve the desired trade-off between energy efficiency and data transmission performance in LoRa-based systems.

5.1 The effect of the expansion factor on the bit rate

Figure 14 illustrates the impact of the spreading factor (SF), code rate (CR), and bandwidth (BW) on the bit rate in LoRa modulation. From the graphs in the Figure, it is evident that as the SF increases, the data rate decreases. Moreover, increasing the bandwidth leads to higher data rates, while increasing the code rate results in lower data rates. However, for SF values greater than 10, changes in the bandwidth and code rate have a minimal effect on the data rate increase. Consequently, to achieve a higher data rate for any given bandwidth, it is advisable to utilize lower values of the spreading factor. This allows for a compromise between power consumption and the nominal data rate in LoRa-based systems.

Fig. 14
figure 14

The effect of SF on \({\mathrm{R}}_{\mathrm{b}}\) for different values of BW

5.2 The influence of the SF on the symbol period

Figure 15 illustrates the effect of changing the spreading factor (SF) on the symbol period in LoRa modulation. From the Figure, it can be observed that as the SF increases, the symbol period decreases. This decrease in the symbol period is more pronounced in higher bandwidths (BW). In other words, in high bandwidths, the trend of increasing the symbol period becomes less significant as the SF increases. This relationship between SF and symbol period is important to consider when designing LoRa-based systems, as it affects the overall timing and synchronization of communication.

Fig. 15
figure 15

The effect of SF on symbol period for different values of BW

5.3 The effect of the expansion factor in closed time (on air time)

Figure 16 demonstrates the effect of changing the spreading factor (SF) on the packet time or on-air time in LoRa modulation. It can be observed that as the SF increases, the packet time also increases. This increase in packet time is more significant in lower bandwidths (BW). The longer packet time results in higher energy consumption during transmission, which consequently reduces the lifetime of the sensor node. Therefore, selecting the appropriate SF based on the available bandwidth can help reduce transmission energy consumption and extend the sensor node's lifetime.

Fig. 16
figure 16

The effect of SF on packet time (on air time) for different values of BW and number of payload symbols

It is worth noting that the size of the packet is determined by the number of symbols in the payload and preamble. As the size of the payload and preamble increases, the packet time also increases. In the study presented, the value of the preamble symbol is considered constant at 2.

5.4 The effect of the number of payload symbols in the packet time for different values of SF

Figure 17 depicts the effect of the number of payload symbols on the packet time (on-air time) for different values of the spreading factor (SF) in various bandwidths (BW). As observed, an increase in the number of payload symbols leads to an increase in the packet time. Figure 17a specifically illustrates the changes in packet time with respect to the number of payload symbols in a 125 kHz BW. Similarly, Figs. 17b, c show these changes in a 250 and 500 kHz BW, respectively.

Fig. 17
figure 17

The effect of the number of payload symbols on the packet time for different values of SF and BW

Furthermore, for a given number of payload symbols, it can be noticed that increasing the bandwidth results in a decrease in the packet time (on-air time). It should be noted that reducing the packet time contributes to lower energy consumption during transmission. Consequently, increasing the bandwidth can help reduce the energy consumption of the sensor node, thereby increasing its battery lifetime.

It is important to consider these factors when designing LoRa-based systems to optimize energy efficiency and extend the operational lifetime of the sensor nodes.

5.5 The impact of payload size (number of payload bytes) on bit energy consumption

Figure 18 illustrates the effect of changes in payload size (number of payload bytes) on energy consumption per bit in different bandwidths (BW) and for different values of the spreading factor (SF). From the Figure, it can be observed that as the size of the payload increases, the energy consumption per bit decreases. This reduction in energy per bit is more significant for smaller values of the SF. Additionally, for a given payload size and SF, the energy consumption per bit decreases with increasing bandwidth.

Fig. 18
figure 18

The effect of payload size (number of payload bytes) on bit energy for different values of SF and BW

Furthermore, it is evident that in all conditions, the energy per bit increases as the SF increases. This relationship will be further explored in the subsequent section. Understanding the impact of payload size, spreading factor, and bandwidth on energy consumption per bit is crucial for optimizing energy efficiency in LoRa-based systems. By carefully selecting these parameters, it is possible to achieve a balance between data transmission performance and energy consumption.

Figure 19 demonstrates the effect of changing the spreading factor (SF) on the bit energy for different values of SF in different bandwidths (BW). It is noticeable that the bit energy increases as the SF increases. This relationship holds true for all bandwidth values considered in the Figure.

Fig. 19
figure 19

The effect of SF on bit energy for different values of BW

Understanding the impact of SF on bit energy is important when optimizing energy consumption in LoRa-based systems. Higher SF values generally result in longer symbol durations, which in turn require more energy per bit. Consequently, choosing an appropriate SF is crucial to strike a balance between achieving desired data rates and minimizing energy consumption.

5.6 The effect of the SF on the symbol period

Figure 20 illustrates the changes in symbol period for different values of the spreading factor (SF) in different bandwidths (BW). As observed, the symbol period decreases as the SF increases, and this reduction occurs across all BWs. However, the decrease in symbol period with increasing SF is more pronounced in higher BWs. In other words, for a given SF value, the symbol period decreases to a greater extent with an increase in BW.

Fig. 20
figure 20

The effect of SF on symbol period for different values of BW

Understanding the relationship between SF, symbol period, and BW is important for optimizing the timing and synchronization aspects of LoRa-based systems. It allows for efficient utilization of available resources and ensures reliable communication within the network.

5.7 The effect of sensor range on path loss (link budget)

Figure 21 illustrates the effect of increasing the range of a sensor on the link budget or decreasing the path loss for different values of the path loss exponent (m). It can be observed that as the range increases, the path loss also increases. The increase in path loss is more pronounced at shorter ranges compared to longer ranges. Additionally, it is observed that the path loss increases significantly with an increase in the path loss exponent (m). Therefore, in scenarios where there is high noise due to natural and artificial factors, such as urban areas (m = 6), the path loss experiences a substantial increase.

Fig. 21
figure 21

The effect of sensor range on path loss for different values of m and f

5.8 The effect of range on path loss (link budget)

Figure 22 illustrates the effect of the spreading factor (SF) on the link budget, specifically the path loss. It is evident that the link budget increases as the SF increases, regardless of the bandwidth values. The increase in path loss is more significant in lower bandwidths.

Fig. 22
figure 22

The effect of SF on link budget

5.8.1 The effect of range on transmitted power

Figure 23 illustrates the effect of increasing the range on the transmitted power for different values of the spreading factor (SF) and the path loss exponent. It can be observed that as the range increases, the transmitted power also increases for all SF values, although the increase is less pronounced for higher SF values. Additionally, the comparison of Figs. 23a–c reveals that the transmitted power also increases with an increase in the path loss exponent. The transmitted power values are particularly significant in areas where natural and artificial effects intensify, leading to an increase in the path loss exponent (m). Consequently, the transmitted power required for a certain range experiences a substantial rise.

Fig. 23
figure 23

The effect of range on the transmission power for different values of m

5.8.2 Effect of SNR on receiver sensitivity

Figure 24 depicts the effect of increasing the signal-to-noise ratio (SNR) on the receiver sensitivity in different bandwidths (BW). It is evident that the receiver sensitivity increases as the SNR increases. However, the magnitude of the increase in receiver sensitivity due to the SNR growth is more pronounced in higher BWs.

Fig. 24
figure 24

The effect of SNR on sensitivity of the receiver for different values of BW

6 Conclusion

In this article, we analyzed the performance of a sensor node in LoRaWAN technology and presented it in the form of a comprehensive model. This analysis, along with the presented model, enables the analysis of various LoRaWAN modes and scenarios for IoT applications. To achieve the optimal design of the sensor node in LoRa-based networks, a detailed analysis based on the node's performance in different modes is necessary. These modes should be optimized to minimize the energy consumed by the sensor, thereby increasing the network's lifetime. Through numerical results and graphs, we demonstrated how different parameters of LoRa/LoRaWAN, such as spreading factor (SF), coding rate (CR), payload size, bandwidth (BW), etc., affect the performance of the sensor node. Optimizing these parameters plays a crucial role in reducing the energy consumption of the sensor node and extending its lifetime.