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.
The Nano RP2040 Connect uses the Arduino Mbed OS Nano Boards core.
The full datasheet is available as a downloadable PDF from the link below:
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:
The Nano RP2040 Connect can be programmed through the Arduino IDE 2.0.X. To install your board, you can check out the guide below:
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:
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.
If you need to upgrade the firmware on your Nano RP2040 Connect, follow the link below to a detailed guide.
This guide is for updating the firmware on the NINA W-102 module (Wi-Fi).
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.
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.
Sometimes the board is not detected even when the board is connected to your computer. This can be solved through the following steps:
1. Connect the board to your computer via USB.
2. Place a jumper wire between the REC and GND pins on the board, then press the reset button.
3. This 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:
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.
The Nano RP2040 Connect has 8 analog pins, that can be used through the
analogRead()
function.1value = analogRead(pin, value);
Please note: pin
andA4
should be used for I2C only.A5
Please note: pin
andA6
does not support PWM.A7
Most of the digital & analog pins can be used as PWM (Pulse Width Modulation) pins, the exception being the following pins:
1analogWrite(pin, value);
There are a total of 14 digital pins, whereas 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 resistor
To read the state of a digital pin:
1state = digitalRead(pin);
To write a state to a digital pin:
1digitalWrite(pin, HIGH);
The Arduino RP2040 Connect operates at 3.3 V, and has the 5V pin (VUSB) disabled by default. This is a safety precaution, as connecting higher voltage signals to the board can damage the hardware.
The 5V pin will be enabled if the pads marked VUSB are shorted, by soldering them.
The VUSB pin is located on the bottom of the board. The pads on the Arduino RP2040 Connect are highlighted below.
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.
This module also features an embedded temperature sensor.
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>
And to initialize the library, we can use the following command inside
void setup()
.1if (!IMU.begin()) {2 Serial.println("Failed to initialize IMU!");3 while (1);4 }
The accelerometer data can be accessed through the following commands:
1float x, y, z;2
3 if (IMU.accelerationAvailable()) {4 IMU.readAcceleration(x, y, z);5 }
The gyroscope data can be accessed through the following commands:
1float x, y, z;2
3 if (IMU.gyroscopeAvailable()) {4 IMU.readGyroscope(x, y, z);5 }
The temperature data can be accessed through the following code:
1if (IMU.temperatureAvailable())2 {3 int temperature_deg = 0;4 IMU.readTemperature(temperature_deg);5
6 Serial.print("LSM6DSOX Temperature = ");7 Serial.print(temperature_deg);8 Serial.println(" °C");9 }
If you want to learn more on how to use the IMU, please check out the tutorial below:
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.
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.
1static const int frequency = 20000; //frequency at 20 KHz instead of 16 KHz
If you want to learn more on how to use the Microphone, please check out the tutorial below:
Please note: While using the Bluetooth® Low Energy mode on the NINA module, the RGB cannot be used by default. While the module is in Bluetooth® Low Energy mode, SPI is deactivated, which is used to control the RGBs.
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>
The pins needs to be defined inside
void setup()
as outputs:1pinMode(LEDR, OUTPUT);2pinMode(LEDG, OUTPUT);3pinMode(LEDB, OUTPUT);
To turn ON the pixels, write a
HIGH
state to the LED:1digitalWrite(LEDR, HIGH); //RED2digitalWrite(LEDG, HIGH); //GREEN3digitalWrite(LEDB, HIGH); //BLUE
To turn OFF the pixels, write a
LOW
state to the LED:1digitalWrite(LEDR, LOW); //RED2digitalWrite(LEDG, LOW); //GREEN3digitalWrite(LEDB, LOW); //BLUE
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
Like other Arduino® products, the Nano RP2040 Connect features dedicated pins for different protocols.
The pins used for SPI (Serial Peripheral Interface) on the Nano RP2040 Connect are the following:
The signal names MOSI, MISO and SS has been replaced by COPI (Controller Out, Peripheral In), CIPO (Controller In, Peripheral Out) and CS (Chip Select).
To use SPI, we first need to include the SPI library.
1#include <SPI.h>
Inside
void setup()
we need to initialize the library.1SPI.begin();
And to write to the device:
1digitalWrite(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 pin
The pins used for I2C (Inter-Integrated Circuit) on the Nano RP2040 Connect are the following:
To use I2C, we can use the Wire library, which we need to include at the top of our sketch.
1#include <Wire.h>
Inside
void setup()
we need to initialize the library.1Wire.begin();
And to write something to a device connected via I2C, we can use the following commands:
1Wire.beginTransmission(1); //begin transmit to device 12 Wire.write(byte(0x00)); //send instruction byte 3 Wire.write(val); //send a value4 Wire.endTransmission(); //stop transmit
The pins used for UART (Universal asynchronous receiver-transmitter) are the following:
To send and receive data through UART, we will first need to set the baud rate inside
void setup()
.1Serial1.begin(9600);
To read incoming data, we can use a while loop() to read each individual character and add it to a string.
1while(Serial1.available()){2 delay(2);3 char c = Serial1.read();4 incoming += c;5 }
And to write something, we can use the following command:
1Serial1.write("Hello world!");
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.
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>
To connect to a Wi-Fi network, we can use the following command:
1WiFi.begin(ssid, pass);
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
.1if (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 }
Please note: While using the Bluetooth® Low Energy mode on the NINA module, the RGB cannot be used by default. While the module is in Bluetooth® Low Energy mode, SPI is deactivated, which is used to control the RGBs.
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>
Set the service and characteristic:
1BLEService ledService("180A"); // BLE LED Service2BLEByteCharacteristic switchCharacteristic("2A57", BLERead | BLEWrite);
Set advertised name and service:
1BLE.setLocalName("Nano RP2040 Connect");2 BLE.setAdvertisedService(ledService);
Start advertising:
1BLE.advertise();
Listen for BLE peripherals to connect:
1BLEDevice central = BLE.central();
To use the board as a keyboard, you can refer to the USBHID library that can be found inside the core.
You first need to include the libraries and create an object:
1#include "PluggableUSBHID.h"2#include "USBKeyboard.h"3
4USBKeyboard Keyboard;
Then use the following command to write something:
1Keyboard.printf("This is RP2040 speaking!");