snr margin
snr_marginComputes LoRa link SNR margin by comparing received power against the noise floor and the spreading-factor-dependent demodulation threshold from the Semtech SX1276 datasheet. Calculates receiver noise floor from thermal noise (-174 dBm/Hz), channel bandwidth, and receiver noise figure. Returns margin in dB and a boolean link-OK indicator. Use to validate whether a LoRa or Meshtastic link will reliably decode packets. Accepts rx_power from link_budget tool output for end-to-end chain analysis.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sf | No | LoRa spreading factor (7-12). Higher SF tolerates lower SNR. | |
| bw_khz | No | LoRa channel bandwidth in kHz. Affects noise floor. | |
| rx_power_dbm | Yes | Received signal power in dBm (e.g., -110). Typically from a link budget calculation or field measurement. | |
| noise_figure_db | No | Receiver noise figure in dB. Typical LoRa radio NF is 6 dB (SX1276). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| link_ok | Yes | True if margin_db > 0 (signal exceeds demodulation threshold). | |
| margin_db | Yes | SNR margin above demodulation threshold in dB. Positive = link OK, negative = link failure. | |
| noise_floor_dbm | Yes | Receiver noise floor in dBm, computed from bandwidth and noise figure. | |
| required_snr_db | Yes | Minimum SNR required for successful LoRa demodulation at the given SF. |