Skip to main content

PI Ada Tutorial

You have been away for a while working for the paying customers. Anyway I have prepared the draft for the debug side quest. That was quite a lot and needs checking for spelling, wording etc. Since it’s very technical improving wording is indeed important and some code and json samples need more detailed explanation for the reader. I hope you are not to tired from the paying customers.

The Instagram links are only placeholder. I have prepared two videos which I still have to upload.

My Journey: Bringing Freenove Experiments to Ada on the Raspberry Pi Pico #

I have always been drawn to Ada because of its focus on safety, reliability and catching mistakes early. So I thought — why not take the brilliant Freenove Ultimate Starter Kit for Raspberry Pi Pico and rewrite every single experiment in Ada instead of the usual Python or C?

The kit is fantastic value: you get 220+ components and 119 guided projects covering GPIO, sensors, displays, motors, keypads — just about everything you need to really understand the Pico. You can still pick it up for under $50 from places like AliExpress.

I’m working through the lessons one by one, writing clean, idiomatic Ada code (and using Ravenscar where real-time behaviour matters). Along the way I share build notes, little ZShell helpers for flashing, things that tripped me up, and the occasional extra experiment that felt fun or useful.

If you want to follow along — or just borrow bits for your own projects — everything lives in the Pi Ada Tutorial repository.

How the Project is Organised #

I follow the structure of the official Freenove C tutorial quite closely so you can easily compare the two languages.

Each chapter gets its own Alire crate. The name usually starts with the chapter number followed by a short description — for example:

  • pico_ada_c01_led → Chapter 1 experiments with LEDs
  • pico_ada_c05_button → Chapter 5 button & debounce work

Some chapters in the original kit contain several small programs (e.g. Chapter 1 has both the internal Pico LED and an external LED). In those cases I usually create multiple executables inside the same crate.

Occasionally I also borrow well-known working examples from Ada on the Raspberry Pi Pico — the very first “Blink” program from Jeremy Grosser was my sanity check before I started changing things. And sometimes I add my own variations, especially when I want to try Ravenscar tasks for proper real-time blinking or timed sequences.

My Development Directory Setup #

One thing that makes my life much easier is git worktrees — I wish I had discovered them years ago!

I keep the main clone in a folder called develop:

Pi-Ada-Tutorial/
└── develop/		   ← git clone here (my active development branch)

From there I create extra worktrees whenever I need them:

Pi-Ada-Tutorial/
├── develop/		   ← main working copy
├── release/		   ← worktree for polished, stable versions
└── feature-ravenscar-led/ ← worktree for experimenting with Ravenscar

This way I can switch contexts very quickly without constantly stashing or switching branches.

For quick reference I also cloned two very helpful external repositories inside the same parent folder:

  • Freenove_Ultimate_Starter_Kit_for_Raspberry_Pi_Pico/ → the official C/MicroPython code
  • pico_examples/ → Jeremy Grosser’s Ada examples

Having them side-by-side means I can glance at the original C or a known-good Ada version while I’m writing.

Chapters #

These are the hands-on Ada ports of the Freenove experiments I’ve completed so far. I’m calling the core tutorial sequence the Main Quest — the straight path through the kit’s lessons, rewritten in Ada with my notes and improvements.

Main Quest – Core Freenove Experiments in Ada #

Link What it covers
Chapter 1 — Blinking LEDs Getting started with Ada on the Raspberry Pi Pico
Chapter 1 — Reloaded Dual-core light tasking – blinking LEDs on both cores
Chapter 2 — Button & LED From basic on/off control to a toggle-style table lamp
Chapter 3 — “Cylon” LED Bar Building a smooth flowing LED bar including a proper menacing Cylon scanner
Chapter 4 — Analog & PWM Building smooth breathing LEDs and flowing light bars with hardware PWM
Chapter 5 — RGBLED Controlling an RGB LED with PWM
Chapter 6 — NeoPixel Controlling NeoPixel with PIO and DMA

Side Quests – Handy Hardware & Setup Tips #

The Side Quests are the little detours and hardware/setup improvements that made my life easier (or saved me from losing buttons in the grass). They’re not tied to a specific Freenove chapter but are very useful in practice.

Link What it’s about
Configuring Passwordless sudo Configuring password less sudo for picotool (…and why I gave up on macOS)
Hardware Reset Button Adding a hardware reset button – goodbye USB plug wrestling
Breadboards Not all breadboards are the same — upgrading to proper ones
Breadboards Arrived The BusBoard BB1660T breadboards finally landed
Raspberry Pi Pico 2 W How-To use the Raspberry Pi Pico 2 W instead of the Raspberry Pi Pico
Floating point arithmetic Floating point for the Raspberry Pi Pico now fixed.
Debugging with Rasberry Pi Pico Probe Setting up a reliable debug environment for the Raspberry Pi Pico and Pico 2 with Ada.

Useful Resources #

Here are the sites I keep open almost all the time:

Link What it’s for
Pi Ada Tutorial Project Home of the whole project
Repository (develop branch) Current code & history
Ada on the Raspberry Pi Pico Excellent Ada-specific Pico documentation
Jeremy Grosser pico_examples High-quality Ada Pico examples
Freenove Pico Kit main page Kit overview & purchase links
Freenove C Tutorial The original experiments I’m porting
Freenove GitHub repo Original kit code
Ada Lang Rraspberry Pi Pico Gitter Forum about Embedded Ada programming
GNATdoc Rasberry Pi Pico Automatically generated HTML documentation for the Ada code for the Raspberry Pi Pico
GNATdoc Rasberry Pi Pico 2 Automatically generated HTML documentation for the Ada code for the Raspberry Pi Pico 2
Develop and Debug Raspberry Pi Pico on macOS Big Sur Debug set-up without with two Raspberry Pi Pico 1 instead of a Raspberry Pi Pico Probe.

That’s the current lay of the land. Next posts will dive into individual chapters with code, photos of the breadboard, and notes on what surprised me when moving from C to Ada.

Happy hacking — and do get in touch if you spot anything confusing or have suggestions!

2026


Chapter 6: NeoPixel

From understanding the WS2812 protocol to writing our own PIO code and creating colourful animations – everything you need to make NeoPixels dance with Ada on the Pico.

Side Quest: Debugger

From UART logging and OpenOCD to GDB scripts and Visual Studio Code — everything I needed (and the battles I fought) to make debugging work on macOS.

Chapter 5: Controlling an RGB LED with PWM

Extend the simple LED examples to full-colour control with an RGB LED. Create a reusable Pico.Analog.RGB_LED package and explore two sketches: random colours (using the embedded runtime) and a smooth colour-wheel transition.

Chapter 4 – Analog & PWM

In this chapter we create a reusable Pico.Analog package for PWM-based analogue output. We start with a classic breathing light, then move on to a flowing light bar. Along the way the MSO-5102B reveals the real behaviour of our code, and we discover (and fix) a subtle bug in the experimental RP2350 HAL.

Side Quest: Raspberry Pi Pico 2 W

How to adapt the existing Ada projects for the newer Raspberry Pi Pico 2 W — a quick side quest with all the necessary changes explained

Side Quest Update: The Breadboards Have Arrived!

·
Unboxing the new transparent BusBoard BB830T, side-by-side comparison with the Freenove board, a quick nerd-out on fingertip sensitivity, and how I prepared identical setups for both my Raspberry Pi Pico and Pico 2W. Plus a note on why Ada support for the Pico 2W is still a bit flaky.

Chapter 3 - Cylon LED Bar: flowing light upgraded to a menacing scanner

·
In this chapter we turn ten LEDs into a flowing light bar. We start with the basic Freenove example, then improve it with a sine-harmonic timing table to create a realistic Cylon scanner effect. All code is written in Ada and runs on the RP2040 without floating-point at runtime.

Chapter 2 – Button & LED

·
In this chapter I combine a push button with an LED. We start with basic on/off control, then move to a toggle-style table lamp with software debounce.