Raspberry Pi RP2040
The Raspberry Pi RP2040 is the debut microcontroller from Raspberry Pi - and it's fully supported by Edge Impulse. You'll be able to sample raw data, build models, and deploy trained machine learning models directly from the studio. It's available for around $4 from Raspberry Pi foundation and a wide range of distributors.
To get started with the Raspberry Pi RP2040 and Edge Impulse you'll need:
A Raspberry Pi 2040 microcontroller. The pre-built firmware and Edge Impulse Studio exported binary are tailored for Raspberry Pi Pico, but with a few simple steps you can collect the data and run your models with other RP2040-based boards, such as Arduino Nano RP2040 Connect. For more details, check out "Using with other RP2040 boards".
(Optional) If you are using the Raspberry Pi Pico, the Grove Shield for Pi Pico makes it easier to connect external sensors for data collection/inference.
The Edge Impulse firmware for this development board is open source and hosted on GitHub: edgeimpulse/firmware-pi-rp2040.
Installing dependencies
To set this device up in Edge Impulse, you will need to install the following software:
If you'd like to interact with the board using a set of pre-defined AT commands (not necessary for standard ML workflow), you will need to also install a serial communication program, for example
minicom
,picocom
or use Serial Monitor from Arduino IDE (if installed).On Linux:
GNU Screen: install for example via
sudo apt install screen
.
Problems installing the CLI?
See the Installation and troubleshooting guide.
Connecting to Edge Impulse
With all the software in place, it's time to connect the development board to Edge Impulse.
1. Connect the development board to your computer
Use a micro-USB cable to connect the development board to your computer while holding down the BOOTSEL button, forcing the Raspberry Pi Pico into USB Mass Storage Mode.
2. Update the firmware
The development board does not come with the right firmware yet. To update the firmware:
Download the latest Edge Impulse firmware, and unzip the file.
Drag the
ei_rp2040_firmware.uf2
file from the folder to the USB Mass Storage device.Wait until flashing is complete, unplug and replug in your board to launch the new firmware.
3. Setting keys
From a command prompt or terminal, run:
This will start a wizard which will ask you to log in, and choose an Edge Impulse project. If you want to switch projects run the command with --clean
.
Alternatively, recent versions of Google Chrome and Microsoft Edge can collect data directly from your development board, without the need for the Edge Impulse CLI. See this blog post for more information.
4. Verifying that the device is connected
That's all! Your device is now connected to Edge Impulse. To verify this, go to your Edge Impulse project, and click Devices. The device will be listed here.
Next steps: building a machine learning model
With everything set up you can now build your first machine learning model. Since Raspberry Pi Pico does not have any built-in sensors, we decided to add the following ones to be supported out of the box, with a pre-built firmware:
Grove Ultrasonic Ranger (GP16; pin D16 on Grove Shield for Pi Pico).
DHT11 Temperature & Humidity sensor (GP18; pin D18 on Grove Shield for Pi Pico).
Analog signal sensor (pin A0).
There is a vast variety of analog signal sensors, that can take advantage of RP2040 10-bit ADC (Analog to Digital Converter), from common ones, such as Light sensor, Sound level sensor to more specialized ones, e.g. Carbon Dioxide sensor, Natural Gas sensor or even an EMG Detector.
Once you have the compatible sensors, you can then follow these tutorials:
Support for Arduino RP2040 Connect was added to the official RP2040 firmware for Edge Impulse. That includes data acquisition and model inference support for:
onboard MP34DT05 microphone
onboard ST LSM6DSOX 6-axis IMU
the sensors described above still can be connected
Looking to connect different sensors? The Data forwarder lets you easily send data from any sensor into Edge Impulse.
Using with other RP2040 boards
While RP2040 is a relatively new microcontroller, it was already utilized to build several boards:
The official Raspberry Pi Pico RP2040
Arducam Pico4ML (Camera, screen and microphone)
Seeed Studio XIAO RP2040 (extremely small footprint)
Black Adafruit Feather RP2040 (built-in LiPoly charger)
And others. While pre-built Edge Impulse firmware is mainly tested with Pico board, it is compatible with other boards, with the exception of I2C sensors and microphone - different boards use different pins for peripherals, so if you’d like to use LSM6DS3/LSM6DSOX accelerometer & gyroscope modules or microphone, you will need to change pin values in Edge Impulse RP2040 firmware source code, recompile it and upload it to the board.
Last updated