Skip to main content

Crate pamoja_lora

Crate pamoja_lora 

Source
Expand description

LoRa link math for the pamoja SDK.

LoRa is the SDK’s answer to reach: kilometers of range on license-free bands at tiny power. That reach comes with a hard constraint, though. A LoRa transmission occupies the channel for a duration fixed by the radio settings, and the regional regulations a deployment lives under cap how much of the time a node may transmit, typically around one percent. A node that ignores this is both illegal and, since transmitting is the most expensive thing it does, wasteful of its battery.

This crate provides the arithmetic that keeps a long-range node honest, with no radio and no floating point:

  • LinkSettings - the spreading factor, bandwidth, coding rate, and frame options of a link, with airtime_us for a payload’s exact time on air and min_off_time_us for the silence a duty-cycle limit then forces.
  • budget - the link budget, in hundredths of a decibel: EIRP, free-space loss, the first Fresnel zone, receiver sensitivity from the noise floor and the demodulator SNR, the margin a path leaves, and the transmit power a regional ceiling or 47 CFR 15.247 allows through an antenna.

The time-on-air calculation is the published LoRa formula, evaluated with exact integer arithmetic, so the same numbers a deployment planner uses are available on the node itself. It pairs naturally with the metered-link batch encoding in pamoja-codec - pack a batch, then ask what it costs to send - and with the duty-cycling in pamoja-power.

The crate drives no radio. It is the arithmetic a radio driver and a deployment plan both work from.

§Examples

use pamoja_lora::LinkSettings;

let link = LinkSettings::new(12, 125_000); // SF12, 125 kHz: maximum range
let airtime = link.airtime_us(20); // time on air of a 20-byte payload

// At a 1% duty cycle, the node must then stay quiet for ninety-nine times as long.
assert_eq!(link.min_off_time_us(20, 10), airtime * 99);

Modules§

budget
Link budgets: how much signal a LoRa link has to spend, and where it goes.
region
Regional parameters: what a LoRaWAN radio may do, and where.

Structs§

LinkSettings
The radio settings of a LoRa link, enough to compute its time-on-air.