
New week, new layer of the stack. The last two weeks were all LoRa and mesh — radio stuff. Starting today I'm looking at the wired side, because apparently the SQC485Iv2 node's whole job is bridging a wired RS485 bus to the LoRa mesh, and I've been treating that RS485 half as a black box. Wei told me to stop doing that.
RS232 is the one I already half-knew. It's the old serial-port standard — single-ended signaling, meaning each signal wire (TX, RX) is referenced against a shared ground, and the voltage on that one wire relative to ground is what encodes the bit. It's point-to-point: one transmitter, one receiver, one cable between exactly two devices. Over any real distance, or in an electrically noisy environment, that shared-ground single-ended signal picks up noise easily, and the practical cable length limit is short — on the order of 15 meters at higher baud rates, sometimes a bit more at low speed.
RS485 fixes this with differential signaling. Instead of one signal wire referenced to ground, RS485 uses a pair of wires (commonly labeled A/B, or D+/D-) and encodes the bit as the voltage difference between them. Any noise that hits the cable tends to hit both wires roughly equally — it's "common mode" noise — and because the receiver only cares about the difference between A and B, that common noise mostly cancels out. This is the same basic trick differential pairs use elsewhere (USB, Ethernet twisted pairs), and it's why RS485 can run reliably over much longer cable — the spec is commonly cited as supporting up to 1200 meters at lower baud rates, and it tolerates electrically messy industrial environments (motors, relays, switching power supplies) far better than single-ended RS232 ever could.
The other big difference: multi-drop. RS232 is strictly one-to-one. RS485 is a genuine bus — you can wire dozens of devices (the spec allows up to 32 standard-load unit transceivers, more if devices use lower-load drivers) onto the same two wires, and each device gets its own address so it only responds when addressed. That's the part that actually explains why an industrial site would use it: one building might have a dozen sensors, meters, and relay boxes scattered around, and RS485 lets you run one twisted-pair cable through all of them in a daisy chain instead of a dedicated cable back to a controller for each device.
Putting it together: RS485 is the physical/electrical layer only — it just defines how bits get pushed onto that A/B pair. It doesn't say anything about addressing, request/response order, or what a "device" even means on the bus. That's a separate protocol layer sitting on top, and apparently that's exactly what I'm covering tomorrow: Modbus RTU, which is the thing that actually turns "a bunch of devices sharing two wires" into an orderly conversation. I can see now why the SQC485Iv2 needs both pieces — RS485 gets the bits there reliably, Modbus decides who's allowed to talk when.
One thing I still want to double check with Wei: the exact termination resistor setup (120Ω at each end of the bus) and why an unterminated or improperly biased RS485 line causes read errors — I understand it's a reflection/impedance-matching issue but I haven't traced through the physics myself yet.

新的一週,換一層來看。前兩週都在講 LoRa 和 mesh,是無線那邊的東西。從今天開始我要看有線這半邊,因為聽說 SQC485Iv2 節點的主要工作就是把一條有線的 RS485 bus 橋接到 LoRa mesh 上,而我之前一直把 RS485 那半邊當黑盒子沒管。Wei 說不能再這樣了。
RS232 是我原本就有點熟的那個。 這是老牌的 serial port 標準——單端訊號(single-ended),意思是每條訊號線(TX、RX)都是相對於一條共用的接地線去比較電壓,用那條訊號線相對 ground 的電壓來編碼位元。它是點對點的:一個發送端、一個接收端、兩個裝置之間一條線。只要距離拉長一點,或是在電氣雜訊比較多的環境,這種共地單端訊號很容易吃到雜訊,實際的纜線長度上限也不長——在較高鮑率下大概只有 15 公尺左右,低速時可以稍微長一點。
RS485 用差動訊號(differential signaling)解決這個問題。 它不是用一條訊號線對地,而是用一對線(常標成 A/B,或 D+/D-),把位元編碼成這兩條線之間的「電壓差」。雜訊打到纜線上時,通常會同時打到兩條線、幅度差不多——這叫 common mode noise——而因為接收端只在乎 A 和 B 之間的差值,這種共模雜訊大部分會互相抵銷。這跟 USB、Ethernet 的雙絞線用的是同一套基本招數,也是為什麼 RS485 可以在更長的纜線上穩定運作——規格上常引用的數字是低鮑率下可到 1200 公尺,而且對馬達、繼電器、切換式電源這類電氣雜訊多的工業環境,耐受度遠比單端的 RS232 好。
另一個大差異是 multi-drop。 RS232 嚴格來說是一對一。RS485 是真正的匯流排(bus)——同一對線上可以接幾十個裝置(規格上標準負載的收發器最多到 32 個,如果裝置用低負載的驅動器可以接更多),每個裝置有自己的位址,只有被叫到名字時才回應。這就是真正說明為什麼工業現場會用它的地方:一棟建築裡可能散布著十幾個感測器、電表、繼電器箱,RS485 讓你用一條雙絞線串接過去,而不用每個裝置都拉一條獨立的線回控制器。
整理一下:RS485 只是實體/電氣層——它只定義位元怎麼被送上那對 A/B 線。它完全沒講到定址、request/response 的順序,甚至「一個裝置」在 bus 上到底是什麼意思。這些是疊在上面的另一層協定,而聽說明天要看的正好就是這個:Modbus RTU,真正把「一群裝置共用兩條線」變成有秩序對話的東西。現在可以理解為什麼 SQC485Iv2 兩塊都需要——RS485 負責把位元可靠地送到,Modbus 負責決定誰在什麼時候可以講話。
還有一件事想再跟 Wei 確認:兩端各接一顆 120Ω 終端電阻的確切配置,以及沒接終端或偏壓沒設好的 RS485 線為什麼會導致讀取錯誤——我理解是反射/阻抗匹配的問題,但物理層面自己還沒真的推過一遍。