Getting started with Maker Nano RP2040 using CircuitPython: Blinky, RGB LED, and Piezo Buzzer

CNXSoft: This getting started guide was initially posted in Thai language by Suthinee Kerdkaew, and I’ve just translated her work into English with some minor edits.

As discussed in an earlier article, Maker Nano RP2040 is a board following the Arduino Nano form factor, but with a more powerful Raspberry Pi RP2040 microcontroller. The board also comes with plenty of LEDs, as well as two RGB LEDs, and a piezo buzzer for audio output.

Maker Nano RP2040 circuitpython guide

Mr. Jean-Luc Aufranc has just given me a Maker Nano RP2040 board received from Cytron for review. I’ve never used a board before, so it’s my first experience, and in this article, I’ll try to program Maker Nano RP2040 with CircuitPython with three demos: a blinky sample, changing the color of the RGB LEDs, and playing a melody through the piezo buzzer. Let’s see if I can do it.

Let’s get started. I first downloaded the CircuitPython firmware from the official website. Simply select the language, and click on “DOWNLOAD.UF2 NOW”

CircuitPython Maker Nano RP2040

After downloading the file, I connected the board to my Ubuntu laptop with a Micro USB to USB cable. It will automatically mount a drive named “CIRCUITPY”.  Oh! That means the Maker Nano RP2040 board comes pre-installed with CircuitPython, so we can use the board out of the box! But if you wanted to install the latest version of the firmware, you could do so using the same firmware update method as for Raspberry Pi Pico.

CIRCUITPY drive

We can double-click on code.py to see the sample program pre-installed on the board. There’s a lot of code and it would be difficult for a beginner like me to understand.

CircuitPython “Blinky” sample

So I want to write a program that’s easy: the typical “blinky” program that blinks an LED regularly using CircuitPython. The code looks as follows:


We can see the blue LED connected to GPIO 0 turn on and off every 500 ms (1-second cycle) as shown in the video below.

Using the RGB LEDs on Maker Nano RP2040

In the next step, we will write a program in CircuitPython that changed the color of the two RGB LEDs upon pressing the button connected to GPIO 20. The first press will switch to red, the second to green, and the third to blue. Let’s start by double-clicking on code.py to change the code to:


We can now change the colors to red, green, and blue following the steps in the video below.

Playing a melody through the piezo buzzer

We’ll now play the melody “do re mi fa sol la si/ti” and in reverse using the piezo buzzer. For this, we’ll need to fill the frequencies in Hz for each music note in an array. Here’s our little program:


We can hear the melody in the video below.

I could eventually program the board successfully! Finally, I must thank Jean-Luc Aufranc for his guidance during this review.

Share this:

Support CNX Software! Donate via PayPal or cryptocurrencies, become a Patron on Patreon, or buy review samples

ROCK Pi 4C Plus
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
0 Comments
Advertisement