NB_iot shield: How to get signal strength?

I have loaded the example from the library.
I had to modify it a bit for the Arduino board it had, but it seems to work fine.
I would like to log the signal strength, I know it should work with the AT command: AT+CSQ
But how do I send it (and read the response)?

Maybe this website helps?

1 Like

@thanks ephimee, that is a nice website.

Perhaps I was not clear on what I need.
I want to extent the below code with debug stream that shows the signal strength (and later more).
I know that for this I need to send AT+CSQ to the ublox, but I do not know how.
Can someone explain me how I can send a AT commend to the Ublox and get the response?

Do I need to modify the library or can I do it from the code below?
Is there a other library that is more extensive on possibilities?

I use the following code:

        This file is part of Sodaq_nbIOT.
    #include "Sodaq_nbIOT.h"
    #include <Sodaq_wdt.h>
    #include <SoftwareSerial.h>

    #if defined(ARDUINO_AVR_UNO)
    SoftwareSerial softSerial(10, 11); // RX, TX
    // You can connect an uartsbee or other board (e.g. 2nd Uno) to connect the softserial.
    #define MODEM_STREAM softSerial
    #define DEBUG_STREAM Serial 

    #define MODEM_ON_OFF_PIN 7

    #define DEBUG_STREAM_BAUD 9600

    #define STARTUP_DELAY 5000

    const char* apn = "oceanconnect.t-mobile.nl";
    const char* cdp = "";
    const char* forceOperator = "20416"; // optional - depends on SIM / network

    Sodaq_nbIOT nbiot;

    void showMessageCountFromModem();

    void setup()


        DEBUG_STREAM.print("Initializing and connecting... ");

        nbiot.init(MODEM_STREAM, MODEM_ON_OFF_PIN);

        if (nbiot.connect(apn, cdp, forceOperator)) {
            DEBUG_STREAM.println("Connected succesfully!");
        else {
            DEBUG_STREAM.println("Failed to connect!");


        const char* message = "Hello World!";
        DEBUG_STREAM.print("Sending message: \"");
        DEBUG_STREAM.print("\"... ");

        if (!nbiot.sendMessage(message)) {
            DEBUG_STREAM.println("Could not queue message!");
        else {
            DEBUG_STREAM.println("Message queued for transmission!");

    void loop()
        if (nbiot.isConnected()) {


    void showMessageCountFromModem()
        DEBUG_STREAM.print("Pending Messages: ");
        DEBUG_STREAM.print("  |  Failed Messages: ");


I see in the Debug stream that there is a connect. All fine.

I would expect a routine to send AT commands? But can not find it.
Something like:

You could just call the function in the library
// Gets the Received Signal Strength Indication in dBm and Bit Error Rate.
// Returns true if successful.
bool Sodaq_nbIOT::getRSSIAndBER(int8_t* rssi, uint8_t* ber)

Yes, i have seen the getRSSIAndBER, but i do not only need the RSSI, i like to send my own AT commands. How can i do this.
Or would it be better if i use TinyGSM lib?

Hello Christiaan,

In de arduino IDE:

If you press “CTRL” + “SHIFT” + “M” you get a serial monitor. From there you can type the commands. Is that what you mean?

The commands are sent via a stream interface (Serial or SoftwareSerial), see the definition for MODEM_STREAM. You can use MODEM_STREAM.println(…) to send a command and add the correct line endings. You can then read the response using the various stream read methods.

You will need to first switch the module on by setting digital pin 7 to OUTPUT, HIGH. If you are using the Sodaq_nbIOT library you can use the on() method (e.g. nbiot.on()). You will need to have previously called the init(…).