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

    LoPy4 lora range test

    Scheduled Pinned Locked Moved LoPy
    15 Posts 4 Posters 163 Views 5 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.
    • K Offline
      kjm @jcaron
      last edited by kjm

      @jcaron Tnx that ping-pong looks like a good starting point. I'd like to mod that example you suggested to pulse the rgb with a colour that indicates received signal strength. Is there a doc that shows how to get lora RF signal strength on a lopy4? Also where to do I find out how to set things like spreading factor etc.

      J robert-hhR 2 Replies Last reply Reply Quote 0
      • J Offline
        jcaron @kjm
        last edited by

        @kjm ˋLoRa.stats` is what you are looking for.

        1 Reply Last reply Reply Quote 0
        • robert-hhR Offline
          robert-hh @kjm
          last edited by

          @kjm with raw lora, you can set the SF and BW values themselves using lora methods. With lorawan you can set the data rate with socket calls, which in turn changes sf and bw. DR0 results in SF12BW125 in the EU region.

          K 1 Reply Last reply Reply Quote 0
          • K Offline
            kjm @robert-hh
            last edited by kjm

            @robert-hh I got a raw lora Tx running.

            from network import LoRa
            import socket, time, pycom
            red=0x7f0000; orange=0xff5100; yellow=0x7f5100; green=0x007f00; cyan=0x007f7f; blue=0x00007f; magenta=0x7f007f; off=0x000000; white=0x7f7f7f
            
            lora = LoRa(mode=LoRa.LORA, region=LoRa.AU915)
            s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
            s.setblocking(False); lora.sf(12); pycom.heartbeat(False)
            
            while 1:  pycom.rgbled(green); s.send('Ping'); time.sleep(1); pycom.rgbled(off); time.sleep(9)
            

            It's showing 0.5w on my Bird RF wattmeter (I thought 20dBm was supposed to be 0.1watt ?) but anyway at least it's pushing some RF out the correct antenna socket.

            Less luck with an Rx

            from network import LoRa
            import socket, time, pycom
            red=0x7f0000; orange=0xff5100; yellow=0x7f5100; green=0x007f00; cyan=0x007f7f; blue=0x00007f; magenta=0x7f007f; off=0x000000; white=0x7f7f7f
            
            lora = LoRa(mode=LoRa.LORA, region=LoRa.AU915)
            s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
            s.setblocking(False); lora.sf(12); pycom.heartbeat(False)
            
            while 1:
                if s.recv(64)==b'Ping': 
                  print(lora.stats())
                  pycom.rgbled(green)
                else: time.sleep(1)
            

            which crashed with

            E (392) esp_image: Checksum failed. Calculated 0x83 read 0xc3
            

            This looks serious so I decided to check the lopy4 with the Tx software to see the image details so I could maybe rebuild the failed receiver

            >>> import os;os.uname()
            (sysname='LoPy4', nodename='LoPy4', release='1.18.2.r1', version='v1.8.6-849-e0fb68e on 2018-11-26', machine='LoPy4 with ESP32', lorawan='1.0.2', sigfox='1.0.1')
            >>> import pycom; pycom.bootmgr()
            Traceback (most recent call last):
              File "<stdin>", line 1, in <module>
            AttributeError: 'module' object has no attribute 'bootmgr'
            

            Do you know why bootmgr won't tell me what file system the lopy4 is using?

            robert-hhR 1 Reply Last reply Reply Quote 0
            • robert-hhR Offline
              robert-hh @kjm
              last edited by

              @kjm I cannot tell when the bootmgr() method included the file system. The actual version 1.20.2 of the firmware does. So may you should update first. The Pycom images will include pybytes, which can be disabled if not required, and is then only wasted flash memory.

              K 1 Reply Last reply Reply Quote 0
              • K Offline
                kjm @robert-hh
                last edited by

                @robert-hh I chose 'legacy' for the upgrade to try to avoid pybytes & got release 1.20.0.rc13. Was that a bad choice? If I go with 'pybytes' what command do I need to disable pybytes?

                robert-hhR 1 Reply Last reply Reply Quote 0
                • robert-hhR Offline
                  robert-hh @kjm
                  last edited by

                  @kjm There is a pybytes_on_boot() method of the pycom module.

                  pycom.pybytes_on_boot(False)

                  Will disable pybytes. That one is in the code, but not documented.

                  K 1 Reply Last reply Reply Quote 0
                  • K Offline
                    kjm @robert-hh
                    last edited by

                    @robert-hh So do you know what the deal is with 'legacy' in the Firmware updater? What do I get when I choose that?

                    robert-hhR 1 Reply Last reply Reply Quote 0
                    • robert-hhR Offline
                      robert-hh @kjm
                      last edited by

                      @kjm You'll get an older version of the firmware without the pybytes code both in the firmware and frozen bytecode. You get the same when you build your own firmware with the build option "VARIANT=BASE", which is the default. That's what I do. The other variant is "VARIANT=PYBYTES"

                      K 1 Reply Last reply Reply Quote 1
                      • K Offline
                        kjm @robert-hh
                        last edited by

                        @robert-hh Sadly I have yet to master roll-your-own firmware. Excellent RF results for raw lora from the lopy4 though. I've been tinkering with spread spectrum since the 1990s (when the proxim XRs first appeared) never seen successful data at this signal level on 915MHz.

                        rssi -143   snr -18.0   sf 12
                        
                        robert-hhR 1 Reply Last reply Reply Quote 0
                        • robert-hhR Offline
                          robert-hh @kjm
                          last edited by

                          @kjm The sensitivity of the devices is good. But do not trust too much to the numbers. They are not calibrated.

                          K 1 Reply Last reply Reply Quote 0
                          • K Offline
                            kjm @robert-hh
                            last edited by kjm

                            @robert-hh I guess that's why it's pushing half a watt of RF & claiming -20dBm? Any idea where I could find out the best bandwidth/coding-rate/preamble values to use with sf=12 in raw mode?

                            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