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

Transmit GPS data to website

Hello 

I would like to transmit gps data to my website in addition to nrf cloud, there is a example or documentation about this that I can take of reference? I am working with nRF 9160 DK 

thanks in advance.

Kind Regards

Julio

Parents
  • Hi,

     

    The asset_tracker shows how to connect to a cloud based system, and send certain sensors + gps data to the cloud.

    If you want a simpler solution, like a tcp/udp connection directly to your own server, I would recommend that you look at the "gps" sample, and add your own implementation around this.

     

    Note that there's a restriction towards getting GPS and LTE concurrent, which is that you have to be in eDRX or PSM mode in order to use the GPS. A recommended use-case is to use the AT CSCON event to signal when you can or cannot use the GPS.

     

    Kind regards,

    Håkon

  • Thx Håkon,

    I tried setting CSCON=0 when initialising the GPS.

    (After looking at the code in asset_tracker I also saw it use lte_lc_psm_req(true))

    If I then try to initialise a UDP connection lte_lc_init_and_connect_async(lte_handler) fails.

    (Initialisation code from the UDP example)

    I'm not clear on the sequence I need to initialise both GPS and UDP.

    further...

    I wanted to see why lte_lc_init_and_connect_async is failing but this seems to be part of the distribution that is shipped in binary.

    Specifically, the error is:

    modem_configure()
    I: Using legacy LTE PCO mode...
    I: PDP Context: AT+CGDCONT=0,"IP","lpwa.vodafone.iot"
    E: Could not send AT command, error: -8

    Which is odd because when initialising the GPS we already sent 4 AT commands without error.

    This part of UDP initialisation works fine if I comment out the GPS initialisation 

    Thx.

  • Many thx Håkon

    I guess this means that if testing without a connection it will wait indefinitely - if you let it.

    That should not be a problem as you can't send anything until you get a signal.

    I'll try this when I'm in range of a cell tower.

    Regards, Paul

  • You can evaluate the gps without using LTE, by running the "gps" example.

    This doesn't require LTE, but does require that you're outside (or the GPS-antenna shall be outside) while testing.

     

    Kind regards,

    Håkon

  • Thx Håkon

    Yes.  The first thing I did was to test both GPS and UDP examples.

    Only then did I try to put them together to make a minimal tracker using UDP and without the need for all the other good stuff in your asset_tracker app.

    So I now wait for udp Idle.

    However, from the code in the gps sample I then get an error from

    ```

    at_cmd_write(at_commands[i])

    ```

    AT_XSYSTEMMODE,  (fails on this one)
    AT_MAGPIO,
    AT_COEX0,
    AT_ACTIVATE_GPS

    so GPS is not activated.

    XSYSTEMMODE is probably redundant but why would it throw an error?

    Regards.

  • Hi,

     

    paul_tanner said:
    XSYSTEMMODE is probably redundant but why would it throw an error?

    Its highly likely because the modem is already enabled (AT+CFUN=1) at this point. Please check that "modem_configure()" isn't called, and that "CONFIG_LTE_AUTO_INIT_AND_CONNECT=n" is set in your project.

     

    Kind regards,

    Håkon

  • Thx Håkon

    modem_configure() *was* being called; CONFIG_LTE_AUTO_INIT_AND_CONNECT=n is set.

    So I removed modem_configure().  The result was that we never get the LTE_LC_EVT_RRC_UPDATE (idle) event so it just hangs.

    Is something else needed instead of modem_configure()? (per the udp example)

    Presumably the lack of modem_configure would also prevent sending of data via udp?

    Regards.

Reply Children
Related