This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

MQTT and GPS

I have an application where i have to regularly send gps data to an mqtt broker. I started with the mqtt sample which works fine, and i also tried the gps example with assited fix over supl which also works fine. When it comes to combinig the two examples I'm not sure how properly do it, espescially the activation and deactivation of the lte and gps. Is there an easy to understand example? I checked out the asset tracker but it is  kind of overwhelming. Greetings from switzerland.

  • Hi,

     

    The path of least resistance is normally looking at two (or more) samples that match your requirement, and then combining these into one project.

     

    the "gps" application turns on/off the LTE link, while a more wide-spread approach is to enter eDRX/PSM, then start the GPS.

    First, I would recommend that you enable both GPS and your LTE PHY (NB1 or LTE-M1), by setting:

    # M1 + GPS
    CONFIG_LTE_NETWORK_MODE_LTE_M_GPS=y
    
    OR:
    
    # NB1 + GPS
    CONFIG_LTE_NETWORK_MODE_NBIOT_GPS=y

     

    Then use the CSCON notification to ensure that the link is inactive, so you can start the GPS, and then stop it when your application criterias are met.

    The initialization and gps-handling can be taken from the "gps" sample.

     

    Let me know if you run into any issues!

     

    Kind regards,

    Håkon

Related