The summer, and Louis Wood’s internship with our Maker in Residence, was creeping to a close without his final build making it off the ground. But as if by magic, on his very last day, Louis got his handmade drone flying.
3D-printed CAD design
The journey of building a custom drone began with designing in CAD software. My initial design was fully 3D-printed with an enclosed structure and cantilevered arms to support point forces. The honeycomb lid provided cooling, and the enclosure allowed for embedded XT-60 and MR-30 connections, creating a clean and integrated look. Inside, I ensured all electrical components were rigidly mounted to avoid unwanted movement that could destabilise the flight.
Testing quickly revealed that 3D-printed frames were brittle, often breaking during crashes. Moreover, the limitations of my printer’s build area meant that motor placement was cramped. To overcome these issues, I CNC-routed a new frame from 4 mm carbon fibre, increasing the wheelbase for better stability. Using Carveco software, I generated toolpaths and cut the frame on a WorkBee CNC in our Maker Lab. After two hours, I had a sturdy, assembled frame ready for electronics.
Not one, not two, but three Raspberry Pis
For the drone’s brain, I used a Raspberry Pi Pico 2 connected to an MPU6050 gyroscope for real-time orientation data and an IBUS protocol receiver for streamlined control inputs. Initially, I faced issues with signal processing due to the delay of handling five separate PWM signals. Switching to IBUS sped up the loop frequency by tenfold, which greatly improved flight response. The Pico handled PID (Proportional-Integral-Derivative) calculations for stability, and a 4-in-1 ESC managed the motor signals. The drone also carries a Raspberry Pi Zero with a Camera Module 2 and an analogue VTX for real-time FPV (first-person view) flying.
All coming together in the Maker Lab at Pi Towers
Programming was based on Tim Hanewich’s Scout flight controller code, implementing a ‘rate’ mode controller that uses PID values to maintain desired angular velocities. Fine-tuning the PID gains was essential; improper settings could lead to instability and dangerous oscillations. I followed a careful tuning process, starting with low values for each parameter and slowly increasing them.
To make the process safer, I constructed a testing rig to isolate each axis and simulate flight conditions. This allowed me to achieve a rough tune before moving on to actual flight tests, ultimately ensuring the drone’s safe and stable performance.
The Hazard 3 RISC-V cores on the RP2350 were designed by Raspberry Pi’s own Luke Wren in his spare time – and as they’re open source, you can download the design files yourself and start poking around in the very same chip that will eventually be in use on millions of units out in the wild. As Eben Upton puts it: “In adding Hazard3 to RP2350, we’re aiming to give software developers a chance to experiment with the RISC-V architecture in a stable, well-supported environment, and to popularise Hazard3 as a clean, open core, suitable for verbatim use in other devices, or as a basis for further development.” Luke’s reflections first appeared in issue 145 of The MagPi.
I’ve been doing logic design in my spare time since I was a student. It’s highly addictive, and I think it’s more accurate to say I’m a hobbyist who works in chip design than a chip designer with a hobby! It’s an open-source processor design that anyone can put in their chip and use to run RISC-V code anywhere. You can also run it on an FPGA board, or run the simulator on your own machine. It’s all built using open-source tools like yosys, nextpnr and gtkwave.
The best way to get started is to get an FPGA board and just get hacking. Writing RTL [register transfer level] is a bit mind-bending at first — you can think of it like a C program where all of the statements execute at once, rather than sequentially — but that kick of seeing your own hardware come to life keeps you going. Start by blinking an LED, and keep going.
Hazard3 is 100% my own design. It’s a fork of Hazard5, the processor I designed for RISCBoy, my open-source competitor to the Game Boy Advance. Hazard5 is a five-stage pipeline — therefore having many hazards: data flow, control flow and structural — and a hazard is also a kind of ‘risk’, like the instruction set.
Hazard5 was meant to run at the highest possible frequency on an iCE40 FPGA, so I could run the RISCBoy graphics core at a higher frequency too. Hazard3 on the other hand is a production-grade processor which delivers as much performance as possible in its small area envelope and within the range of frequencies I expect to see on microcontroller designs. It’s a productionised version of Hazard5 with a shorter pipeline, hardware debug, and some security and memory protection features that people expect in real systems.
From forking Hazard5 to having Hazard3 running CoreMark took less than a week. From that point until the first RP2350 tapeout was around two years, working on it on-and-off throughout. There is still ongoing maintenance work, and plans for future expansion — it will never be ‘finished’, just transition from development to stable releases.
Before I started working on RISCBoy I had a project called Tarantula which was an eight-thread barrel processor implementing the Armv6-M instruction set, because that was the ISA I was most familiar with at the time, having written some Assembly during a summer internship. I abandoned the project because I realised I would never be able to share it with anybody, and I don’t think I even have that source code any more.
That experience changed how I looked at things from that point forward. When I decided I wanted to build a games console from scratch, including the processor, I looked around the instruction sets available at this point, this was around 2018, and there were a few interesting ones — Hitachi SuperH had just become much less legally restrictive — but RISC-V stood out as an instruction set where I could implement it fairly easily.
The base instruction set is quite clean and simple, and you can add more complexity from a menu of extensions. I could share that with other people, and they could actually use it, and I could program using a real production-grade compiler like GCC or LLVM.
That was a long time ago, and RISC-V has come a long way since, both technically and as a community. There are other instruction sets that have become more open in the wake of RISC-V but I think it’s clear where the momentum is. It’s easy to criticise some of the technical decisions made in the base ISA — did we really need 31 link registers? — but the community is the most important thing in my eyes.
I am excited about RISC-V because it lets you perform your mad-scientist architecture experiments on top of a clean and standard architecture. If you look at something like CHERI, which is a super-exciting development in the embedded security space, those folks have just gone and written a spec, and you can just go and implement it — no need to wait for it to be served on a plate.
A few months back, we quietly dropped the Pico VS Code project on GitHub. It didn’t take long before the feedback started pouring in. Since then, we’ve been listening and tweaking. Now, we’re excited to officially unveil the public beta of the Raspberry Pi Pico Visual Studio Code Extension!
What is Pico VS Code?
Pico VS Code is a Microsoft Visual Studio Code extension designed to make your life easier when creating, developing, and debugging projects for Raspberry Pi Pico-series boards. Whether you’re a total beginner or a seasoned pro, this tool is here to help you dive into Pico development with confidence and ease.
If you’ve ever tried to set up an embedded development environment, you know it’s no small feat. Beginners often find themselves tangled up in the complexities of build systems, SDKs, and toolchains. And let’s not even get started on cross-compilation; developing on one machine to run code on another introduces a whole new set of challenges.
Getting all the right configurations and installations in place can be intimidating for everyone, not just those new to the game. Even experienced developers can find themselves tangled in frustrating setup processes that eat into valuable development time.
That’s why we created the Pico Visual Studio Code extension: a user-friendly tool that simplifies the entire development process. We wanted to offer something that takes the guesswork out of setting up your environment, so you can start coding in an interface you’re already familiar with — Visual Studio Code — as quickly as possible.
With Pico VS Code, you won’t have to worry about nitty-gritty details that trip up newcomers and sometimes stymie veterans. Instead, you’ll be able to focus on what really matters: bringing your Raspberry Pi Pico projects to life. Whether you’re working on your first blinking LED or a more complex project, Pico VSCode is there to help you get started and keep you moving forward.
How do I get Pico VS Code?
Prerequisites
To get started with the Pico VS Code extension, you’ll need to ensure that your development environment meets a few basic requirements. The extension is compatible with various platforms, including Raspberry Pi OS, Windows, macOS, and Linux, each with its own set of prerequisites.
All platforms require an install of Visual Studio Code version 1.92.1 or newer. For detailed instructions on setting up Pico VS Code on your platform, refer to the respective prerequisites outlined below.
Raspberry Pi OS
Ensure you are running a 64-bit distribution of Raspberry Pi OS.
Windows
Make sure you’re using a x86-based PC (not ARM64).
macOS
For macOS users, you can install all necessary dependencies by running the following command in your terminal:
xcode-select --install
Linux
Refer to the README.md on our GitHub page for a full list of required software. Many distros include the required software in the standard OS install.
Installing the Pico VS Code extension
You can install the extension in two ways. The first option is to install it directly from your editor’s marketplace. This provides a seamless integration and automatic updates. The second option is to download and manually install the package. This gives you more control and is helpful in restricted environments or when managing specific versions.
To create a project based on a blink example, select “New Project From Example” in the Pico sidebar panel added by the extension. Then, search for the example you want to use — in our case, “blink” — in the project name field. Click the “Create” button to generate a project from the template.
The blink example generated by pico-vscode
Once the project is generated, it will automatically open. When a Pico project is opened, the extension configures the build system for you based on the SDK version, board type, and other settings you’ve selected. After the progress bar disappears, you can compile the project by clicking the “Compile” button in the bottom right corner. This will open an output panel where you can follow the build progress. Once completed, you should see a line like this: [61/61] Linking CXX executable blink.elf.
When it comes to uploading firmware to your Raspberry Pi Pico board, you have two options. Both require you to connect your Pico in BOOTSEL mode. To put your Pico into BOOTSEL mode, connect your Pico board to your host computer while holding the BOOTSEL button.
The easiest way to get your firmware up and running is the “Run” button. Connect your Pico board in BOOTSEL mode, hit the “Run” button, and the firmware will upload automatically. You’ll know it’s working when the tiny LED near the USB connector starts blinking as the board disconnects itself.
In addition to the blink.elf executable, you’ll find a blink.uf2 file in the build directory within your project. If you prefer to manually flash firmware, drag and drop this UF2 file onto your Pico board in BOOTSEL mode.1 Once the file has been copied onto the board, it will automatically dismount and start running the blink project. You can confirm this by observing the tiny LED near the USB connector. It should start blinking as soon as the board disconnects itself.
For debugging directly within VS Code, the extension adds configuration to your project that allow you to use the debug panel and set breakpoints, just as you would when debugging other C/C++ projects on your computer. To run in debug mode with a Debug Probe, press F5. For detailed instructions on how to correctly wire your board for debugging, refer to the Getting Started guide on our website.2
Integrated offline documentation
When developing bare-metal code for the Pico, you often need to reference an API or check hardware specifications. To streamline your workflow, we’ve integrated the documentation directly into VS Code. This allows you to quickly access the information you need without leaving your editor — or requiring an internet connection.
A VS Code window showcasing a Pico project on the left with the offline documentation open to the right
To access the documentation, navigate to the Raspberry Pi Pico panel in your sidebar and select the topic you want to explore. The documentation will open within the editor, so you can position it wherever you need, just like any other file. This way, you can keep your code and reference materials side by side.
How to update the project configuration
A new SDK revision has been released, and you want to take advantage of its awesome new features in your Pico project. No problem — the extension has you covered. If you need to switch the target board, change the selected SDK, or adjust any other properties configured during project creation, the extension provides commands to update your project settings in just a few clicks.
For example, to switch the SDK version, you’ll find a UI element in the status bar at the bottom of the VS Code window, or in the Raspberry Pi Pico Project quick access panel in your sidebar, displaying your currently selected version. Clicking this will open a simple dialog where you can choose the new SDK version you want to use. Once selected, the extension will automatically reconfigure your project to use the new version. For optimal IntelliSense functionality, we recommended to reload your window after changing any project settings to ensure all extensions are aware of the new configuration. After the changes have been applied, the extension sends you a notification with a button that will reload the current window.
If you need to update settings other than the SDK version or board type, you can access additional commands via the VS Code command palette, which you can open with the keyboard shortcut Ctrl+Shift+P (or Cmd+Shift+P on macOS). Type “Raspberry Pi Pico,” and you’ll see a list of all available commands provided by the Pico extension. This makes it easy to adjust your project configuration as needed.
It also supports MicroPython
For beginners or developers who want to get their projects up and running on a Pico as quickly as possible, MicroPython is an excellent choice.3 It is a lean and efficient implementation of the Python 3 programming language, specifically designed to run on microcontrollers and in constrained environments. It includes a small subset of the Python standard library, making it a powerful yet lightweight option for embedded development.4
To create a Pico project using MicroPython instead of C/C++, select “New MicroPython Project”. You can find this button either in our Quick Access panel, located in your sidebar or by running the New Pico Project command and selecting MicroPython as language. This will launch the familiar project creation wizard, now tailored for setting up a MicroPython project. Choose the location for your project folder and set a name for your project. When you click “Create,” the extension generates the new project and opens it for you, just like with a C/C++ project. But instead of using C/C++, your new project uses the MicroPico extension to run your code on the board and manage project configurations.
A newly create MicroPython based MicroPico projectRaspberry Pi Pico W running the blink.py script in MicroPython
With MicroPython, you can quickly start prototyping and experimenting with your Raspberry Pi Pico-series device, making it an ideal option for both newcomers and seasoned developers alike.
Next steps
For more detailed information on using the Pico VS Code extension, including a comprehensive list of settings and additional guidance, visit our GitHub project page. It’s a great resource for getting the most out of the extension.
If you’re new to developing Pico projects, don’t forget to check out the Getting Started guide we mentioned earlier—it’s packed with helpful tips to get you up and running.
If you’re looking to create a project that leverages the advanced features of Pico-series devices — such as I2C, PIO, or enabling stdio support—be sure to explore the “New C/C++ Project” interface. This tool allows you to customize your project setup to suit your needs, so you can dive into development quickly and efficiently.