Embedded programming with Arduino on the Raspberry Pi Pico
Introduction
About Embedded Programming
Application Programming
Embedded Programming
Embedded Programming on Arm
Build a smart device prototype
Program your smart device prototype
Learn about interrupts
Add the interrupt code
Refactor the application
Next Steps
Embedded programming with Arduino on the Raspberry Pi Pico
Who is this for?
This is an introductory topic for software developers interested in embedded programming.
What will you learn?
Upon completion of this Learning Path, you will be able to:
- Understand the basics of embedded programming
- Know the differences between embedded and application development
- Write a simple embedded application
- Run your embedded application on a Raspberry Pi Pico
- Understand how hardware interrupts are used in embedded systems to respond to external changes
- Add interrupt handlers to an embedded application
Prerequisites
Before starting, you will need the following:
- The Arduino IDE with the RP2040 board support package installed on your computer
- A Raspberry Pi Pico board
- A PIR sensor for detecting motion
- A peizo-electric buzzer for signaling motion
Summary
This summary was drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.
You’ll learn about embedded programming and build a motion detector with a Raspberry Pi Pico (RP2040, Cortex-M0+). First, you’ll compare application and embedded software stacks, then apply those differences by wiring a passive infrared (PIR) sensor and a piezo buzzer to the Pico. Using the Arduino IDE, you’ll write a simple sketch that configures GPIO, registers an interrupt handler, and reacts to external changes without polling. Finally, you’ll deploy to bare metal on the Pico and validate that motion events trigger the buzzer immediately, demonstrating how hardware interrupts drive responsive behavior on a small Arm microcontroller.
Frequently asked questions
These FAQs were drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.
Select an RP2040-based board from the installed package and choose the USB/serial port associated with the Raspberry Pi Pico. If the upload fails, recheck both the board and port selections.
Connect the PIR output to a digital input pin and the buzzer to a digital output pin with a common ground. Make sure the pin numbers in your wiring match the pin definitions used in the sketch.
When motion occurs, the buzzer responds immediately without waiting for a timed loop. If you see an instant reaction when the PIR output changes, the interrupt handler is being invoked.
Verify power and common ground, confirm the selected GPIO pins match the sketch, and ensure the input is configured for the PIR signal and the output drives the buzzer. Also recheck that the correct RP2040 board and port are selected and that the upload completed successfully.
No. The example runs on bare metal using Arduino tooling on the RP2040. Any RTOS stack references are for context about typical Arm embedded architectures, not for this build.