Download PDF Parts List View on YouTube Download Code

Today we are going to be looking at the brand new Arduino Nano RP2040 Connect, the much-anticipated Arduino board with a Raspberry Pi RP2040 processor.

We’ll see how to get our Arduino IDE prepared and how to use some of the onboard peripherals included with this great new board. So let’s get started!

Introduction

Earlier this year we were surprised to see a new board from the folks at Raspberry Pi. Unlike all of their other offerings, this board was not a microcomputer, instead, they released their first microcontroller – the Raspberry Pi Pico.

The heart of the Pico was a new microcontroller, the RP2040.  Built for the Raspberry Pi Foundation, this new 32-bit MCU sports a wealth of advanced features and could be programmed using MicroPython, CircuitPython, or C++.

Wanting to increase support for their new microcontroller, and being all-around great members of the maker community, the folks at the Raspberry Pi Foundation didn’t keep all of this goodness to themselves. Instead, they have licensed the RP2040 to other manufacturers, so they could create their own unique boards with it.

We have already seen RP2040 designs from Adafruit, Pimoroni, and Sparkfun, along with a few other manufacturers. But the real surprise came when Arduino announced that they would also be releasing an RP2040-based design.

Arduino Nano RP2040 Connect

And finally, at the end of May 2021, the new board arrived – the Arduino Nano RP2040 Connect.

Let’s examine this board and see what we can do with it!

Arduino Nano RP2040 Connect

The Arduino Nano RP2040 Connect has the same form-factor and pinout as the original Arduino Nano 8-bit AVR board, but that’s where the similarities end. This is a powerful board with both an RP2040 and an ESP32, the latter embedded within a u-blox NINA-W102 WiFi and Bluetooth module.

Arduino Nano RP2040 Connect - Top View

The board has some pretty impressive features:

  • RP2040 Dual-core MCU
  • WiFi 801.11b/g/n
  • Bluetooth and BLE 4.2
  • 6-axis IMU with Machine Learning
  • MEMS Microphone Module
  • Cryptographic Coprocessor
  • Internal switching power supply
  • 16Mb Flash Memory
  • Onboard RGB LED

Let’s take a quick look at some of these items in detail.

RP2040 Microcontroller

Arduino Nano RP2040 Connect - MPU

The RP2040 is a 32-bit microcontroller that was designed for the Raspberry Pi Pico board. This is a dual-core Cortex M0+ device that operates at up to 133MHz

Internally the core of the MCU operates at 1.8-volts, however, it has internal level-converters to work with 3.3-volt logic devices.

The RP2040 has 264Kb of embedded SRAM, 30 multi-function GPIO pins, and a 4-channel, 12-bit analog to digital converter.

NINA-W102 Wifi & Bluetooth Module

Arduino Nano RP2040 Connect - WiFi & Bluetooth Module

The NINA-W102 module from u-blox is based upon the popular ESP32 microcontroller.  It provides both WiFi and Bluetooth capabilities for the Arduino Nano RP2040 Connect, and it is also used to drive the onboard RGB LED indicator.

This module has its own internal antenna and has a maximum WiFi range of 400 meters.  It operates on the 2.4GHz band.

LSM6DSOXTR 6-axis IMU

Arduino Nano RP2040 Connect - IMU

The LSM6DSOXTR Inertial Measurement Unit (IMU) has both a 3D accelerometer and a 3D gyroscope. 

One unique feature is that this IMU also has a Machine Learning component that can sense the type of motion. This feature allows for some very advanced projects such as pedometers and gesture trackers to be easily constructed with the Arduino Nano RP2040 Connect board. 

MP34DT05 MEMS Microphone

Arduino Nano RP2040 Connect - MEMS Microphone

The MP34DT05 is an omnidirectional MEMS microphone. MEMS is an abbreviation for Micro-Electromechanical Systems.  This type of microphone is also referred to as a “solid-state microphone”.

This microphone outputs data in Pulse Density Modulation (PDM) format, a digital representation of an analog signal.

The microphone connects to the RP2040 using the I2C bus.

ATECC608A Cryptographic Coprocessor

Arduino Nano RP2040 Connect - Crypto Coprocessor

The ATECC608A Cryptographic Coprocessor provides protected storage for up to 16 keys or certificates in its built-in EEPROM. 

This device is used to store network endpoint keys for IoT devices, allowing the Arduino Nano RP2040 Connect to be used in secure IoT applications.

This device has been used in all of the Arduino MKR Family boards.

AT25SF128A-MHB-T  Flash Memory

Arduino Nano RP2040 Connect - Flash Memory

The AT25SF128A-MHB-T is a 16MB (128 megabits) Flash Memory chip that allows you to store data for over 20 years.  It connects to the RP2040 using the SPI bus.

In the Arduino Nano RP2040 Connect, this chip is operated in dual-channel mode, allowing data transfers of up to 240 Mbps.

This is an enhanced Flash memory chip that can be programmed and erased over 100,000 times.

RGB LED

Arduino Nano RP2040 Connect - RGB LED

The surface-mounted RGB LED on the Arduino Nano RP2040 Connect is connected to the ESP32 in the NINA-W102 module.

Because of this, you will need to use the WiFiNINA Library to address this LED. In your code you can use the following constants to control it:

  • RedLEDR
  • GreenLEDG
  • BlueLEDB

The board also has an orange LED connected to I/O pin 13, this is the “built-in” LED common to most Arduino boards.  There is also a green Power LED.

Arduino Nano RP2040 Pinouts

The Arduino Nano RP2040 has the same form-factor and the same pinout as the original 8-bit AVR-based Arduino Nano.

Arduino Nano RP2040 Connect - Pinout
Pinout (Image courtesy of Arduino)

This arrangement allows you to use existing prototype tools and adapters with the board.

Unlike the original Nano the RP2040 Connect uses a MicroUSB connector for data transfer, it can also be used to power the board. When the MicroUSB connector is used to power the board the 5-volts supplied by the host computer is available on the VUSB pin, but only if you solder a jumper on the bottom of the board.

Arduino Nano RP2040 Connect - Underside

The board has an internal step-down converter and may be powered either by the MicroUSB connector or by applying a voltage of 5 to 21 volts to the VIN pin.

The 3V3 jumper on the bottom of the board provides access to the internal step-down converter output.

Design Considerations

As with the Arduino Nano 33 IoT board that we looked at earlier, the Nano Rp2040 Connect also has some similar design considerations that you need to be aware of before you start using it.

There are two very important considerations you should note if you are porting an older Nano-based design to the new Nano RP2040:

  • Logic levels – This is a 3.3-volt logic device and it is not 5-volt tolerant.
  • I2C – Pins A4 and A5 are the I2C SDA and SCL pins respectively. They have internal pull-up resistors, so they cannot be used as analog input pins.

The board itself is available both with or without the header pins soldered in, boards without pins have a set included. As with many new microcontrollers this board uses a castellated design, allowing it to also be used as a surface-mount device.

Arduino IDE Setup

We will start by setting up our development environment. There are three IDE’s currently supported:

  • Arduino IDE 1.8.X – The “classic” Arduino IDE that most of us are pretty familiar with.
  • Arduino IDE 2.0.X – The new IDE, which is still in Beta as of this writing.
  • Arduino Web Editor – An online IDE from Arduino

I will be providing details for the installation using the classic Arduino IDE 1.8.X here. Arduino has installation instructions for all of these IDE’s on their website.

Boards Manager

You’ll want to be sure that you have a recent version of the classic Arduino IDE, as of this writing that would be version 1.8.15. 

In order to use the Arduino Nano RP2040 Connect you’ll need to install a new board into the IDE. You do that using the Boards Manager.

  1. Open the Arduino IDE.
  2. Click on Tools. A menu will drop down.
  3. Look for the section of the menu that lists the microcontroller board you are currently using (i.e. Arduino Uno) and highlight the board name.
  4. A sub-menu will appear when you highlight the board.
  5. The first item in the menu is Boards Manager. Click on it, and the Boards Manager window will open.

In the filter (search) box at the top of the Boards Manager type “mbed”. This will filter the list to boards with that word in their names.

Look for Arduino Mbed OS Nano Boards. Make sure to avoid the one marked “DEPRECIATED”, the one we want was at version 2.1.0 as of this writing and it lists the Arduino Nano RP2040 Connect as one of its supporting boards.

Arduino Nano RP2040 Connect - Boards Manager

When you move your mouse over the board you’ll get an Install button on the height side. Click the button to install the new board.  Be patient, as it can take a while for all of the files and examples to load.

After the installation has completed you can close the Boards Manager.

Mandatory Blink Test

New computer systems and languages are generally initiated by running a “Hello World” program, and with the Arduino microcontrollers that program is called Blink.  It’s an extremely simple sketch that simply flashes the onboard LED.  If you have ANY experience with microcontrollers then you’re very familiar with it.

While it certainly isn’t the most thrilling application, Blink is a great test to see if everything is working properly.  

Most new microcontrollers come out of the factory running Blink, so what I usually do is modify the Blink sketch so I can be sure I’m not being fooled by the board’s existing program. However, the Arduino Nano RP2040 comes packaged with a very unusual Blink-type sketch that uses the onboard LED and also uses the RGB LED.  So uploading Blink as it is will be sufficient to confirm that we can successfully program our board.

So let’s upload the Blink sketch!

Before we do that, however, we’ll need to connect our new Nano RP2040 to a MicroUSB cable that is attached to a USB port on our workstation. This will also power the board for us, so as soon as you hook up the cable you should observe a green LED lighting up on the board, along with the “fancy Blink” that I just mentioned.

Next, we need to select the Arduino Nano RP2040 from our list of boards:

  1. Open the Arduino IDE.
  2. Click on Tools. A menu will drop-down.
  3. Look for the section of the menu that lists the microcontroller board you are currently using (i.e. Arduino Uno) and highlight the board name.
  4. A sub-menu will appear when you highlight the board.
  5. Look for Arduino Mbed OS Nano Boards in the list of board menus and highlight it.
  6. A list of boards (currently two boards) will be displayed.
  7. Select the Arduino Nano RP2040 Connect from the list.

We also need to select the correct Port to write the data to:

  1. Click on the Tools menu again, which will result in a menu dropping down.
  2. Look for the Port selection (under the Board selection you just set).
  3. A sub-menu will open, listing the ports available

The names of the ports will differ depending upon your operating system, so look for the listing that has “Arduino Nano 2040 Connect” in its name and select it.

Now we can load Blink.

  1. Click on the File menu.
  2. Navigate down to Examples. A sub-menu will appear.
  3. At the top of this sub-menu is a section labeled Built-in Examples. Open the first sub-menu in this section, labeled 01. Basics.
  4. In this final sub-menu open the Blink sketch.

Now use the Upload button (the “Arrow” button at the top-left of the Arduino IDE) to upload Blink to your Arduino Nano RP2040 Connect board.

If you are successful the “fancy  Blink” the board was preloaded with wil be replaced by a flashing orange LED. And you are now ready to move on to bigger and better things!

Upload Errors

Uploading Blink is generally pretty trivial, but you may run into an error message saying that the board at your selected COM port is not available.  This is not uncommon, and can usually be ignored.

Arduino Nano RP2040 Connect - Error Message

In some cases, however, you will still be unsuccessful. You will also notice that the Arduino Nano RP2040 is now visible in your File Manager, indicating that the bootloader is in the wrong mode.

You can fix this as follows:

  1. Unplug the MicroUSB cable from the Arduino Nano RP2040 Connect board.
  2. Take a jumper wire and short out the GND and RESET puns (the Reset pin is also labeled REC on the bottom of the Nano RP2040 board).
  3. Reconnect the MicroUSB cable to the board.
  4. Remove the jumper.

This should reset the bootloader.

Linux Post Install Fix

On some Linux workstations, you may find that you still cannot upload to the Arduino Nano RP2040 board. I had this issue with three of my Ubuntu workstations.

There is a fix for this, packaged with the board files you installed with the Boards Manager (a similar fix is also available for Windows).  It’s in the form of a BASH file called post_install.sh.

Here is how I ran the fix on my workstation.

First, you need to find the post_install.sh file within your Arduino boards installation. The way I did this was to open my Linux Nano File Manager and perform a search (Ctrl-F) for it.

Once you find the file highlight it, right-click, and choose Open Containing Folder. The file manager will open in the folder containing the desired BASH script.

Now click anywhere in this folder and choose “Open in Terminal”, which will naturally open the Terminal in this location.

Now type the following:

You’ll be prompted for your password so you can run the file with root permissions. Note that you won’t get any visual feedback while typing your password. 

Press Enter when you’ve typed it, and the BASH file will run.

Now try uploading Blink again, it should work this time.  

Web Server AP Mode

Now that we have our development environment all prepared we can move on to more interesting experiments.

There is no additional wiring or components required for this or any of the other experiments we will do today.  And all of the code we will be using are examples provided by Arduino in their tutorials.

In the first experiment, we will demonstrate the WiFi capabilities of the Arduino Nano RP2040 Connect by configuring the NINA-W102 module as an access point.  We will also be using the RGB LED that is connected to the ESP32 within the NINA-W102 module.

We are going to create a WiFi access point and a web-based interface to allow us to control the RGB LED.  You can use the techniques shown here to control other projects with a web-based interface.

The code for our demo is here:

What we are setting up here is an access point with a web page that listens for GET requests. Here are a few key points in the sketch.

On lines 4 & 5 you will see an SSID and Password. These are NOT the SSID and password for your WiFi network, rather these are the SSID and Password for the wireless access point that we are setting up. You can change them to another SSID and Password if you wish, however you should note that each field needs to be at least 8-characters long.

Also, note how the three segments of the RGB LED are set up as outputs on lines 20-22. The LEDs are addresses with constants that are part of the WiFiNINA library.

In the Loop, we look for a client connection. If we get one then we create the webpage, which you’ll see starting on line 94.

The webpage we are creating consists of 6 button elements, two (on & off) for each LED segment.  You can see these on lines 110-115. Each button element sends a GET request when a mousedown event occurs. Each get request is appended by a 2-letter code, indicating which button has been pressed.

Now if you look at lines 130-146 you will see the receiving end of this transaction. The GET requests are checked to determine the two characters at the end. Then these characters are used in an “if” statement to determine which LED segment to turn on or off.

So, for example, if we click on the Red ON button we send a GET request appended by “RH”. On the receiving end, we examine the request, extract the “RH” and in the “if” statement we set the Red segment of the LED HIGH.

Load the code into the Arduino Nano RP2040 Connect and observe the serial monitor. You should see your new access point has been created.

Web Access Point Serial Monitor

Now use a computer or mobile device to connect to that access point, using the specified password. Once connected go to 192.168.4.1 in your device’s web browser. You should see a webpage with six buttons.

Web Access Point Website Test

Try clicking the buttons and observe the state of the RGB LED on the RP2040 Connect board.  You should be able to control it using the web-based interface.

IMU Machine Learning Core

The LSM6DSOX IMU is not just a gyroscope and accelerometer, it also has a Machine Learning component that can pre-process the data to determine the type of movement detected.

In order to make use of the Machine Learning core we will need to use an appropriate library, the STM32duino X-NUCLEO-IKS01A3 library. You can find this in your Library Manager:

  1. Open your Arduino IDE.
  2. Click the Tools menu item, this will cause a menu to drop down.
  3. Look for the Manage Libraries item in the menu and click it.
  4. The Library Manager will open in a new window.
  5. Filter (search) for “STM32duino X-NUCLEO-IKS01A3” (the easiest method is to copy this text and paste it into the filter box)
  6. Hover over the result and click the Install button.
  7. The library will be installed. You may close the Library Manager when you are done.

Arduino Nano RP2040 Connect - IMU Library

The code that we will be using for our experiment is an example that is included with the STM32duino X-NUCLEO-IKS01A3  library, however, it was written for a different microcontroller. So we will need to modify it for the Arduino Nano RP2040 Connect board.  I’ll show you how to do that in a moment, but first, let’s see what the code actually does.

In this experiment, we’ll construct a somewhat amusing device that measures movement and tries to determine what type of movement it is detecting. It can look for a number of different movements:

  • Stationary
  • Walking
  • Jogging
  • Biking
  • Driving

It accomplices this by feeding the IMU measurements into the Machine Learning core and allowing the data to be processed for three seconds.  The resulting data is inserted into an array, whose value determines what type of movement has been detected.

You can get this sketch in the examples included with the STM32duino X-NUCLEO-IKS01A3 library:

  1. Open the Arduino IDE.
  2. Click on the File menu item. A menu will drop down.
  3. Scroll down to Examples. A sub-menu will appear.
  4. Scroll down the Examples sub-menu until you get to the last item, INCOMPATIBLE. These are sketches incompatible with your currently selected microcontroller board.
  5. In the INCOMPATIBLE menu look for STM32duino X-NUCLEO-IKS01A3 and highlight it to reveal yet another sub-menu.
  6. Look for the X_NUCLEO_IKS01A3_LSM6DSOX_MLC sketch and open it.

You’ll get a warning message in the Arduino IDE status bar indicating that this sketch is not made for your current processor. You can ignore it, because we are going to make a one-line modification to it so that it works with the RP2040.

The modification is pretty simple, all you need to do is add the following line somewhere inside the declarations section of the sketch:

The following is an example of the modified sketch:

The sketch has two files, the second one is the activity recognition file for the Machine Learning core in the IMU.

The Machine Learning core is called in line 127. It is called three seconds after an interrupt is received, the interrupt indicates that the IMU has detected a change in motion. The three-second delay gives the Machine Learning core time to process the data.

Load the sketch onto your Arduino Nano RP2040 board and open your serial monitor, note that the sketch sets up the serial monitor at a baud rate of 115200 instead of 9600 (although I accidentally opened mine at 9600 and it seemed to work fine).

Arduino Nano RP2040 Connect - IMU Test

Now you need to simulate some motion while looking at your serial monitor. In my test, I was able to simulate walking and jogging by shaking the breadboard that I had my Arduino Nano RP2040 mounted upon.  

Of course, to really test this you would need to be able to battery power it (or power it with a notebook) and take it for a walk, jog, or drive!

Reading Microphone Data

Our final experiment will involve the MP34DT05 MEMS microphone.

I thought that this was a fun sketch, as it essentially emulates that marvelous 80’s invention called ‘The Clapper”. For those of you unfamiliar with this electronic marvel, the Clapper was a sound-activated switch that allowed you to control the power to your appliances by clapping your hands!

In this sketch we will be turning on and off the blue segment of the RGB LED on the Arduino Nano RP2040 Connect board. Not as much fun as controlling your television, but the same principle.

The sketch requires the PDM library, which was installed when you installed the RP2040 board using the Boards Manager. It also uses the WiFiNINA library, which may surprise you as it has no WiFi features. Remember, the RGB LED is connected to the ESP32 in the NINIA-W102 modules, so the WiFiNINA library is used to control the LED.

Here is our sketch:

The sketch samples the microphone’s PDM output and measures its level. If it exceeds a value of 10,000 or -10,000 (remember, audio waveforms have both a positive and negative component) it toggles the blue LED.

In the Setup, we set up the parameters for the microphone. There are some comments in the sketch that show you how to change the microphone’s sensitivity, but you shouldn’t need to do that.

In the Loop, we read the samples and determine their level. If it exceeds the thresholds described earlier we will toggle the LED_SWITCH variable. This in turn sets the state of the LED.

Arduino Nano RP2040 Connect - Microphone Test

Load the sketch and start clapping! You should see the LED toggle on and off.

Congratulations, you’ve now built your own Clapper!

Conclusion

At 25 US dollars, the Arduino Nano RP2040 is not exactly inexpensive, especially when compared to the original Raspberry Pi Pico that lists for four just dollars.  And, undoubtedly, many people will make a somewhat inaccurate comparison to the cost of an ESP32 module, most of which are much cheaper.

First, let’s keep in mind that this is a genuine Arduino product, and all of these products come with a higher price tag. They are high-quality boards made in Italy (and a few other places), not China or Malaysia, so labor costs are obviously higher.  

Second, when comparing this to the ESP32 we should remember that the Arduino Nano RP2040 actually HAS an ESP32 on board, inside the NINA-W102 module, as well as the RP2040.  So naturally, it will be more expensive!

Third, the onboard peripherals are pretty impressive, especially the built-in IMU with Machine Learning capabilities and its cryptographic coprocessor. Things you don’t find on many ESP32 boards.

Finally, when weighing the cost of this board we should keep in mind the incredible contributions Arduino has made, and continues to make, to the maker and hobbyist community. They have created a free IDE that is useful for many other boards, including the ESP32. And they have released all of their designs, including the RP2040 Connect, as open source products, allowing other manufacturers to create lower-quality but less expensive clones.  So giving them a little money is a pretty good thing.

Considering all of the above I’d say 25 dollars is a fair price for a board with these capabilities. And you can be sure that you’ll be seeing more of the Arduino Nano RP2040 Connect in future articles and videos here in the workshop!

Parts List

Here are some components that you might need to complete the experiments in this article. Please note that some of these links may be affiliate links, and the DroneBot Workshop may receive a commission on your purchases. This does not increase the cost to you and is a method of supporting this ad-free website.

COMING SOON!

 

Resources

Code used in Article – All of the code used in today’s experiments, in one ZIP file.

Arduino Nano RP2040 Connect Overview – Arduino’s guide to the features of the new Nano RP2040 Connect board.

Arduino Nano RP2040 Connect  Technical Reference – Arduino’s reference guide for the Arduino Nano RP2040 Connect board

Raspberry Pi RP2040 Datasheet – Guide to the Raspberry Pi RP2040 MCU

 

Arduino Nano RP2040 Connect – Arduino meets Raspberry Pi
Summary
Arduino Nano RP2040 Connect - Arduino meets Raspberry Pi
Article Name
Arduino Nano RP2040 Connect - Arduino meets Raspberry Pi
Description
The Arduino Nano RP2040 Connect board fuses a Raspberry Pi RP2040 MCU with ESP32-based Wifi & Bluetooth. The board also features an advanced 6-axis IMU with Machine Learning capabilities, a MEMS Microphone, and a Cryptographic Coprocessor. Today we'll examine the board, set up our development environment and run a few sample sketches.
Author
Publisher Name
DroneBot Workshop
Publisher Logo
Tagged on:
Subscribe
Notify of

9 Comments
Oldest
Newest
Inline Feedbacks
View all comments
David S
2 years ago

Another well written, informative, and unbiased article. Please keep up your good work so that we may have a place to go to learn and ask questions when needed. Thank you again

todd roles
2 years ago

great article Bill. I preordered mine and it arrived last week. Excited to get started. For what it is worth, I read this article before I have seen your video…I love your videos, but I really appreciate the effort you put into the articles and when I have questions or am working on a project I always refer back to your written articles. The well produced vids are just icing on the cake!

2 years ago

The first part works fine, but the clapper does not.
With the gain set to -90 (db, I assume) the LED switches with sound AND at random.
Any thoughts?
Thanks

Gaétan Bourgeois
2 years ago

Hi Bill,
I’m only about 3 months old in the world of microcontroller. Thanks to you and your friendly workshops to teach and guide me in these new horizons.
I just bought a Nano RP2040 and I can’t wait to see more of it in your next workshops…
Keep up with your great site!

G Bourgeois
2 years ago

Hi Bill, do you know if platform IO will eventually support the Nano RP2040? I haven’t found this board…

Do-Hyeong
2 years ago

Thanks always for your great videos.

I leave this comment since I am facing program uploading issue for this “arduino rp4020 connect” using platformio.

For “pi pico”, I successfully got it worked by re-installing usb driver to work on Windows.
But the same solution doesn’t seems to work for “arduino rp4020 connect”.

If you have a solution for this, please share it! ^^

Bob M
2 years ago

I am trying to get a web based interface running for a portable application using an ESP32S2 board and your “Web Server AP Mode” example was a big help. Thanks sir!

Sean Miller
1 year ago

Great article! Thanks for your time building it. It has been most helpful.

Alan Mulligan
1 year ago

Hi

I was wondering if you could help me out, I am tring to run @file   X_NUCLEO_IKS01A3_LSM6DSO_Pedometer.ino
from the same library but the step counter wont increment. The above example works fine .I kow it uses a different header file, any help would be appreciated. Thanks A