Thursday, 11 August 2016

raspberry pi lora hoperf python code

clone
https://github.com/mayeranalytics/pySX127x
sudo apt-get install python-dev

wget https://pypi.python.org/packages/source/s/spidev/spidev-3.1.tar.gz
tar xfvz  spidev-3.1.tar.gz
cd spidev-3.1
sudo python setup.py install
sudo pip install Adafruit
sudo pip install httplib2

edit files to account for Uputronics Hoperf board#############
pySX127x/SX127x/board_config.py:
line 33 onwards
change pins for the HAB pi board on CE1:
class BOARD:
  # Note that the BCOM numbering for the GPIOs is used.   
    DIO0 = 16   # RaspPi GPIO 16 = wpi 27 = phys 36 (input)#dio0 on habboard
  #  DIO1 = 12   # RaspPi GPIO 12 = wpi 26 = phys 16 (input)DIO5 on habboard
   # DIO2 = 24   # RaspPi GPIO 24 = wpi 5 = phys 18 (input)#notused
   # DIO3 = 25   # RaspPi GPIO 25 = wpi 6 = phys 22 (input)#notused
    LED  = 13   # RaspPi GPIO 23 = wpi 1 = phys 33 ( make output on ‘internet’ LED)
#################
line 74, in def SpiDev(): and change to
BOARD.spi.open (0,1) #for HOPE module at bus CE1
###################
pySX127x/SX127x/LoRaArgumentParser.py
line 41 onwards
change the default= items in the __init__ self section to the required frequency, spreading factor,bandwidth etc that you are using. Setting them here for 433MHz board means constructing a LoRa object without all the parameters will at least work without defaulting to 868mhz. I have mine set at 434.4mhz
#####################
pySX127x/SX127x/LoRa.py
Line 84 change calibration freq to 433mhz
Line 815 change freq to 433mhz
This just allows the self-test facility to work at 433mhz without supplying further parameters
remove any initialisations for DIO2 onwards
################
you can now run pySX127x/test_lora.py, to see if it works. Do a ‘gpio readall’( part of wiringpi) beforehand, which seems to un-stick it – I guess some wiring pi is not being initialised completely….
#################
I have a blind receiver running continuously, so I just modify the file pySX127x/rx_cont.py:
Line 44: in function
   def on_rx_done(self):
this is where I add my code – and is triggered on each
successful packet reception:IO

1 comment:

  1. it's really nice and meanful. it's really cool blog. Linking is very useful thing.you have really helped lots of people who visit blog and provide them usefull information. live crypto ticker

    ReplyDelete