Invalid values on GPS unit



  • 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



  • 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



  • Hello @felmue

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



  • 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


  • Hello @oktawianito

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

    Thanks
    Felix