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

mqtt_simple connect to AWS

I have an AWS account and I am comfortable with the AWS IOT operation in general. I have used it in the past. I am trying to get the sample mqtt_simple to connect to AWS IOT and be able to send packets and receive packets to the nRF9160dk board.

 I am not sure how to set up mqtt_simple parameters? I have created a thing and certificates. I have named the thing "nrf-IMEI" as recommended so it has the board ID in it. All I want to do is to be able to publish a packet to a topic on my AWS account and receive a packet from a topic in my AWS account. I have done this several times in the past with other systems so I am comfortable with AWS IOT operations and formats. I just do not understand how to get mqtt_simple to publish from my board to AWS and subscribe to messages from AWS.

Is this the correct program to use. It seems like all the pieces are there I just do not know how to use them.

I appreciate any help you can give, This is an essential requirement of our production system. right now we are using the pre-production system with a modified version of asset_tracker to send sensor data to the nRF Connect site. We need to be able to send sensor data to our AWS site.

Parents Reply Children
  • Martin

    I am back again. I loaded V1.3.0 and I am trying to get the AWS connection to my account working.

    I made all of the changes (I think) we talked about above and I have mqtt_simple working for V1.3.0. when I make the same changes for asset_tracker I cannot connect to my account. I get the following messages. As before it is crucial that I connect asset_tracker to my AWS account so I can send data to my tables. I am sure I missed something or something changed in V1.3.0. any help you could give would be greatly appreciated. I am dead in the water right now.

    [[00:00:00.237,579] <inf> asset_tracker: Connecting to LTE network.
    [00:00:00.244,232] <inf> asset_tracker: This may take several minutes.
    [00:00:00.251,312] <dbg> lte_lc.lte_lc_system_mode_set: Sending AT command to set system mode: AT%XSYSTEMMODE=1,0,1,0
    [00:00:00.270,599] <dbg> lte_lc.lte_lc_system_mode_set: Sending AT command to set system mode: AT%XSYSTEMMODE=1,0,1,0
    +CEREG: 2,"9E03","026B8102",7,0,0,"11100000","11100000"
    [00:00:02.253,540] <dbg> lte_lc.at_handler: +CEREG notification: +CEREG: 2,"9E03","026B8102",7,0,0,"11100000","11100000"

    [00:00:02.265,319] <dbg> lte_lc.parse_psm_cfg: TAU: -1 sec, active time: -1 sec

    +CSCON: 1
    [00:00:02.305,145] <dbg> lte_lc.at_handler: +CSCON notification
    +CEREG: 5,"9E03","026B8102",7,,,"11100000","11100000"
    [00:00:05.878,753] <dbg> lte_lc.at_handler: +CEREG notification: +CEREG: 5,"9E03","026B8102",7,,,"11100000","11100000"

    [00:00:05.890,350] <dbg> lte_lc.parse_psm_cfg: TAU: -1 sec, active time: -1 sec

    [00:00:05.898,345] <inf> asset_tracker: Connected to LTE network.
    [00:00:05.904,937] <inf> asset_tracker: Connecting to cloud, attempt 1 of 8
    [00:00:10.265,930] <inf> asset_tracker: Cloud connection request sent.
    [00:00:10.272,918] <inf> asset_tracker: Connection response timeout is set to 30 seconds.
    +CSCON: 0
    [00:00:17.348,327] <dbg> lte_lc.at_handler: +CSCON notification
    [00:00:40.281,646] <err> asset_tracker: LTE link disconnect
    +CSCON: 1
    [00:00:40.404,907] <dbg> lte_lc.at_handler: +CSCON notification
    +CEREG: 0,"9E03","026B8102",7,0,0,"11100000","11100000"
    [00:00:40.416,503] <dbg> lte_lc.at_handler: +CEREG notification: +CEREG: 0,"9E03","026B8102",7,0,0,"11100000","11100000"

    [00:00:40.428,253] <dbg> lte_lc.parse_psm_cfg: TAU: -1 sec, active time: -1 sec

    +CSCON: 0
    [00:00:41.808,380] <dbg> lte_lc.at_handler: +CSCON notification
    [00:00:42.136,688] <err> asset_tracker: Shutdown modem

  • Hi Timothy,
    Have you provisioned the correct certificates to the modem?

    So the asset_tracker from v1.2.0 you were able to connect to your server, but not the NCS v1.3.0 version?

    Could you maybe share the Modem trace ?

  • Martin

    yes it is the same board with the same certificates. it connects and runs fine with V1.2.0 but does not with V1.3.0. I think I made all of the settings in kconfig and prj.conf that I did in V1.2.0 to get ti to connect.

    I am very confused. I must be missing something simple.

  • Please first try to enable more logging from the application:

    Add in prj.conf:

    ASSET_TRACKER_LOG_LEVEL_DBG=y

    What we could do is to make this case private so I could look more into your configurations in your application.


  • Martin

    I added the line but not much more was shown. we can make private or do whatever else is needed.

    I could send you the directory zipped up but you would need the  certificates to connect to my board. I am willing to try whatever you suggest

    [00:00:00.238,250] <inf> asset_tracker: Connecting to LTE network.
    [00:00:00.244,903] <inf> asset_tracker: This may take several minutes.
    [00:00:00.251,953] <dbg> lte_lc.lte_lc_system_mode_set: Sending AT command to set system mode: AT%XSYSTEMMODE=1,0,1,0
    [00:00:00.271,453] <dbg> lte_lc.lte_lc_system_mode_set: Sending AT command to set system mode: AT%XSYSTEMMODE=1,0,1,0
    +CEREG: 2,"9E03","026B8102",7,0,0,"11100000","11100000"
    [00:00:02.561,798] <dbg> lte_lc.at_handler: +CEREG notification: +CEREG: 2,"9E03","026B8102",7,0,0,"11100000","11100000"

    [00:00:02.573,577] <dbg> lte_lc.parse_psm_cfg: TAU: -1 sec, active time: -1 sec

    +CSCON: 1
    [00:00:02.611,602] <dbg> lte_lc.at_handler: +CSCON notification
    +CEREG: 5,"9E03","026B8102",7,,,"11100000","11100000"
    [00:00:04.247,039] <dbg> lte_lc.at_handler: +CEREG notification: +CEREG: 5,"9E03","026B8102",7,,,"11100000","11100000"

    [00:00:04.258,636] <dbg> lte_lc.parse_psm_cfg: TAU: -1 sec, active time: -1 sec

    [00:00:04.266,601] <inf> asset_tracker: Connected to LTE network.
    [00:00:04.273,193] <inf> asset_tracker: Connecting to cloud, attempt 1 of 8
    client_id_buf nrf-352656100378150
    CONFIG_AWS_IOT_BROKER_HOST_NAME a2uy3w9dvx40gv-ats.iot.us-east-1.amazonaws.com
    client_broker_init passed
    [00:00:09.697,937] <inf> asset_tracker: Cloud connection request sent.
    [00:00:09.704,925] <inf> asset_tracker: Connection response timeout is set to 30 seconds.
    [00:00:09.713,592] <dbg> watchdog.secondary_feed_worker: Feeding watchdog
    [00:00:14.720,916] <dbg> watchdog.secondary_feed_worker: Feeding watchdog
    +CSCON: 0
    [00:00:17.323,913] <dbg> lte_lc.at_handler: +CSCON notification
    [00:00:19.728,271] <dbg> watchdog.secondary_feed_worker: Feeding watchdog
    [00:00:24.735,656] <dbg> watchdog.secondary_feed_worker: Feeding watchdog
    [00:00:29.743,072] <dbg> watchdog.secondary_feed_worker: Feeding watchdog
    [00:00:34.750,457] <dbg> watchdog.secondary_feed_worker: Feeding watchdog
    [00:00:39.713,623] <err> asset_tracker: LTE link disconnect
    +CSCON: 1
    [00:00:39.833,801] <dbg> lte_lc.at_handler: +CSCON notification
    +CEREG: 0,"9E03","026B8102",7,0,0,"11100000","11100000"
    [00:00:39.845,367] <dbg> lte_lc.at_handler: +CEREG notification: +CEREG: 0,"9E03","026B8102",7,0,0,"11100000","11100000"

    [00:00:39.857,147] <dbg> lte_lc.parse_psm_cfg: TAU: -1 sec, active time: -1 sec

Related