Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    LoPy - Raw Lora mode for connecting TTN

    Scheduled Pinned Locked Moved LoPy
    loralorawanlora classnodelopy
    4 Posts 2 Posters 681 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      aniket_yeole
      last edited by

      Hello,

      I am trying to change the parameters of my LoRa node by configuring the node is raw mode i.e (LoRa(mode=LoRa.LORA)). But I am getting following error

      {

      Traceback (most recent call last):
      File "<stdin>", line 25, in <module>
      OSError: the requested operation is not possible

      Pycom MicroPython 1.18.1.r1 [v1.8.6-849-b0520f1] on 2018-08-29; LoPy4 with ESP32
      Type "help()" for more information.

      }

      My sample code is as follows:

      {

      import time
      import pycom
      import network
      from network import LoRa
      import struct
      import ubinascii
      import binascii
      import socket
      import pycom
      import time

      lora = LoRa(mode=LoRa.LORA, frequency=868100000, power_mode=LoRa.ALWAYS_ON, tx_power=14, bandwidth=LoRa.BW_250KHZ, sf=7, preamble=8, coding_rate=LoRa.CODING_4_5, tx_iq=False, rx_iq=False)

      lora.init(mode=LoRa.LORA, frequency=868100000, power_mode=LoRa.ALWAYS_ON, tx_power=14, bandwidth=LoRa.BW_250KHZ, sf=7, preamble=8, coding_rate=LoRa.CODING_4_5, tx_iq=False, rx_iq=False)

      app_eui = ubinascii.unhexlify('xxxxxxxxxxxxxxxxxxxxxxx')
      app_key = ubinascii.unhexlify('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')

      lora.join(activation=LoRa.OTAA, auth=(app_eui, app_key), timeout=0)
      while not lora.has_joined():
      time.sleep(2.5)
      print('Not yet joined...')
      if lora.has_joined():
      time.sleep(2.5)
      print ("Joined the network")
      s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
      s.setsockopt(socket.SOL_LORA, socket.SO_DR, 5)

      pycom.heartbeat(False)
      while True:
      s.setblocking(True)
      s.send("30")
      time.sleep(1.5)
      }

      I would like to know if it is even possible to configure the node in raw Lora mode for connecting it to TTN network server?

      If yes where am I going wrong ?

      (Note: I am using a multichannel gateway)

      Please help

      Thanks and Regards,
      Aniket

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        jcaron @aniket_yeole
        last edited by

        @aniket_yeole what exactly are you trying to achieve? Connecting to the network means using LoRaWAN, so why would you want/need to use raw LoRa? That would require you to re-implement the LoRaWAN stack yourself.

        By definition, if you use raw LoRa, you can’t use join as that’s part of LoRaWAN...

        Just use LoRaWAN mode and you should be all set...

        A 1 Reply Last reply Reply Quote 0
        • A Offline
          aniket_yeole @jcaron
          last edited by aniket_yeole

          @jcaron
          I wanted to change the parameters like BW, Spreading Factor, Transmitting Power and to transmit on particular frequency manually. How to enforce the lopy to do it in LoRaWAN mode?

          J 1 Reply Last reply Reply Quote 0
          • J Offline
            jcaron @aniket_yeole
            last edited by

            @aniket_yeole you can change some of the parameters (including SF) using setsockopt. To change the frequency you’ll need to remove all channels and re-add channels with your chosen frequency. But beware, the network can change those settings via MAC commands.

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • 1 / 1
            • First post
              Last post

            Pycom on Twitter

            Pycom