pamoja-radios
The Semtech SX126x and SX127x LoRa radios and the SX1302 and SX1303 gateway concentrators: their commands, registers, and decoders, the amplifier setting a regional EIRP ceiling allows, a duty-cycle guard, and simulated chips that stand in for a module. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.
Install
pip install pamoja-radios
from pamoja import radios
This pulls in pamoja-native, the compiled engine. pip install pamoja is the whole framework in one package.
Example
The script the test suite runs, spliced here as it ran.
From bindings/python/guides/radios.py:
from pamoja.lora import LinkBudget, plan_for
from pamoja.radios import DutyCycle, SimulatedLoraChip, sx126x
# An SX1262 node sends a ten-byte reading on 868.1 MHz at DR3, SF9 at 125 kHz, through a
# 2.15 dBi whip on half a decibel of pigtail. The plan caps the EIRP there, and the antenna
# and pigtail decide how hard the amplifier may drive under that cap.
eu868 = plan_for("EU868")
frequency = 868_100_000
link = eu868.link_settings(3)
whip = LinkBudget(transmit_antenna_gain_dbi=2.15, transmit_cable_loss_db=0.5)
ceiling = eu868.max_eirp_dbm(frequency)
power = sx126x.tx_power_under_ceiling(sx126x.Amplifier.HIGH_POWER, whip, ceiling)
print(f"power {power.setting_dbm} dBm under a {ceiling} dBm EIRP ceiling")
# A simulated SX1262 stands in for the chip on the node's board, driven by the same code that
# drives a real one, and it reports what that code told it.
chip = SimulatedLoraChip.sx126x(sx126x.Amplifier.HIGH_POWER)
bench = chip.radio()
bench.configure(frequency, link, power.setting_dbm)
tuned = chip.tuning()
print(
f"tuned {tuned.frequency_hz / 1e6:.1f} MHz, SF{tuned.link.spreading_factor} "
f"at {tuned.link.bandwidth_hz // 1000} kHz, {tuned.output_dbm} dBm"
)
# The reading goes out, and the airtime comes back for the duty-cycle guard. The sub-band that
# holds 868.1 MHz allows 1% of the time, so the frame buys ninety-nine times as long in silence
# before the next.
reading = b"level=0.42"
airtime = bench.transmit(reading)
print(f"sent {len(chip.sent()[0].payload)} bytes, {airtime} us on air")
guard = DutyCycle(eu868.duty_cycle_permille(frequency))
guard.transmitted(0, link, len(reading))
print(f"silence the next frame starts {guard.wait_us(0)} us after this one did")
# A gateway's answer arrives from the edge of range, 2.5 dB under the noise.
chip.hear(b"ack", -109, -2.5)
heard = bench.receive(1_000_000)
if heard.outcome == "Frame":
print(
f"received {heard.payload.decode()} at {heard.rssi_dbm:.2f} dBm, "
f"SNR {heard.snr_db:.2f} dB"
)
# With nothing on the air the reception times out, and a frame whose CRC fails is dropped
# rather than handed over.
quiet = bench.receive(1_000_000).outcome
chip.hear_corrupt(-121, -12)
broken = bench.receive(1_000_000).outcome
print(f"then {quiet}, then {broken}")
bench.close()
The same capability in every language
| Language | Package | Reference |
|---|---|---|
| Rust | pamoja-radios |
reference, docs.rs, install |
| TypeScript | @pamoja/radios |
reference, install |
| Python | pamoja-radios |
reference, install |
| C# | Pamoja.Radios |
reference, install |
Documentation
pamoja.radiosreference, every class and function in this module.- The LoRa radios guide, with the same example in Rust, TypeScript, and C#.
- Every capability, and the install page.
License
MIT
Release files for pamoja-radios 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pamoja_radios-0.2.0.tar.gz | 12.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pamoja_radios-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.8 kB
Release files / pamoja_radios-0.2.0.tar.gz
| Download URL | pamoja_radios-0.2.0.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33bf9910112cf79601b6d4e6095e5f224b1b3b1a1c8e60988b3841820ca99c09
|
|
BLAKE2b-256 checksum How to use checksums |
c282d0970bb84d8b03dd60dc1f21822bda450e4b7ce65116f099c4e56ee8aef8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / pamoja_radios-0.2.0-py3-none-any.whl
| Download URL | pamoja_radios-0.2.0-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b2cf4aaf12c935c0e5f2ff0031c6c7dcb1c56e0736035f885e6cff74ef0bc178
|
|
BLAKE2b-256 checksum How to use checksums |
d55c92d5516ccfe8af4ca7935b7103c44fc4450d8f4c4f6fa9f5ba1c8d3a40b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|