Nano RP2040 Connect technical reference

Learn how to set up the Nano RP2040 Connect, get a quick overview of the components, information regarding pins and how to use different Serial (SPI, I2C, UART) and Wireless (Wi-Fi, Bluetooth®) protocols.

The Arduino Nano RP2040 Connect
The Arduino Nano RP2040 Connect

The Arduino® Nano RP2040 Connect is a development board in Nano format, based on the RP2040 microcontroller. It features a Wi-Fi / Bluetooth® module, a 6-axis IMU (Inertial Measurement Unit) with machine learning capabilities, a microphone and a built-in RGB.

This article is a collection of guides, API calls, libraries and tutorials that can help you get started with the Nano RP2040 Connect board.

You can also visit the documentation platform for the Nano RP2040 Connect.

Core

The Nano RP2040 Connect uses the Arduino Mbed OS Nano Boards core.

Datasheet

The full datasheet is available as a downloadable PDF from the link below:

Installation

Arduino IDE 1.8.X

The Nano RP2040 Connect can be programmed through the Classic Arduino IDE 1.8.X. To install your board, you can check out the guide below:

Arduino IDE 2.0.X

The Nano RP2040 Connect can be programmed through the Arduino IDE 2.0.X (beta). To install your board, you can check out the guide below:

Web Editor

The Nano RP2040 Connect can be programmed through the Web Editor. To get started with your board, you will only need to install a plugin, which is explained in the guide below:

Arduino IoT Cloud

The Nano RP2040 Connect is compatible with the Arduino IoT Cloud, a cloud service that allows you to create IoT applications in just minutes.

If you need help to get started, you can go through the Nano RP2040 Connect with Arduino IoT Cloud tutorial.

Bootloader

Since our upload procedure relies on the Raspberry’s bootloader using a mass storage device, if your computer is fast enough during an upload, it can notify you about an USB removable being plugged.

When a sketch is uploaded successfully, the mass storage of the Nano RP2040 Connect may be visible in the operating system. The mass storage should only appear for a few seconds, then it will automatically close. When this occurs, we can force the ROM bootloader mode, which will enable mass storage, allowing us to upload UF2 images like CircuitPython / MicroPython or a regular Arduino sketch.

Forcing bootloader

There is a risk that the uploading process gets stuck during an upload. If this happens, we can double-tap the reset button, to forcefully trigger the bootloader.

Board not detected

Sometimes the board is not detected even when the board is connected to your computer. This can be solved through the following steps:

1. Disconnect the board from your computer by removing the USB cable.

2. Place a jumper wire between the REC and GND pins on the board, then connect the board to your computer.

Place a jumper wire between REC and GND pins.
Place a jumper wire between REC and GND pins.

3. When the board is connected, it will open the mass storage device. You can now remove the jumper wire.

4. Upload a basic sketch, such as the blink example to the board (even though it is not visible in the port selection).

5. When it has finished uploading, your board should be visible in the board/port selection, and your board's built-in LED should be blinking. This means it is successful!

Alternatively, you can choose to factory-reset the board by dragging the

blink.ino.elf.uf2
file into the mass storage. You can download the file from the link below:

Drag and drop the blink.ino.elf.uf2 file into RP2040's mass storage.
Drag and drop the blink.ino.elf.uf2 file into RP2040's mass storage.

After dragging the

U2F
file, the board will be flashed with a program that blinks the built-in LED, and shifts between the
red
,
green
and
blue
pixels.

Pins

The pinout for Nano RP2040 Connect.
The pinout for Nano RP2040 Connect.

Analog pins

The Nano RP2040 Connect has 8 analog pins, that can be used through the

analogRead()
function.

1value = analogRead(pin, value);2

Please note: pin

A4
and
A5
should be used for I2C only.

Please note: pin

A6
and
A7
does not support PWM.

PWM pins

Most of the digital & analog pins can be used as PWM (Pulse Width Modulation) pins, the exception being the following pins:

  • A4
  • A5
  • A6
  • A7
1analogWrite(pin, value);2

Digital pins

There are a total of 14 digital pins, wheras the 8 analog pins can also be used as digital pins.

Please note: A4 and A5 are I2C only, while A6 and A7 can only be used as inputs.

To use them, we first need to define them inside the

void setup()
function of our sketch.

Note: digital pin 3 cannot be configured as

INPUT_PULLUP
.

1pinMode(pin, INPUT); //configured as an input2pinMode(pin, OUTPUT); //configured as an output3pinMode(pin, INPUT_PULLUP); //uses the internal 10k ohm resistor4

To read the state of a digital pin:

1state = digitalRead(pin);2

To write a state to a digital pin:

1digitalWrite(pin, HIGH);2

IMU

The LSM6DSOXTR sensor
The LSM6DSOXTR sensor

LSM6DSOXTR

The LSM6DSOXTR from STM is an IMU (Inertial Measurement Unit) that features a 3D digital accelerometer and a 3D digital gyroscope. It features among many other things, a machine learning core, which is useful for any motion detection projects, such as free fall, step detector, step counter, pedometer.

LSM6DSOX Library

To access the data from the LSM6DSOX module, we need to install the LSM6DSOX library, which comes with examples that can be used directly with the Nano RP2040 Connect.

It can be installed directly from the library manager through the IDE of your choice. To use it, we need to include at the top of the sketch:

1#include <Arduino_LSM6DSOX.h>2

And to initialize the library, we can use the following command inside

void setup()
.

1  if (!IMU.begin()) {2    Serial.println("Failed to initialize IMU!");3    while (1);4  }5

Accelerometer

The accelerometer data can be accessed through the following commands:

1  float x, y, z;2
3  if (IMU.accelerationAvailable()) {4    IMU.readAcceleration(x, y, z);5  }6

Gyroscope

The gyroscope data can be accessed through the following commands:

1  float x, y, z;2
3  if (IMU.gyroscopeAvailable()) {4    IMU.readGyroscope(x, y, z);5  }6

Tutorials

If you want to learn more on how to use the IMU, please check out the tutorial below:

Microphone

The MP34DT05 microphone sensor.
The MP34DT05 microphone sensor.

MP34DT05

The MP34DT05 is a compact, low-power omnidirectional digital MEMS microphone with an IC interface. It has a 64 dB signal-to-noise ratio, is capable of sensing acoustic waves and can operate in temperatures of -40 °C to +85 °C.

PDM library

To access the data from the MP34DT05, we need to use the PDM library that is included in the Arduino Mbed OS Nano Boards core. If the core is installed, you will find an example that works by browsing File > Examples > PDM > PDMSerialPlotter.

  • Please note: The sampling frequency in the PDMSerialPlotter example is set to 16000 Hz. If the microphone appears to not be working (monitor is printing a value of -128), try to change this rate to 20000 Hz. You can change this at the top of the PDMSerialPlotter example sketch, as shown in the example below:
1static const int frequency = 20000; //frequency at 20 KHz instead of 16 KHz2

Tutorials

If you want to learn more on how to use the Microphone, please check out the tutorial below:

RGB

The RGB pixel.
The RGB pixel.

The Nano RP2040 Connect features a built-in RGB that can be utilized as a feedback component for applications. The RGB is connected through the W-102 module, so the

WiFiNINA
library needs to be installed and included at the top of your sketch to work.

The

WiFiNINA
library is required to use the RGB.

1#include <WiFiNINA.h>2

The pins needs to be defined inside

void setup()
as outputs:

1pinMode(LEDR, OUTPUT);2pinMode(LEDG, OUTPUT);3pinMode(LEDB, OUTPUT);4

To turn ON the pixels, write a

HIGH
state to the LED:

1digitalWrite(LEDR, HIGH); //RED2digitalWrite(LEDG, HIGH); //GREEN3digitalWrite(LEDB, HIGH); //BLUE4

To turn OFF the pixels, write a

LOW
state to the LED:

1digitalWrite(LEDR, LOW); //RED2digitalWrite(LEDG, LOW); //GREEN3digitalWrite(LEDB, LOW); //BLUE4

We can also choose a value between 255 - 0 to write to the LED:

1analogWrite(LEDR, 72);  //GREEN 2analogWrite(LEDG, 122); //BLUE 3analogWrite(LEDB, 234); //RED 4

Communication

Like other Arduino® products, the Nano RP2040 Connect features dedicated pins for different protocols.

SPI

The pins used for SPI (Serial Peripheral Interface) on the Nano RP2040 Connect are the following:

  • (CIPO) - D11
  • (COPI) - D12
  • (SCK) - D13
  • (CS/SS) - Any GPIO (except for A6/A7)

To use SPI, we first need to include the SPI library.

1#include <SPI.h>2

Inside

void setup()
we need to initialize the library.

1SPI.begin();2

And to write to the device:

1  digitalWrite(chipSelectPin, LOW); //pull down the CS pin2  3  SPI.transfer(address); // address for device, for example 0x004  SPI.transfer(value); // value to write5
6  digitalWrite(chipSelectPin, HIGH); // pull up the CS pin7

I2C

The pins used for I2C (Inter-Integrated Circuit) on the Nano RP2040 Connect are the following:

  • (SDA) - A4
  • (SCL) - A5

To use I2C, we can use the Wire library, which we need to include at the top of our sketch.

1#include <Wire.h>2

Inside

void setup()
we need to initialize the library.

1Wire.begin(); 2

And to write something to a device connected via I2C, we can use the following commands:

1  Wire.beginTransmission(1); //begin transmit to device 12  Wire.write(byte(0x00)); //send instruction byte 3  Wire.write(val); //send a value4  Wire.endTransmission(); //stop transmit5

UART

The pins used for UART (Universal asynchronous receiver-transmitter) are the following:

  • (Rx) - D0
  • (Tx) - D1

To send and receive data through UART, we will first need to set the baud rate inside

void setup()
.

1Serial1.begin(9600);2

To read incoming data, we can use a while loop() to read each individual character and add it to a string.

1  while(Serial1.available()){2    delay(2);3    char c = Serial1.read();4    incoming += c;5  }6

And to write something, we can use the following command:

1Serial1.write("Hello world!");2

Connectivity

The Nano RP2040 Connect supports both Wi-Fi and Bluetooth® through the uBlox W-102 module. To use this module, we can use the WiFiNINA library or the ArduinoBLE library.

Wi-Fi

To use the Wi-Fi module on the Nano RP2040 Connect, we will need to install the WiFiNINA library, and include it at the top of our sketch:

1#include <WiFiNINA.h>2

To connect to a Wi-Fi network, we can use the following command:

1WiFi.begin(ssid, pass);2

GET / POST requests

The WiFiNINA library can be used to make GET & POST requests, while connected to the server. The command below is used to connect to

www.google.com
and return the results of searching for the keyword
arduino
.

1  if (client.connect(server, port)) {2    client.println("GET /search?q=arduino HTTP/1.1");3    client.println("Host: www.google.com");4    client.println("Connection: close");5    client.println();6  }7

Tutorials

Bluetooth®

To enable Bluetooth® on the Nano RP2040 Connect, we can use the ArduinoBLE library, and include it at the top of our sketch:

1#include <ArduinoBLE.h>2

Set the service and characteristic:

1BLEService ledService("180A"); // BLE LED Service2BLEByteCharacteristic switchCharacteristic("2A57", BLERead | BLEWrite);3

Set advertised name and service:

1  BLE.setLocalName("Nano RP2040 Connect");2  BLE.setAdvertisedService(ledService);3

Start advertising:

1BLE.advertise();2

Listen for BLE peripherals to connect:

1BLEDevice central = BLE.central();2

Tutorials

Contribute to Arduino

Join the community and suggest improvements to this article via GitHub. Make sure to read out contribution policy before making your pull request.

Missing something?

Check out our store and get what you need to follow this tutorial.