# NORDIC nRF9160 DK

The nRF9160 DK is a cellular IoT development kit for LTE Cat-M1, NB-IoT, GNSS and Bluetooth LE. It is an affordable, pre-certified single-board development kit for evaluation and development of the [**nRF9160 SiP**](https://www.nordicsemi.com/Products/nRF9160)**.**

![nRF9160 Development Kit](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2Ffi8wesqrGbKnEypqn3LD%2FnRF59160-DK-nordic.jpg?alt=media\&token=1d69ca6d-0771-4d64-80be-e51171d38564)

### Quick Navigation

* [Getting Started with the nRF9160 DK](#getting-started)
* [Connect the nRF9160 to Monogoto](#connect-the-nrf9160-to-monogoto)
* [Build a tracking application](#build-a-tracking-application)
* [Useful Links](#useful-links)

### Prerequisites

* [NORDIC nRF9160 DK](https://www.nordicsemi.com/Products/Development-hardware/nrf9160-dk)
* [nRF Connect for Desktop](https://www.nordicsemi.com/Products/Development-tools/nRF-Connect-for-desktop/)
* [Account on nRF Cloud](https://nrfcloud.com/)
* [nRF Connect SDK](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_assistant.html#gs-assistant) for VS Code or SES (Segger Embedded Studio)

## Getting Started with the nRF9160 DK <a href="#getting-started" id="getting-started"></a>

### Connect to the nRF9160

Connect the nRF9160 to your computer using a micro USB cabl&#x65;**.**&#x20;

Open the **Programmer** tool from **nFR Connect for Desktop.**&#x20;

![](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2F6TyqUWvv89mrpITyAMkP%2Fimage.png?alt=media\&token=9ff8515f-5a3b-4193-87b0-7c75b7e11c7f)

Connect your device by clicking **SELECT DEVICE ↓** at the top-left corner.

![](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FzBud0ycHXC1XBxJInpRJ%2Fimage.png?alt=media\&token=4cc6867c-fe28-44e4-9b59-7deeb870232e)

### Program the Development Kit with the `at_client` sample

{% hint style="info" %}
For details about the `at_client` sample, [see nRF9160 documentation](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/nrf9160/at_client/README.html)
{% endhint %}

Open your [**nRF Connect SDK**](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_assistant.html#gs-assistant) on VS Code or SES. Select the option: **Create a new application from sample** and open the application: `at_client` which can be found in the folder: `samples/nrf9160/`.

![Open at\_client sample in VS Code](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FvlPLTq6pRa7KxyyaSuWC%2Fimage.png?alt=media\&token=0364360b-d49c-443d-9c28-7313cac810bf)

**Add Build Configuration** for the board `nrf9160dk_nrf9160_ns`

![Add Build Configuration in VS Code](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FcPqIvfKONU9lX2zikWMx%2Fimage.png?alt=media\&token=898eb40e-847b-46bd-8b0a-bb2f37a70405)

Flash the build file to the nRF9160 by clicking **Flash** in the left side menu

![](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FoHq7W3IBZmTLCxiT6XvH%2Fimage.png?alt=media\&token=da857f40-c81b-41d6-9fc6-51bca6c7f5e2)

Wait for the status message: "**Programming: Programming complete"**

![](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FctKpK3ZQk61u9AQ68YhW%2Fimage.png?alt=media\&token=0ae760b3-4d43-45a1-8a55-400a3acd4b18)

## Connect the nRF9160 to Monogoto

{% hint style="info" %}
Keep the **nRF91 AT Commands manual** next to you for more details about the commands. [**Click here**](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fref_at_commands%2FREF%2Fat_commands%2Fintro.html) to visit NORDICs AT Commands documentation.
{% endhint %}

Start off by **inserting the Monogoto SIM card**.

Open the **LTE Link Monitor** from **nRF Connect for Desktop.**

After selecting your device via the button **SELECT DEVICE ↓,** the AT command `AT+CFUN?` is sent automatically to the modem which returns: `+CFUN: 0`, indicating that the modem is turned off.

![](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FKEBHm4QnzJQD8Xl7rPNX%2Fimage.png?alt=media\&token=99a95d4e-5a5e-4716-8990-67d0d17520a0)

Reset the modem to **factory settings**:

```bash
AT%XFACTORYRESET=0
```

Enable **error reporting**, resulting in more descriptive error codes (optional):

```bash
AT+CMEE=1
```

**Activate** the cellular modem:

```bash
AT+CFUN=1
```

Check if the SIM card is attached and is not locked with a PIN, expected response: `+CPIN: READY`:

```bash
AT+CPIN?
```

{% hint style="warning" %}
If you receive an error, the SIM may not be inserted properly or the SIM is protected with a PIN. By default, Monogoto SIMs are not PIN protected.
{% endhint %}

### **Query device information**

Request the modem **hardware version**:

```
AT+CGMM
```

Validate if the nRF9160 modem runs the latest firmware:

```bash
AT+CGMR
```

Compare the response with the latest version found on [**NORDICs website**](https://www.nordicsemi.com/Products/nRF9160/Download#infotabs) under **nRF9160 SiP modem firmware***.*&#x20;

<details>

<summary>How to update the nRF9160 modem firmware</summary>

If you don’t run the latest modem firmware, [**download**](https://www.nordicsemi.com/Products/Development-hardware/nRF9160-DK/Download?lang=en#infotabs) the latest nRF9160 DK **application and modem firmware**. Unzip the file and look for a zipfile which starts with `mfw` (which stands for Modem Firmware).

Open the **Programmer** in **nRF Connect for Desktop**.

<img src="https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2F6TyqUWvv89mrpITyAMkP%2Fimage.png?alt=media&#x26;token=9ff8515f-5a3b-4193-87b0-7c75b7e11c7f" alt="nRF Connect for Desktop" data-size="original">

Click in the left menu bar Read <img src="https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2F2gNoWGXLH0z3PJcOFeEb%2Fimage.png?alt=media&#x26;token=37b1dbce-043c-4f66-9202-b91910246744" alt="" data-size="line">, followed by Add file <img src="https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FdiKML5kMjRR1jB839uMw%2Fimage.png?alt=media&#x26;token=e5d891dd-e01f-4d70-8065-3f7e39dece3f" alt="" data-size="line"> and select the modem firmware zipfile you just downloaded.&#x20;

Click Write <img src="https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FI7DG5d2wrWBdtpWcvqGX%2Fimage.png?alt=media&#x26;token=2893d296-56f0-4499-93ec-67c760553603" alt="" data-size="line"> to write the latest application and modem firmware to the nRF9160. Wait for the program to report: "**Completed successfully**".

<img src="https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2F0aFkfcpgz45VylUvo2Lt%2Fimage.png?alt=media&#x26;token=84ab1557-819a-4835-a188-00102c24d987" alt="LTE Link Monitor" data-size="original">

</details>

Request the **IMSI** (International Mobile Subscriber Identity):

```
AT+CIMI
```

Request the **ICCID** (Integrated Circuit Card ID), which is the identification number of the SIM card:

```bash
AT%XICCID 
```

### **Network Configuration**

It is possible to let the modem select the network automatically, or to manually define a network to connect with.

#### **Option 1: Automatic Network Selection**

To set the modem to **automatic network selection** enter the command:

```
AT+COPS=0
```

Check the **network and cellular technology the modem** is currently using:

```
AT+COPS? 
```

Expected response: `+COPS: 0,2,"<MCCMNC of operator>",7`. The last digit indicates the cellular technology, `7` means **LTE Cat-M1**&#x20;

#### Option 2: Manual Network Selection

Start with searching for available networks by entering the below AT Command, or by clicking the button: <img src="https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FkIcFrBy2SYycTvOvSey9%2Fimage.png?alt=media&#x26;token=4b9181f8-1726-493f-bbd7-f12c2d02f911" alt="" data-size="original">

```
AT+COPS=?
```

{% hint style="warning" %}
Be patient, it may take several minutes before the modem responds, you cannot send any other AT Commands in the meantime. You may get an error message which you can ignore <mark style="color:red;">`Error: 'AT+COPS=? ' timed out`</mark>.
{% endhint %}

The modem responds with the **MCCMNC** codes of the available networks. It also shows the cellular technologies the networks support: `7` indicates **LTE Cat-M1**.

Example response:

```
+COPS: (2,"","","20408",7),(1,"","","20404",7),(1,"","","20416",7)
```

To find the names and MCCMNCs of the networks Monogoto has **roaming agreements** with, review the [**Coverage lists**](https://docs.monogoto.io/getting-started/global-public-coverage).

{% hint style="info" %}
To find the **profile** of your SIM, visit the [**Monogoto Console**](https://console.monogoto.io/), open the page **Things** and select a specific **Thing**. Scroll down to **Mobile Identities** to find your profile in the column **Network Provider Name**.

![](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FDBBlfmj2XtYrHZ07kzS9%2Fimage.png?alt=media\&token=1d1db179-eb1c-42ae-b235-0811de892ef4)
{% endhint %}

To find the **network operator** and the **cellular technology** the device is currently using, enter:

```
AT+COPS? 
```

Expected response: `+COPS: 0,2,"<MCCMNC>",7`. The last digit indicates the cellular technology LTE Cat-M1.

**Manually set the network and the cellular technology**:

```
AT+COPS=1,2,"XXXXX",7
```

Replace `XXXXX` with the **MCCMNC** code of your operator, for example`"20404"` for Vodafone NL.

#### **Check the radio signal strength and signal quality:**

```bash
AT+CESQ
```

Example response: `+CESQ: 99,99,255,255,15,53`

{% hint style="info" %}
`+CESQ` returns 6 values separated by commas. The last 2 values indicate the **RSRQ** (Reference Signal Received Quality) and **RSRP** (Reference Signal Received Power) respectively. RSRQ is indicated with a value between `0` and `34`, RSRP is with a value between `0` and `97`. Higher values represent better signal quality.
{% endhint %}

#### Read the LTE Cat-M1 band the modem is using:

```
AT%XCBAND
```

Example response: `%XCBAND: 20`

#### Define the cellular band(s) (optional)

It is possible to **lock the modem to one or more specific bands**. This may result in a faster boot cycle as the modem does not need to scan for available bands at startup.

To **find** the available bands the modem support:

```
AT%XCBAND=?
```

Expected response: `%XCBAND: (1,2,3,4,5,8,12,13,18,19,20,25,26,28,66)`

{% hint style="warning" %}
Although the modem may support many different bands, your local network operator may not. Have a look at the [**LTE Cat-M1 overview**](https://docs.monogoto.io/getting-started/general-device-configurations/iot-devices/broken-reference) to find the available band(s) in your region.
{% endhint %}

{% hint style="info" %}
The LTE Link Monitor shows most of the network information as well. Example:&#x20;

![](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FL1YepYok32el44ox20dq%2Fimage.png?alt=media\&token=5c5de19e-74b7-4a91-8020-24425b742723)
{% endhint %}

**Lock the modem to one or multiple bands**

First, deactivate the modem: `AT+CFUN=0`,  then run the command:

```
AT%XBANDLOCK=1,"<bandmask>"
```

{% hint style="info" %}
Example of **creating the bandmask:**

To lock the modem to band 3 and 8, create a bit array where the 3rd and 8th bit are a 1 (counted from right to left): `10000100`. The AT Command becomes: `AT%XBANDLOCK=1,"10000100"`
{% endhint %}

Reactivate the modem after locking the band: `AT+CFUN=1`

**Test** if the bands are properly set:

```
AT%XBANDLOCK?
```

Expected response: `%XBANDLOCK: "<bandmask>",""`

### Network Activation

**Set the APN to** `data.mono`:

```bash
AT+CGDCONT=1,"IP","data.mono"
```

Validate if the **APN** is properly set:

```
AT+CGDCONT?
```

Expected response:

```
+CGDCONT: 1,"IP","data.mono"
```

**Activate the PDP (packet data protocol) context:**

```
AT+CGACT=1,1
```

**Test** if the PDP context is activated:

```
AT+CGACT?
```

Expected response:

```
+CGACT: 0,1
+CGACT: 1,1
```

#### Validate if your device received an **IP address**:

```bash
AT+CGPADDR
```

Expected response: `+CGPADDR: 1,XX.XXX.XX.XXX`

{% hint style="success" %}
Did you receive an IP address? **Congratulations! 🎉  You successfully connected the nRF9160 to Monogoto.** Have a look at the **Things** logs in the [**Monogoto Console**](https://console.monogoto.io/) to find more details about the established connection.&#x20;
{% endhint %}

Finally, visualize the network settings and status in the **LTE Link Monitor** with the command:

```bash
AT+CFUN?
```

If all went well, you should see the **Modem**, **UICC**, **LTE** and **PDN** (and optionally **UART**) indicators in the LTE Link Monitor turn <mark style="color:green;">**green**</mark>. You should  also see network information such as the **band**, the **network** the **signal quality** and **IP address**.

![](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FZTv06xwGKCGO0Ckt9LmT%2Fimage.png?alt=media\&token=0efab4d2-8238-4aec-8128-386a7646addd)

## Build a tracking application

*After successfully connecting the nRF9160 to Monogoto, start building an IoT asset tracking application where GPS data is visualized in **nRF Cloud**.*

### **Prerequisites**

* Monogoto SIM
* [NORDIC nRF9160 DK](https://www.nordicsemi.com/Products/Development-hardware/nrf9160-dk)
* [Account on nRF Cloud](https://nrfcloud.com/)
* [nRF Connect SDK](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_assistant.html#gs-assistant) for VS Code or SES (Segger Embedded Studio)

### Add the nRF9160 to nRF Cloud

Login to [**nRF Cloud**](https://nrfcloud.com/)

Connect the nRF9160 DK to nRF Cloud by clicking the **+** sign. Select **LTE Device** and **Skip** the step when asked to activate a SIM card.

The **Device ID** is composed of `nrf-` followed by the **IMEI** which can be found at the back of the device, or by running the AT Command: `AT+CGSN`. Below the IMEI, you should see the **PIN** or **HWID**.

![](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FYKN3RQlf2CxTiHwnnkVz%2Fimage.png?alt=media\&token=0719d398-2ed6-4de9-8086-e8c6e094c051)

Open your [**nRF Connect SDK**](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_assistant.html#gs-assistant) on VS Code or SES. Select the option: **Create a new application from sample** and open the application: `asset_tracker_v2` which can be found in the folder: `nrf/applications/`.

{% hint style="info" %}
For details about the `asset_tracker_v2` sample, [see nRF9160 documentation](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/asset_tracker_v2/README.html)
{% endhint %}

![Open asset\_tracker\_v2 sample in VS Code](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FI8hk9CYMyF0B7u0dP32b%2Fimage.png?alt=media\&token=911bd49b-721f-412b-ac3a-318e4f967f6a)

Add a **Build Configuration** for the Asset Tracker V2 application (this may take several minutes) and **Flash** it to your Development Kit.

![Add Build Configuration in VS Code](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FZYBhtL4cRm71FHxLik27%2Fimage.png?alt=media\&token=42bef5c3-cb9a-4984-b70b-fc0b84aa913a)

Place the device outside or close to a window so it can receive GPS signals. Have a look at the **LTE Link Monitor** tool from **nRF Connect for Desktop** to monitor the device.

If the nRF9160 DK successfully connected to Monogoto and got a GPS fix, data will appear in the nRF Cloud. Does your nRF Cloud look something like the below images? **Congratulations! You’ve successfully connected the nRF9160 DK to the nRF Cloud using Monogoto.  🙌**

![](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FN0sVPVUYSy7Qr3ww28vK%2Fimage.png?alt=media\&token=bdc73bad-160a-40c6-a9fc-89d41f230681)

## Useful Links

* [nRF9160 DK Getting Started](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fstruct_nrf91%2Fstruct%2Fnrf9160.html)
* [nRF91 AT Commands](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fstruct_nrf91%2Fstruct%2Fnrf91.html)
* [nRF9160: Asset Tracker v2 documentation](nhttps://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/applications/asset_tracker_v2/README.html)
* [nRF9160 sample applications](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/samples_nrf9160.html)
* [nRF Cloud Documentation](https://docs.nrfcloud.com/)
