> For the complete documentation index, see [llms.txt](https://docs.monogoto.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.monogoto.io/getting-started/general-device-configurations/iot-devices/u-blox-sara-r4.md).

# u-blox SARA R4

The [**u-blox SARA R4 series**](https://www.u-blox.com/en/product/sara-r4-series) supports LTE-M, NB-IoT and EGPRS. When using the SODAQ SARA development kit, you can jump to the tutorial [**here**](/getting-started/general-device-configurations/iot-devices/u-blox-sara-r4/sodaq-sara-r41xm.md).

![](/files/us66dsidhtrgyWfnSCJg)

### Quick Navigation

* [Connect the u-blox SARA to Monogoto](#ublox-connect)
* [Network Activation](#network-activation)
* [Useful Links](#useful-links)
* [Getting stared with SODAQ SARA R41XM](/getting-started/general-device-configurations/iot-devices/u-blox-sara-r4/sodaq-sara-r41xm.md)&#x20;

### Prerequisites

* Monogoto SIM
* u-blox SARA R4XX cellular modem

## **Connect the u-blox SARA to Monogoto** <a href="#ublox-connect" id="ublox-connect"></a>

{% hint style="info" %}
Keep the **AT Commands manual** next to you for more details about the commands. [**Click here**](https://www.u-blox.com/sites/default/files/SARA-R4_ATCommands_UBX-17003787.pdf) to download the latest version.
{% endhint %}

**Reset the modem** to its default configuration:

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

Set the error reporting to **verbose**, resulting in more descriptive error messages (optional):

```bash
AT+CMEE=2
```

Check the status of the SIM card. The correct response should be: `+CPIN: READY`

```
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 generic device information:

```bash
ATI
```

The response includes information about the manufacturer, modem model, firmware revision, SVN (Software Version Number) and IMEI. Example response:

```bash
Manufacturer: u-blox
Model: SARA-R412M-02B
Revision: M0.12.00 [Jan 01 2030 12:00:00]
SVN: 07
IMEI: XXXXXXXXXXXXXXX

OK
```

Request the **modem firmware version**:

```
ATI9
```

This command returns the modem firmware as well as the application firmware, e.g. `M0.12.00,A.02.19`. Validate if you have the latest firmware running by going to the [**u-blox website**](https://www.u-blox.com/en/product/sara-r4-series#tab-documentation-resources) and scrolling down to the section **Product Change Note**. Find the document which relates to your specific modem model.

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:

```
AT+CCID
```

## Network Configuration

It is possible to let the modem select the mobile 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:

```bash
AT+COPS=0
```

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

```
AT+COPS? 
```

Expected response: `+COPS: 0,0,"<name of operator>",X`. The last digit indicates the cellular technology:

`0`: indicates **GSM**\
`3`: indicates **GSM/GPRS with EDGE availability** \
`7`: indicates **LTE-M**\
`9`: indicates **NB-IoT**

{% hint style="warning" %}
The modem needs some time to search and select a network. If the modem responds with `+COPS: 0` wait for a minute and try again.
{% endhint %}

#### Option 2: Manual Network Selection

Start by searching for available networks:

```
AT+COPS=?
```

{% hint style="warning" %}
It may take several minutes before the modem responds.&#x20;
{% endhint %}

The modem responds with the names and the **MCCMNC** codes of the available networks. It also shows the cellular technologies the networks support:&#x20;

Example response:&#x20;

```
+COPS: (2,"vodafone NL","vodafone","20404",7),(1,"NL KPN","NL KPN","20408",7),(1,"NL KPN","NL KPN","20408",0),(1,"vodafone NL","voda NL","20404",0),(1,"T-Mobile NL","TMO NL","20416",0),(1,"T-Mobile NL","TMO NL","20416",7),,(0,1,2,3,4),(0,1,2)
```

To find which of the networks Monogoto has **roaming agreements** with, review the [**Coverage lists**](/getting-started/global-public-coverage.md).

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

![](/files/mYKZeQQpaF72XMfCcgPu)
{% endhint %}

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

```
AT+COPS? 
```

Expected response: `+COPS: 0,0,"<name of operator>",X`. The last digit indicates the cellular technology.

**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. Use `7` for **LTE Cat-M1**.

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

```bash
AT+CSQ
```

{% hint style="info" %}
`+CSQ` returns 2 values separated by a comma. The first value represents the **signal strength** and provides a value between 0 and 31; higher numbers indicate better signal strength. The second value represents the **signal quality** indicated by a value between 0 and 7. If `AT+CSQ` returns `99,99`, the signal is undetectable or unknown.
{% endhint %}

#### 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.

{% hint style="info" %}
Supported LTE-M bands u-blox R412M: `2, 3, 4, 5, 8, 12, 13, 20, 26, 28`

Supported LTE-M bands u-blox R410M: `1, 2, 3, 4, 5, 8, 12, 13, 18, 19, 20, 25, 26, 28`
{% endhint %}

{% 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**](broken://pages/GDSRxI85QWE6Z2lsLeS3) to find the available band(s) in your region.
{% endhint %}

To lock the modem to a specific band, a bandmask needs to be sent to the modem indicating which band(s) should be enabled. This can be done using the following command:

```
AT+UBANDMASK=0,<bandmask>
```

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

To lock the modem to band 3 and 8, create an array or bits where bit 3 and 8 are a `1` (counted from right to left): `10000100`

When [converting](https://www.rapidtables.com/convert/number/binary-to-decimal.html?x=10000100) the binary number to decimals, you get the number: `132`. This is your bandmask.
{% endhint %}

To test if the band(s) is properly set, enter the command:&#x20;

```
AT+UBANDMASK?
```

Example response: `+UBANDMASK: 0,524420,1,524420`&#x20;

{% hint style="info" %}
`0` represents LTE Cat-M1 followed by the bandmask indicating the bands. `1` represents NB-IoT. [Convert](https://www.rapidtables.com/convert/number/decimal-to-binary.html) the decimal number to binary number to find out which bands the modem is locked to. `524420` as a binary number is: `10000000000010000100`, indicating that the band is locked to band 3, 8 and 20 (count the bits from right to left).
{% endhint %}

## Network Activation

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

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

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

```
AT+CGDCONT?
```

Expected response: `+CGDCONT: 1,"IP","data.mono","0.0.0.0",0,0,0,0,0,0`

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

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

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

```
AT+CGACT?
```

Expected response: `+CGACT: 1,1`

Reboot the modem to activate the settings:

```json
AT+CFUN=15
```

To **test** what cellular technology and what band the modem is using, request the **network environment information**:&#x20;

{% hint style="warning" %}
This command is **not supported by all** **modem versions**. To find your modem version, enter `ATI` and look and the line `Revision`

NOT supported by R412M version `L0.0.00.00.05.06`, `L0.0.00.00.05.08` and `L0.0.00.00.05.11`

NOT supported by R412M version `M0.09.00`, `M0.10.00` and `M0.11.01`
{% endhint %}

```
AT+UCGED=2
```

Followed by the command:

```
AT+UCGED?
```

Example response:&#x20;

```
+UCGED:2
6,204,4,6300,20,10,10,546b,235,-89,-11,129,-1,3,255,64,"D2EAE081"
```

The first variable shows the cellular technology used: `2` indicates **2G**, `6` indicates **LTE Cat-M1**, `7` indicates **NB-IoT**. When you see `5` , run the command `AT+UCGED=2` again and retry.\
The fifth variable indicates the **band**, in the example you see the modem using band `20`.&#x20;

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

```bash
AT+CGPADDR
```

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

{% hint style="success" %}
Do you see an IP address? **Congratulations! You’ve successfully connected the u-blox modem to Monogoto 🎉**
{% endhint %}

### **Visit the Monogoto Console to inspect the device logs**

Visit the [**Monogoto Console**](https://console.monogoto.io/) and click on **Things**. Select the Thing you are working on. Scroll down to the **Events** section to validate if the device established a connection. You should see something like: `Success authenticate_pdp_context`

{% hint style="info" %}
To find the **ICCID** of the SIM card, enter the command `AT+CCID`&#x20;
{% endhint %}

## Useful Links

* [u-blox AT commands](https://www.u-blox.com/sites/default/files/SARA-R4_ATCommands_UBX-17003787.pdf)
* [u-blox Product page](https://www.u-blox.com/en/product/sara-r4-series)
* [SODAQ SARA R41X Getting Started](/getting-started/general-device-configurations/iot-devices/u-blox-sara-r4/sodaq-sara-r41xm.md)&#x20;
