I’m building a long-range wireless link to forward Modbus-RTU data from an MPPT charge controller over LoRa. I’ve wired up one SX1262-LoRa-DTU to the MPPT’s RS-485 bus and one USB-TO-LoRa-xF on my PC, matched all RF and serial settings—but over LoRa the 37-byte Modbus frames come back missing or garbled, even though a direct USB↔RS-485 test works flawlessly. Below is my setup, what I’ve tried, and where I’m stuck. Code: """integrated_lora_mppt.pyThis script sends a query frame over LoRa (via U - Pastebin.com Example Output:
10:05:54 [INFO] timestamp: 2025-06-15 10:05:54
10:05:54 [INFO] pv_voltage_V: 0.5
10:05:54 [INFO] battery_voltage_V: 168.96
10:05:54 [INFO] charging_current_A: 2.57
10:05:54 [INFO] internal_temp_C: 2892.8
10:05:54 [INFO] external_temp_C: 5120.0
10:05:54 [INFO] operating_status_bits: 00000000
10:05:54 [INFO] charging_status_bits: 00000000
10:05:54 [INFO] control_status_bits: 00000000
10:05:54 [INFO] raw_length: 36
The Data is inaccurate and is messed up the temp is not 2892 lol
When I get the data it is in hexadecimal and is then parsed into the data
Project Goal:
Enable transparent, bi-directional forwarding of real-time MPPT telemetry (PV voltage, battery voltage/current, temperatures, status bits) over a 915 MHz LoRa link, with up to 5 km range, so I can monitor the controller from a laptop without a wired RS-485 connection
Hardware & Modules:
MPPT Controller (RS-485)
Provides Modbus-RTU on A/B/GND at 9600 bps, 8N1.
On-controller LoRa-DTU
Waveshare SX1262-LoRa-DTU-HF in stream mode.
RS-485 interface: A↔MPPT A, B↔MPPT B, common ground
PC LoRa Dongle
Waveshare USB-TO-LoRa-xF on COM3.
Must be switched from default RS-232 to RS-485
AT-Command Configuration:
On both LoRa units (115 200 bps, 8N1, CR+LF):
+++
AT+SF=9 ← Spreading Factor 9
AT+BW=0 ← 125 kHz bandwidth
AT+CR=1 ← Coding rate 4/5
AT+PWR=22 ← TX power 22 dBm
AT+NETID=0 ← Network ID 0
AT+LBT=0 ← Disable LBT
AT+TXCH=18 ← RF channel 18 (~915 MHz)
AT+RXCH=18 ← Same channel
AT+PORT=2 ← RS-485 (instead of RS-232)
AT+MODE=1 ← Stream/transparent mode
AT+BAUD=9600 ← RS-485 baud = 9600 bps
AT+COMM=“8N1” ← 8 data bits, No parity, 1 stop bit
AT+EXIT ← Save settings & reboot
Power-cycle both modules to apply .
Software & Direct Test
Direct USB↔RS-485 (COM5 @ 9600 bps) returns a clean 37-byte Modbus frame every 5 s with my Python script
LoRa Path (COM3 @ 9600 bps after AT+BAUD) sends the same 8-byte query plus CRC, sleeps 1 s, then read(37) bytes—results are often 0 bytes or partial/garbled data
Troubleshooting Steps Taken:
Verified direct PC→MPPT test works → MPPT and Python code are correct.
Matched RF parameters SF/BW/CR/NETID/Channel on both modules
Checked wiring: A↔A, B↔B, shared ground.
Increased Python delays/timeouts to allow for LoRa airtime
Ensured no port conflicts on COM3
Questions & Areas for Advice Could a baud-rate mismatch—for example if one module didn’t actually switch to 9600 bps—be causing this garbling?
Is RF interference on channel 18 (915 MHz) or noisy spectrum a common culprit for partial/zero frames?