Close

HopeRF RFM98 Lora Raspberry Pi Python code

A project log for AIS repeater

Solar powered AIS repeater, to relay AIS messages from receiver on nearby hill back home via LoRa

stevesteve 07/28/2016 at 11:170 Comments

I have ported the receiver code to Python, based on this library for the 868 inair9 LoRa unit, modified for the HopeRF RFM98W on 434MHz on the UPUtronics Pi shield on SPI CE1

https://github.com/mayeranalytics/pySX127x

I will post the code later. Basically you need to

1) install wiring pi http://wiringpi.com/ using git

git clone git://git.drogon.net/wiringPi

2) clone the Mayer analytics library

git clone https://github.com/mayeranalytics/pySX127x.git

inside the pySX127x/SX127x folder, change:

board_config.py

match the DIO0 and 5 pins of the UPUtronics board (DIO0 = rxdone/txdone/cadDone flags, dio5 = data detected flag

class BOARD:

  # Note that the BCOM numbering for the GPIOs is used.    
    DIO0 = 16   # RaspPi GPIO 16 = wpi 27 = phys 36 (input)
    DIO1 = 12   # RaspPi GPIO 12 = wpi 26 = phys 16 (input)DIO5 on habhub
    #
    DIO2 = 24   # RaspPi GPIO 24 = wpi 5 = phys 18 (input)
    DIO3 = 25   # RaspPi GPIO 25 = wpi 6 = phys 22 (input)
    #LED  = 18   # RaspPi GPIO 18 = wpi 1 = phys 12 (output) 
    LED  = 13   # RaspPi GPIO 23 = wpi 1 = phys 33 ( make output) 
    #connects to the LED on the proto shield
    SWITCH = 4  # RaspPi GPIO 4 connects to a switch
also set SPI to CE1 if this applies (UPUtronics board default 1 module population is on CE1 SPI)
def SpiDev():
BOARD.spi.open (0,1) #for CE1

LoRaArgumentParser.py

change the defaults in the __init__ section to the required frequency, spreading factor etc. This allows the test utiliities to work with yout 433MHz board without specifying further parameters

LoRa.py

change default values for frequency from 868 to 433MHz (search for '86')

you can now run test_lora.py, and in my case, start modifying rx_cont.py at the function

   def on_rx_done(self):

That has made logging the battery level to Adafruit.io a piece of (fruit)cake, so now it is logged there as well as thingspeak

https://io.adafruit.com/steve098/aismon#

Discussions