🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Invalid values on GPS unit

    Units
    3
    5
    6.7k
    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.
    • O
      oktawianito
      last edited by

      Hello, I am looking for some help here.

      I am using M5Stack Core 2 AWS - my problem is basicly no data recived form GPS unit conected on port C (13,14). For now i get only invalid values on port monitor and also by displaying on stack screen. I tried to use Arduino for programming this unit. Really i have no idea how to solve this problem - tryed many times.

      Thanks for any help in this topic

      1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by

        Hello @oktawianito

        I think the M5Core2 example for the GPS unit has not been fully adapted from M5Stack to M5Core2. It seems that by default HardwareSerial for ESP32 uses GPIO16 and GPIO17 but as you already mentioned on M5Core2 GPIO13 and GPIO14 should be used.
        Try changing this line:

        ss.begin(GPSBaud);
        

        to

        ss.begin(GPSBaud, SERIAL_8N1, 13, 14);
        

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        O 1 Reply Last reply Reply Quote 2
        • O
          oktawianito @felmue
          last edited by

          Hello @felmue

          Thanks for your tips. After using them everything works correctly ;)

          1 Reply Last reply Reply Quote 1
          • F
            falbriard
            last edited by falbriard

            M5Stack Core2 and GPS Module (my solution with UIFlow)

            I'm using a stackable GPS unit with external antenna. Under UIFLow I've configured it to TX=14 and RX=13 and its working.

            In order to get decimal return values for location data, which I need to transport into a MQTT publisher protocol, I wrote a conversion function in a “blockly” execute statement interpreted as MicroPython. Yes, yet missing some support for Altitude. Ideas for improvement of the logic are welcome.

            Hope this is helpful (see the code below):

            # GPS location conversion 
            # convert into decimal
            def conversion(inp):
                minus = False
                parts = inp.split('.')
                ddmm = parts[0]
                ss = parts[1]
                last_char = ss[-1]
                if (last_char == 'W') or (last_char == 'S'):
                    minus = True
                    # remove last character 
                    ss = ss[:-1]
                last_two_char = ddmm[-2:]
                mm = last_two_char
                if len(ddmm) == 3:
                    dd = ddmm[:1]
                if len(ddmm) == 4:
                    dd = ddmm[:2]        
                if len(ddmm) == 5:
                    dd = ddmm[:3]
                if minus:  
                    dd = int(dd) * -1  
                minf = float(mm + '.' + ss)
                secsmm = minf / 60
                # case South, or West invert 
                if minus: 
                    deci = float(dd - secsmm)
                else:
                    deci = float(dd + secsmm)
                
                return deci
            
            1 Reply Last reply Reply Quote 2
            • felmueF
              felmue
              last edited by

              Hello @oktawianito

              good to hear. Thank you for reporting back. I appreciate it.

              Thanks
              Felix

              GPIO translation table M5Stack / M5Core2
              Information about various M5Stack products.
              Code examples

              1 Reply Last reply Reply Quote 0
              • First post
                Last post