"Day 7/30: LoRa's Three Big Knobs — Spreading Factor, Bandwidth, Coding Rate"

a chirp waveform labeled with SF, BW and CR

Last day of RF fundamentals week. I wanted to close it out by actually understanding the parameters you configure on a LoRa radio, instead of just knowing that "LoRa is good at range." Today was about building intuition for three settings: spreading factor, bandwidth, and coding rate. I'm deliberately keeping this conceptual rather than diving into the math, because that's about where my own understanding is right now.

Spreading Factor (SF), ranging from SF7 to SF12, controls how much a symbol gets "spread out" in time. My mental model, which I want to double-check with Wei because I'm not 100% sure it's precise: a higher spreading factor means each bit of information is represented by a longer, more redundant chirp, which makes it easier for a receiver to pull the signal out of noise — hence longer range and better robustness. The cost is airtime: a higher SF takes longer to transmit the same amount of data, so your effective data rate drops. SF7 is the fastest and shortest-range of the bunch (relatively speaking), SF12 is the slowest and longest-range. It's a genuine tradeoff, not a free lunch — you pick based on what the link actually needs.

Bandwidth (BW) is the width of the frequency channel the signal is spread across — common values I saw were 125 kHz, 250 kHz, and 500 kHz. Wider bandwidth lets you push more data through in the same amount of time (higher data rate), but it also means the receiver is looking at a wider slice of spectrum, which generally means more noise gets let in and the effective range shrinks. Narrower bandwidth is slower but gets you a better noise-to-signal situation and more range. So bandwidth and spreading factor are pulling in related directions — both are ultimately range-vs-speed tradeoffs, just via different mechanisms.

Coding Rate (CR) is about forward error correction — adding redundant bits so the receiver can detect and correct some number of errors without needing a retransmission. As I understand it, a higher coding rate (more redundancy) means the link is more robust against interference and dropped bits, but it comes at the cost of effective data rate, since some of your airtime is spent on redundancy rather than actual payload. Lower redundancy means more of your airtime carries real data, but less protection if the channel is noisy.

Putting all three together, the intuition I'm walking away with: every one of these three knobs is fundamentally trading "robustness/range" against "speed/airtime," just through different mechanisms — how long each symbol is, how wide a slice of spectrum you're using, and how much redundancy you're baking into the data. Tuning a LoRa link is about picking a point in that space that matches what the deployment actually needs: a sensor that reports rarely from a hard-to-reach spot wants range and robustness even at low speed, while something that needs to move more data quickly and is closer to its receiver can afford to trade some of that away for speed.

That's a wrap on week one. Next week I'm told the plan is RS485 and Modbus, which is a big shift from RF theory into the wired side of what a lot of our sensors actually connect to — looking forward to it.

chirp 波形圖上標示 SF、BW、CR

RF 基礎週的最後一天。我想用真正搞懂 LoRa radio 上實際會設定的參數來收尾,而不是只停在「LoRa 傳得遠」這種程度。今天的目標是建立對三個設定的直覺:spreading factor、bandwidth、coding rate。我刻意保持在概念層次,不深入數學,因為老實說我目前的理解大概也就到這個程度。

Spreading Factor(SF),範圍從 SF7 到 SF12,控制的是一個符元(symbol)在時間上被「展開」多少。我目前的心智模型——這點我想找 Wei 再確認一下,因為我不是百分之百確定精不精準——是:spreading factor 越高,代表每一位元的資訊是用一個更長、冗餘度更高的 chirp 來表示,這讓接收端更容易把訊號從雜訊裡拉出來——所以距離更遠、穩健度更好。代價是 airtime:SF 越高,傳送同樣一份資料要花的時間就越長,有效資料速率也就跟著下降。SF7 是這一組裡(相對而言)最快、距離最短的,SF12 是最慢、距離最遠的。這是真正的取捨,不是白吃的午餐——要根據鏈路實際需要什麼來選。

Bandwidth(BW,頻寬) 是訊號被展開的那段頻率通道的寬度——我看到常見的數值有 125 kHz、250 kHz、500 kHz。頻寬越寬,同樣時間內能塞進去的資料就越多(資料速率更高),但也代表接收端要看的是一段更寬的頻譜切片,通常意味著會放進更多雜訊、有效距離也會縮短。頻寬較窄則比較慢,但能換來更好的訊噪比跟更遠的距離。所以 bandwidth 跟 spreading factor 拉的其實是相近的方向——兩者本質上都是距離換速度的取捨,只是透過不同的機制達成。

Coding Rate(CR) 講的是前向錯誤更正(forward error correction)——加入冗餘位元,讓接收端能在不需要重傳的情況下偵測、更正一定數量的錯誤。照我的理解,coding rate 越高(冗餘越多)代表鏈路對干擾跟位元遺失的抵抗力越強,但代價是有效資料速率下降,因為部分 airtime 被拿去傳冗餘資訊而不是實際的 payload。冗餘較低則代表 airtime 大部分都在傳真正的資料,但如果通道雜訊比較大,保護力就比較弱。

把這三個放在一起看,我今天帶走的直覺是:這三個旋鈕本質上都是在「穩健度/距離」跟「速度/airtime」之間做取捨,只是透過不同的機制——每個符元多長、用了多寬的頻譜切片、資料裡包了多少冗餘。調整一條 LoRa 鏈路,就是在這個空間裡選一個符合部署實際需求的點:一個從難以觸及的地點、很少回報的感測器,即使速度低也想要距離跟穩健度;而需要比較快傳輸較多資料、又離接收端比較近的東西,則可以拿一部分穩健度去換速度。

第一週就這樣告一段落了。聽說下週的計畫是 RS485 跟 Modbus,這是從 RF 理論很大一步跳到有線那一側——也就是我們很多感測器實際連接的東西——蠻期待的。