I’ve been working on setting up a small network where I have two Heltec Wifi LoRa 32 V2 communicate with each other. I have both of these LoRa nodes connected to a RaspberryPi and I would like to be able to run the receiver and transmitter code on these Pi’s.
I’ve outlined my current process below, please let me know if anyone has suggestions. The current setup isn’t working correctly and I’m not sure if it’s a physical, hardware, or software issue.
Specifications:
RaspberryPi 3 Model B
Heltec Wifi Lora 32 V2
This is my current setup for the receiver:
Pin Mapping:
Raspberry Pi | Lora – SX1278 Module |
---|---|
3.3V | 3.3V |
Ground | Ground |
GPIO 10 | MOSI |
GPIO 9 | MISO |
GPIO 11 | SCK |
GPIO 8 | CS |
GPIO 4 | DIO 0 |
GPIO 17 | DIO 1 |
GPIO 18 | DIO 2 |
GPIO 22 | RST |
Below is the following python code I’ve used for the receiver module.
The transmission code is c code I know transmits properly and have uploaded directly to the other LoRa module chip via the Arudino IDE.
Code:
from time import sleep
from SX127x.LoRa import *
from SX127x.board_config import BOARDBOARD.setup()
class LoRaRcvCont(LoRa):
def init(self, verbose=False):
super(LoRaRcvCont, self).init(verbose)
self.set_mode(MODE.SLEEP)
self.set_dio_mapping([0] * 6)def start(self): self.reset_ptr_rx() self.set_mode(MODE.RXCONT) while True: sleep(.5) rssi_value = self.get_rssi_value() status = self.get_modem_status() print(rssi_value) print(status) sys.stdout.flush() def on_rx_done(self): print("\nReceived: ") self.clear_irq_flags(RxDone=1) payload = self.read_payload(nocheck=True) print(bytes(payload).decode("utf-8",'ignore')) self.set_mode(MODE.SLEEP) self.reset_ptr_rx() self.set_mode(MODE.RXCONT)
lora = LoRaRcvCont(verbose=False)
lora.set_mode(MODE.STDBY)#Medium Range Defaults after init are 915.0MHz, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on 13 dBm
lora.set_pa_config(pa_select=1)
try:
lora.start()
except KeyboardInterrupt:
sys.stdout.flush()
print("")
sys.stderr.write(“KeyboardInterrupt\n”)
finally:
sys.stdout.flush()
print("")
lora.set_mode(MODE.SLEEP)
BOARD.teardown()
My console output looks like the following repeated infinitely:
-157
{‘rx_coding_rate’: 0, ‘modem_clear’: 0, ‘header_info_valid’: 0, ‘rx_ongoing’: 0, ‘signal_sync’: 0, ‘signal_detected’: 0}