nRF9160: Cloud Client

This sample connects to, and communicates with a compatible cloud service using the respective cloud backend firmware library. The sample connects via cellular network (LTE) and publishes a custom string in intervals or upon a button trigger, to the cloud service.

Overview

The Cloud Client sample demonstrates how the generic Cloud API can be used to interface with multiple cloud backends. The current version of the sample supports the following libraries as cloud backends:

To swap between the supported libraries, change the option CONFIG_CLOUD_BACKEND to match the configuration string of a compatible cloud backend. The identifying string for the different cloud backends are listed in the following table:

Cloud Backend

Configuration String

NRF Cloud

NRF_CLOUD

AWS IoT

AWS_IOT

Requirements

  • One of the following development boards:

Building and running

This sample can be found under samples/nrf9160/cloud_client in the nRF Connect SDK folder structure.

See Building and programming a sample application for information about how to build and program the application.

The sample is configured to compile and run as a non-secure application on nRF91’s Cortex-M33. Therefore, it automatically includes the nRF9160: Secure Partition Manager that prepares the required peripherals to be available for the application.

Setup

For configuring the different cloud backends, refer to the documentation on nRF Cloud library and AWS IoT. Each cloud backend has specific setup steps that must be executed before it can be used.

Note

The nRF9160 DK and Thingy:91 come pre-flashed with the certificates required for a connection to nRF Cloud. No extra steps are required to use the Cloud client sample with nRF Cloud.

Configurations

The configurations used in the sample are listed below. They are located in cloud_client/src/prj.conf.

CONFIG_CLOUD_BACKEND

Decides the cloud backend to be used.

CONFIG_CLOUD_PUBLICATION_SEQUENTIAL

Publishes a message to cloud sequentially.

CONFIG_CLOUD_PUBLICATION_BUTTON_PRESS

Publishes a message to cloud upon a button press.

CONFIG_CLOUD_MESSAGE

Modifies the message published to the cloud service.

CONFIG_CLOUD_MESSAGE_PUBLICATION_INTERVAL

Modifies the interval within which the message is published to the cloud service.

Note

To output data in the terminal window located in the nRF Cloud web interface, the data format must be in JSON format.

Functionality and Supported Technologies

The communication protocol supported by the sample is dependent on the cloud backend that is used.

Functions

The sample uses the following functions:

Cloud events used in the sample

The sample uses the following cloud events:

Note

Not all functionalities present in the generic cloud API are used by the different cloud backends.

Dependencies

This sample uses the following nRF Connect SDK libraries and drivers:

In addition, it uses the Secure Partition Manager sample: