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

    LoRa receiving only b''

    Scheduled Pinned Locked Moved LoPy
    lopy
    13 Posts 7 Posters 4.5k Views 8 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.
    • M Offline
      Mike K
      last edited by

      Hello,

      I'm trying to get two LoPys to communicate via LoRa. The examples found at:
      https://docs.pycom.io/pycom_esp32/pycom_esp32/tutorial/includes/lora-mac.html

      and (after changing frequency to US 915 MHz)

      https://docs.pycom.io/pycom_esp32/pycom_esp32/tutorial/includes/lopy-to-lopy.html

      Are not working: the receiver is only getting b''. I've also tested several examples found in the forums and am getting the same result.

      Any ideas on how to fix this problem?

      Thanks,
      Mike K

      1 Reply Last reply Reply Quote 0
      • S Offline
        sjgeitel
        last edited by

        Hello,

        I did try the complete Lora init:

        lora = LoRa(mode=LoRa.LORA, frequency=863000000, 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)

        This fix the same problem ( getting b") you have.

        Do you know where to find the default settings of LoRa?

        Best regards,
        Stephan G

        C 1 Reply Last reply Reply Quote 0
        • M Offline
          Mike K
          last edited by

          OK, got it figured out... you have to downgrade to 1.5.1b1. Instructions for doing this can be found at:
          https://forum.pycom.io/topic/517/downgrading-firmware-advanced-users

          Once this is done, then the raw socket example works.

          1 Reply Last reply Reply Quote 0
          • L Offline
            litnimax
            last edited by

            I was also getting b'' (empty string) because they did not communicate and recv() as it is run non-blocking and is returning empty buffer.
            After I added full init sequence params it started to work.
            And I am on the latest firmware (nodename='LoPy', release='1.6.4.b1', version='v1.8.6-475-g2320cb2d on 2017-02-24').

            1 Reply Last reply Reply Quote 0
            • C Offline
              Clemens
              last edited by Clemens

              First Thanks to Stephan, without this hnt I would stay here still and searching for ansers why things not working.

              @Pycm Team: It's ok to have beta software and it's ok that there is a recommendation to date up the firmware before first use. But whot is not ok:

              You purchase a LoRa board and you get the advise on the bag that it is strongly recommended to update your bord but after this update your basic code for this device--LoRa--is no more working!! I spend some nights till I found this thread here. I updated the LoPys, tried different sketches froum your git side, on the documentation page and also "known working" examples from the forum. Nothing did wirk, nothing!! So it is a bit more than frustrating to have a board "simple" example sketches and nothing is transmitting data.

              I would strongly recommend that you make at least an eye-catching hit on a prominent place to worn. Or get an advice how to workaround this. It's not acceptable that you can find it only hidden in a forum post.

              B 1 Reply Last reply Reply Quote 1
              • R Offline
                rikkertmark
                last edited by

                I'm agree, I buy the lopy board for communicating with a raspberry pi with lora module as a simple gateway in earlier version the software works fine 1.6.0.b1 the firmware versions later there is communication but i missed a lot of packages. There is something changed in the firmware. I asked a couple of Times on Daniel but het give NO answer I'm verry dissapointed.

                1 Reply Last reply Reply Quote 0
                • C Offline
                  constantinos @sjgeitel
                  last edited by

                  @sjgeitel

                  Try this trick please

                  # your original code
                  lora = LoRa(mode=LoRa.LORA, frequency=863000000, 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)
                  
                  # and then again
                  lora.init(mode=LoRa.LORA, frequency=863000000, 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)
                  
                  
                  
                  S 1 Reply Last reply Reply Quote 1
                  • S Offline
                    sjgeitel
                    last edited by

                    Just tested LORA communication with version 1.6.6.b1.
                    LORA communication is working well, see the sample code I am using.

                    Sample code I am using into the two lopy units.
                    For my LOPY unit on COM3:
                    0_1488493687559_main.py

                    For my LOPY unit on COM5:
                    0_1488493757516_main.py

                    But I have still have a question, what will be the best settings into the init settings of lora.

                    lora = LoRa(mode=LoRa.LORA, frequency=863000000, 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)

                    best regards,
                    Stephan G

                    C 1 Reply Last reply Reply Quote 1
                    • S Offline
                      sjgeitel @constantinos
                      last edited by

                      @constantinos

                      Hello Constantinos,

                      I did modify my sample code with the trick as you told:
                      lora = LoRa(mode=LoRa.LORA, frequency=863000000, 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=863000000, 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 communication is working well, I do not see any difference.

                      best regards,
                      Stephan G

                      C 1 Reply Last reply Reply Quote 0
                      • C Offline
                        constantinos @sjgeitel
                        last edited by

                        @sjgeitel I found in RFM95 documentation some usefull information

                        Mode of LoRa
                        medium range: bandwidth=LoRa.BW_250KHZ,coding_rate=LoRa.CODING_4_5,sf=7
                        fast short range: bandwidth=LoRa.BW_500KHZ,coding_rate=LoRa.CODING_4_5,sf=7
                        slow long range: bandwidth=LoRa.BW_125KHZ,coding_rate=LoRa.CODING_4_8,sf=9
                        very slow long range: bandwidth=LoRa.BW_125KHZ,coding_rate=LoRa.CODING_4_8,sf=12

                        1 Reply Last reply Reply Quote 0
                        • C Offline
                          constantinos @sjgeitel
                          last edited by

                          @sjgeitel Have you change the blocking mode property?

                          lora_sock = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
                          lora_sock.setblocking(False)
                          
                          
                          1 Reply Last reply Reply Quote 0
                          • B Offline
                            bucknall @Clemens
                            last edited by

                            Hi @Clemens, apologies this slipped through! I'm making the corrections to the docs now and will follow up when the new version is online!

                            Sorry, we let you down on this one!

                            Feel free to drop me an email at alex@pycom.io if you catch anything like this again!

                            Sincerely,

                            Alex

                            Developer Evangelist - Pycom

                            C 1 Reply Last reply Reply Quote 1
                            • C Offline
                              Clemens @bucknall
                              last edited by

                              @bucknall Is the documentation up to date? see https://forum.pycom.io/topic/888/lopy-super-twin-pack-not-working

                              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