Send Lora message to non pycom device



  • Hi,
    I just got my LoPy device up and running, I'm using a simple script to send a "hello" message via Lora to another Lora board, the connect2Pi;
    http://www.lprs.co.uk/development-tools/evaluation-tools/easyradio-usb-rf-dongles/eraconnect2pi-rf-dongle.html

    Here's my script:

    from network import LoRa
    import socket
    import machine
    import time

    lora = LoRa(mode=LoRa.LORA, frequency=863000000)
    s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
    counter = 0
    while True:

    s.setblocking(True)
    s.send('Hello')
    print('Hello sent...{}'.format(counter))
    counter += 1
    
    
    if counter >= 100:  # reset counter at 100
        counter = 1
    time.sleep(1)
    

    My connect2Pi does not seem to be receiving any data. It has the following settings:

    channel0
    Power level: P9
    Bandwidth: B0
    Band Plan: b0

    I'm by no means a Lora expert but has anyone any ideas/ suggestions?

    Thanks,

    Paul



  • @jmarcelino said in Send Lora message to non pycom device:

    You just need to come with with a common set of values for both modules and in the LoPy case set those when initializing the LoRa class

    Hi again, sorry for the delay in the update. So below is what I've set my LOPY to:

    lora = LoRa(mode=LoRa.LORA, region=LoRa.EU868, sf=12, frequency=869850000, bandwidth=LoRa.BW_125KHZ, public=True)
    s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)

    Seems fairly standard, but what does the "public" parameter do?

    On the ERA-LORA side via the companion GUI software I have the following st:

    Bandplan (frequency): 869.85MHz
    Bandwidth: 125KHz
    Channel: 0
    Spreading Factor: 12

    This seems to be a match on both sides though I still cannot get them to communicate :(

    Does the LOPY use any encryption by default?

    Any other defaults I need to be aware of?

    Thanks,

    Paul



  • @jmarcelino Hello again,
    thanks for your reply, below is my current script on the LoPy:

    from network import LoRa
    import socket
    import machine
    import time
    # initialize LoRa in LORA mode
    # more params can also be given, like frequency, tx power and spreading factor
    lora = LoRa(mode=LoRa.LORA, frequency=869850000, sf=10, bandwidth=LoRa.BW_250KHZ, public=True)
    # create a raw LoRa socket
    s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
    
    counter = 0
    while True:
        # send some data
        s.setblocking(True)
        s.send('Hello_from_LoPy')
        print('Hello_from_LoPy...{}'.format(counter))
        counter += 1
    
        # get any data received...
        s.setblocking(False)
        data = s.recv(64)
        print(data)
        if counter >= 100:  # reset counter at 100
            counter = 1
        time.sleep(1)
        # wait a random amount of time
        time.sleep(5)
        #time.sleep(machine.rng() & 0x0F)
    


  • @pkilcoyne
    What does your LoRa initialisation look like? Are you setting LoRa.BW_500KHZ etc?

    You may have to play with the public and rx_iq settings. Sorry I don’t know what your other device expects for those.



  • @jmarcelino Hi again,
    so what I've done since is send messages between two LPRS devices sucessfully. The LoPy does not seem to receive these messages nor does it's programmed TX messages be received by either LPRS device.

    Right now I have two parallel "lora" networks, one of two LPRS devices sending and receiving messages and one of two LoPy devices.

    Maybe they just aren't meant to work together.

    Paul



  • @pkilcoyne
    Group ID is not a LoRa radio parameter so I'd guess it's just some data that gets sent - like a number prefix.

    Once you match the two unit's radio parameters try to see if you receive any data on the LoPy if you try to send from your device... maybe the Group ID will show up there.

    I guess you can also ask the manufacturer to explain what Group ID is.



  • @jmarcelino said in Send Lora message to non pycom device:

    set

    Hi again,
    thanks for the link, I've looked through it and I've matched relevant parameters. Also, I've contacted the manufacturer and they said I also need to match the "group ID", default is 1234, but I cannot see any reference to this parameter in the Pycom documentation.

    Any ideas?

    Thanks,

    Paul



  • @pkilcoyne
    All the information you need how to set the module and what frequencies their “channels” really mean is in their datasheet.
    http://www.lprs.co.uk/assets/files/eRA_LoRa_FCC_V1.22.pdf

    You just need to come with with a common set of values for both modules and in the LoPy case set those when initializing the LoRa class



  • @jcaron

    os.uname()
    (sysname='LoPy', nodename='LoPy', release='1.10.1.b1', version='v1.8.6-839-g536c958c on 2017-11-15', machine='LoPy with ESP32', lorawan='1.0.0')

    Antenna attached.

    I don't know how to match band plan / channel to the frequency I'm sending on :(

    Do you mean UART data rates or rates at which I send over the air? Not sure how to adjust these.

    Thanks,

    Paul



  • @xykon said in Send Lora message to non pycom device:

    Can you please confirm which module you're trying to use?

    Yes sorry about my first post, the latter module is the one I'm actually using, the ERA-LORA.

    For the ERA-LORA there is a companion software where you can select the following attributes:

    Radio power level: P9 - the highest
    Channel: 0 ( 0-31)
    bandwidth: 500kHz
    band plan: b0 - 869.85MHz
    Spreading Factor: SF10

    I just don't know how to match the above with the LoPy modules so they can communicate.

    Regards,

    Paul


  • administrators

    @pkilcoyne That is not the same module you linked in your initial post.

    Can you please confirm which module you're trying to use?



  • @xykon said in Send Lora message to non pycom device:

    aybe I'm missing something but I can't see any mention of that thing using LoRa.

    I found this, which mentions LoRa, on their website:

    http://www.lprs.co.uk/products/easyradio-ism-modules/era-lora-through-hole-modules.html

    Curious...



  • Thanks all,
    so the EasyRadio modules not being LoRa I wasn't testing like with like...got it.

    Many thanks,

    Paul



  • Yes, the LPRS easyRadio system is based on the TI CC430F5137 and uses FSK not LoRa.


  • administrators

    @pkilcoyne said in Send Lora message to non pycom device:

    http://www.lprs.co.uk/development-tools/evaluation-tools/easyradio-usb-rf-dongles/eraconnect2pi-rf-dongle.html

    According to the datasheet: Utilising proprietary LPRS easyRadio technology operating in the 868MHz (UK & Europe) & 915MHz (US) Industrial Scientific & Medical (ISM) bands the Connect2Pi USB ‘dongle’ provides a simple ‘wireless bridge’ between Raspberry Pi (Pi2Pi), a Raspberry Pi and a PC or any other device that supports USB serial communications.

    Maybe I'm missing something but I can't see any mention of that thing using LoRa.



  • @pkilcoyne A few things to check:

    • have you properly upgraded the LoPy firmware (os.uname will tell you the version you're running)?
    • do you have an antenna connected to the LoPy, on the right port (the one next to the LED)?
    • does the band plan / channel match the frequency you're sending on?
    • have you tried setting different data rates?

Log in to reply
 

Pycom on Twitter