lora-calc
A Python library for calculating LoRa (Long Range) wireless transmission parameters. Compute symbol times, airtime, throughput, and link budgets based on LoRa configuration settings.
Installation
pip install lora-calc
Or with Poetry:
poetry add lora-calc
Usage
from lora_calc import LoRaCalculator
# Create a calculator with your LoRa parameters
calc = LoRaCalculator(
tx_power=20, # Transmit power in dBm (-14 to 20)
payload_len=125, # Payload length in bytes (0-255)
preamble_len=8, # Preamble length in symbols (6-65535)
spreading_factor=10, # SF6-SF12
bandwidth=125, # 62.5, 125, 250, or 500 kHz
coding_rate=5, # 5, 6, 7, or 8 (representing 4/5, 4/6, 4/7, 4/8)
crc=True, # Enable CRC
explicit_header=True, # Use explicit header mode
low_data_rate_opt=True, # Low data rate optimization
)
# Get transmission parameters
print(f"Symbol time: {calc.symbol_time} ms")
print(f"Symbol rate: {calc.symbol_rate} symbols/sec")
print(f"Preamble duration: {calc.t_preamble} ms")
print(f"Payload duration: {calc.t_payload} ms")
print(f"Total airtime: {calc.t_total} ms")
print(f"Throughput: {calc.throughput} bps")
print(f"Effective data rate: {calc.effective_data_rate} bps")
print(f"Link budget: {calc.link_budget} dB")
Parameters
| Parameter | Range | Description |
|---|---|---|
tx_power |
-14 to 20 dBm | Transmit power |
payload_len |
0-255 bytes | Payload length |
preamble_len |
6-65535 symbols | Preamble length |
spreading_factor |
6-12 | LoRa spreading factor |
bandwidth |
62.5, 125, 250, 500 kHz | Signal bandwidth |
coding_rate |
5, 6, 7, 8 | Forward error correction (4/5, 4/6, 4/7, 4/8) |
crc |
True/False | Enable CRC check |
explicit_header |
True/False | Use explicit header mode |
low_data_rate_opt |
True/False | Low data rate optimization |
Calculated Properties
| Property | Unit | Description |
|---|---|---|
symbol_time |
ms | Duration of one symbol |
symbol_rate |
symbols/sec | Symbols transmitted per second |
t_preamble |
ms | Preamble duration (programmable symbols only) |
t_preamble_total |
ms | Total preamble including sync word overhead |
n_payload |
symbols | Number of payload symbols |
t_payload |
ms | Payload transmission time |
t_total |
ms | Total time on air |
throughput |
bps | Actual data throughput |
effective_data_rate |
bps | Theoretical channel capacity |
link_budget |
dB | Link budget based on SX1276 receiver sensitivity |
References
Other LoRa Calculator Implementations
Metadata
Release files for lora-calc 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lora_calc-0.1.1.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lora_calc-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / lora_calc-0.1.1.tar.gz
| Download URL | lora_calc-0.1.1.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
32c4eb4cb0122dc8d49b44b1ce3d3921344a2ca78e3408f95e0bd6ba3f0e773d
|
|
BLAKE2b-256 checksum How to use checksums |
463c13d781e3901fb44e0d3e4cbcce65871771124760bbf95916b444ac4b963f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.11 Linux/6.6.87.2-microsoft-standard-WSL2
|
Release files / lora_calc-0.1.1-py3-none-any.whl
| Download URL | lora_calc-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38ef9bfc6f54205c858ea623634089b4302afc996b7c75dfab063a425046c413
|
|
BLAKE2b-256 checksum How to use checksums |
c03424f27e5637f60ed396a18d7788af4d55e3cc808a1dedbb03df18beb7f7bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.11 Linux/6.6.87.2-microsoft-standard-WSL2
|