Skip to content

mryndzionek/rp2040_pico_sdk_playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

679248a · Nov 1, 2024

History

65 Commits
Aug 18, 2024
Nov 1, 2024
Oct 24, 2024
Aug 24, 2024
Oct 24, 2024
Jul 11, 2023
Aug 18, 2024
Oct 24, 2024
Aug 15, 2024
Oct 24, 2024
Aug 8, 2024
Aug 15, 2024

Repository files navigation

rp2040_pico_sdk_playground

build

Building

git submodule update --init --recursive
export PICO_SDK_PATH=/path/to/your/pico-sdk
mkdir build
cd build
cmake ..
make

More complete info can be extracted from GitHub action script.

Applications

rpi_lcd_test

rpi_lcd_test

A simple app demonstrating the use of PIO and DMA for efficient data transfers to a 480x320 TFT display. The graphics library creates a monochromatic image in memory which is expanded to 16-bit color codes in PIO block and transferred via 8-bit parallel interface.

rpi_ws2812_lamp

A simple app controlled by one button, controlling a WS2812 strip/matrix. Can be used to test strips/matrices.

Button press/sequence Action
Hold Adjust brightness
Tap and hold Adjust color
One tap Toggle 3-minute timer
Two taps Toggle between 'Off' and 'Max Red'
Three taps Cycle through presets

rpi_inmp441_fft_demo

Reading audio from a INMP441 MEMS microphone using PIO+DMA, computing fixed point FFT (CMSIS-DSP) and displaying an ASCII spectrogram on serial.

rpi_inmp441_fft_demo.mp4
rpi_inmp441_fft_demo_2.mp4

rpi_tflm_micro_speech_demo

/Keyword Spotting/Visual Wake Words/ on RP2040

TFLM Micro Speech model is ported to Raspberry Pi Pico (RP2040, Cortex-M0+). Sound is from a MEMS I2S microphone (INMP441). The CPU is clocked at 250MHz. Data from the microphone is transferred using PIO+DMA. With this configuration real-time speech analysis is possible (stride is 20ms at 16kHz sample rate and single inference takes ~19ms).

rpi_tflm_micro_speech_demo.mp4

rpi_inmp441_kws

TinyML keyword spotting demo. The model is Shallow RNN architecture with a FastGRNN cell converted to ~200 lines of C code. At 280MHz Core0 is setting up DMA transfers from I2S microphone and doing feature extraction (dc blocking -> preemphasis -> FFT -> power -> log -> Mel filterbank) in frames, nine frames a second.

sharnn

The core utilization is ~70%. Core1 every 105ms does NN inference which takes about 85ms (77% core utilization).

The microphone (INMP441) connections are as follows:

pico_kws

rpi_lcd_3d_test

tinygl_1b test app (dithered glxgears)

glxgears_1b.mov

gears

rpi_lcd_3d_skull_test

tinygl_1b test app - model exported from Blender.

skull

pitchshifter

Real time /pitch shifter/voice changer/ application. Pitch shifting code generated in Faust. As a bonus there are also vibrato and echo effects. Short button presses cycle through the pitch levels. Long button press between 500ms-2000ms activates and deactivates echo. Button press longer than 2000ms activates the vibrato.

Example recording:

pitch_shifter_test.mov

INMP441 microphone connections are like in the rpi_inmp441_kws application:

pico_kws

Audio output via GPIO PWM pin with a low-pass filter:

pwm_audio

LM386 or PAM8403 can be used to amplify further, to connect a speaker. A tact switch needs to be connected between GP13 and GND.