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

    Problem with Sigfox Payload

    Scheduled Pinned Locked Moved SiPy
    pytracksipysigfox
    21 Posts 3 Posters 7.6k 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.
    • J Offline
      Jiemde Pybytes Beta
      last edited by Jiemde

      Hi All,
      Using Pytrack with SiPy for sending GPS coordinates to Sigfox backend.
      For example a payload sended by SiPy: b'\xd5\x17M\x00r\xb5\x08\x00' appear in the Sigfox backend as "d5174d0072b50800" !
      When I try to decode this payload by "int1::4 int2::4" in the payload display, I never obtain the Latitude and Longitude expected

      Is someone has the solution ? Thanks for help.
      Jiemde

      1 Reply Last reply Reply Quote 0
      • B Offline
        bucknall
        last edited by

        Hi @Jiemde,

        Could you please post the code you are using to send your message?

        Thanks,
        Alex

        Developer Evangelist - Pycom

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jiemde Pybytes Beta
          last edited by

          Hi Alex,
          Here is the code:

          def sendtosigfox():

          datatosend = struct.pack('ii', int(coords[0]*100000),  int(coords[1]*100000))
          
          print('sigfox send: {}\n'.format(datatosend))
          
          sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1)
          
          s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW)
          
          s.setblocking(True)
          
          s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, False)
          
          s.send(datatosend)
          s.setblocking(False)
          s.close()
          

          Thanks
          Jiemde

          L 1 Reply Last reply Reply Quote 0
          • L Offline
            livius @Jiemde
            last edited by

            @Jiemde
            First question is - do you have good coordinates retrived by pytrack without sending it to sigfox?
            I ask because if you used official library then current library do not calculate CRC and do not check for fix in messages.
            And it use only GNGLL glonass message ignoring all other messages also GPS messages.

            think about people first, then computers

            B J 2 Replies Last reply Reply Quote 0
            • B Offline
              bucknall @livius
              last edited by

              @Jiemde

              That looks to be fine - What does the Sigfox Backend give you, instead of the data you're expecting? Also as @livius has suggested, what GPS are you using?

              @livius We'll be adding the CRC check and utilization of other GPS messages shortly. Thanks for your patience!

              Developer Evangelist - Pycom

              J 1 Reply Last reply Reply Quote 0
              • J Offline
                Jiemde Pybytes Beta @livius
                last edited by

                @livius
                Yes the coordinates are right !
                When you take the 4 first bytes of the payload seeing in Sigfox for example " d5174d00" and you enter this part of payload in an "Lat=struct.unpack('i', b'\0xd5\0x17\0x4d\0x00') you will retreive the good Latitude.
                I think that teh code is sending the good coordinates, but I don't find how to configure the payload display in "device type" in the Sigfox backend !

                Regards
                jiemde

                L 1 Reply Last reply Reply Quote 0
                • L Offline
                  livius @Jiemde
                  last edited by

                  @Jiemde
                  now it is much cliear where you have the problem

                  i do not know sigfox much but this format is valid?
                  int1::4 int2::4

                  i suppose you need
                  int1:uint::4 int2:uint::4

                  think about people first, then computers

                  J 1 Reply Last reply Reply Quote 0
                  • J Offline
                    Jiemde Pybytes Beta @bucknall
                    last edited by

                    @bucknall
                    The Sigfox backend display "d5174d0072b50800"
                    The decoding payload "int1::4 int2::4", display 2 integer but not the good one!

                    0_1499083800253_Capture d'écran 2017-07-03 14.06.17.png image url)

                    L 1 Reply Last reply Reply Quote 0
                    • L Offline
                      livius @Jiemde
                      last edited by livius

                      @Jiemde
                      sorry mistake
                      int1:uint::32 int2:uint::32

                      think about people first, then computers

                      J 1 Reply Last reply Reply Quote 1
                      • J Offline
                        Jiemde Pybytes Beta @livius
                        last edited by

                        @livius
                        Yes of course! :))

                        1 Reply Last reply Reply Quote 0
                        • J Offline
                          Jiemde Pybytes Beta @livius
                          last edited by

                          @livius
                          Had already tested this but not the good result.

                          jiemde

                          L 1 Reply Last reply Reply Quote 0
                          • L Offline
                            livius @Jiemde
                            last edited by

                            @Jiemde
                            what are results - maybe this hint something

                            think about people first, then computers

                            J 1 Reply Last reply Reply Quote 0
                            • J Offline
                              Jiemde Pybytes Beta @livius
                              last edited by

                              @livius
                              Here is the printscreen
                              0_1499085211840_Capture d'écran 2017-07-03 14.31.56.png

                              L 1 Reply Last reply Reply Quote 0
                              • L Offline
                                livius @Jiemde
                                last edited by

                                @Jiemde

                                sadly i do not have sipy to test self but
                                looking at your values i see that you have variation on most significant bits
                                try then this:
                                int1:uint::32:little-endian int2:uint::32:little-endian

                                if this does not help then post output from corrds recived by pytrack + output packed
                                and what you got for this frames on sigfox

                                think about people first, then computers

                                J 2 Replies Last reply Reply Quote 0
                                • J Offline
                                  Jiemde Pybytes Beta @livius
                                  last edited by

                                  @livius
                                  No change in the displaying data.
                                  As I don't have my SiPy/Pytrack with me at my office, I will reply this evening to your other question.

                                  best regards
                                  jiemde

                                  1 Reply Last reply Reply Quote 0
                                  • J Offline
                                    Jiemde Pybytes Beta @livius
                                    last edited by

                                    @livius
                                    You will find the output you ask:

                                    def sendtosigfox():

                                    datatosend = struct.pack('ii', int(coords[0]*100000),  int(coords[1]*100000))
                                    print('sigfox send: {}\n'.format(datatosend))
                                    size1=struct.calcsize('i')
                                    size2=struct.calcsize('ii')
                                    print('calcsize: ', size1, size2)
                                    
                                    sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1)
                                    s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW)
                                    s.setblocking(True)
                                    s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, False)
                                    
                                    s.send(datatosend)
                                    s.setblocking(False)
                                    s.close()
                                    

                                    while True:
                                    acc = LIS2HH12(py)
                                    roll = acc.roll()
                                    print('X= ', roll)
                                    pitch = acc.pitch()
                                    print('Y= ', pitch)
                                    yaw = acc.yaw()
                                    print('Z= ', yaw)
                                    time.sleep(1)
                                    gps = L76GNSS(py)
                                    coords = gps.coordinates()
                                    print(coords)
                                    sendtosigfox()
                                    time.sleep(600)

                                    The output in Atom/Pymakr:
                                    0_1499096050194_Untitled-3.png

                                    The output in Sigfox backend
                                    0_1499096109639_Untitled-2.png

                                    Regards
                                    Jiemde

                                    L 2 Replies Last reply Reply Quote 0
                                    • L Offline
                                      livius @Jiemde
                                      last edited by livius

                                      @Jiemde
                                      can you add before struct.pack

                                      print(coords)
                                      or
                                      print(str(coords)) #if above not work cast first to string
                                      

                                      think about people first, then computers

                                      1 Reply Last reply Reply Quote 0
                                      • L Offline
                                        livius @Jiemde
                                        last edited by

                                        @Jiemde

                                        is this really your position?

                                        b'\xc8\x17M\x00k\xb5\x08\x00'
                                        (5052360, 570731)
                                        

                                        will be really helpfull to see

                                        print(coords)
                                        

                                        as mentioned below

                                        think about people first, then computers

                                        J 1 Reply Last reply Reply Quote 0
                                        • J Offline
                                          Jiemde Pybytes Beta @livius
                                          last edited by

                                          @livius
                                          Yes it 's my position !
                                          The coords are displayed just before the "sigfox send: " on the output in Atom/pymakr picture.

                                          (50.5236, 5.707314)

                                          Jiemde

                                          L 1 Reply Last reply Reply Quote 0
                                          • L Offline
                                            livius @Jiemde
                                            last edited by livius

                                            @Jiemde
                                            Ahh i see :) I have missed it.

                                            and i see problem (previously i have thinked in opposite direction)

                                            try do this (one of this should do the trick)

                                            datatosend = struct.pack('>II', int(coords[0]*100000),  int(coords[1]*100000))
                                            

                                            or not and on sigfox backend (i do not know why little not do the job and suppose that only above line will work for you)

                                            int1:uint::32:big-endian int2:uint::32:big-endian
                                            

                                            think about people first, then computers

                                            J 1 Reply Last reply Reply Quote 1

                                            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
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post

                                            Pycom on Twitter

                                            Pycom