When it comes to Raspberry Pi support, the theme of Ubuntu 22.10 is definitely embedded devices.
In this release, Ubuntu now supports a range of embedded display HATs as well as under-the-hood improvements to the GPIO stack as we transition from RPI.GPIO to lgpio (more about that later).
In addition we’ve worked hard to support the Raspberry Pi’s even smaller cousin, the Raspberry Pi Pico W with the full MicroPython stack now available in the Ubuntu repositories.
We’ll run through these highlights and more in the rest of this post, but as usual Dave ‘Waveform’ Jones, our resident Raspberry Pi engineer at Canonical, has put together a suite of detailed blog posts to provide additional backstory to each feature. Check them out as we go through.
Get hyped for Hyperpixels
Behind the scenes, the graphics stack for the Raspberry Pi has undergone a significant transition, moving from fake KMS (or fkms) which involved closed-source firmware running on the GPU separately from the Linux kernel, to the open-source ‘full’ KMS (or, confusingly, just kms) which puts the Linux kernel directly in charge.
This migration has made supporting display HATs easier since Ubuntu can now treat them as a standard display with only minor tweaks.
Whilst it’s not the ideal way to experience Ubuntu Desktop, it’s certainly a novelty to see it running on such a small screen, with touch support. Remember to bring your reading glasses!
For more serious embedded application work, try Kivy, a python based framework for touchscreen interfaces, available in the Ubuntu archive. Or Qt, a popular framework used in Kubuntu which is able to run outside of a full windowing environment without the need for Pi-specific drivers, making it lightweight, performant and portable.
For more information on these demo projects check out Hyping Pixels on Dave’s blog.
MicroPython for Microcontrollers
If you’re struggling to get your hands on a Raspberry Pi, now might be a good time to start experimenting with the Raspberry Pi Pico W. It’s smaller, cheaper and uses less power than a Raspberry Pi Zero 2 W. For industrial and IoT use cases, porting processes over to the Pico could deliver a significant advantage.
As a microcontroller, the Pico isn’t powerful enough to run a full operating system, but with languages like MicroPython you can run Python code directly on the hardware
For Ubuntu 22.10 we’ve included the full MicroPython developer stack in the Ubuntu repositories, enabling you to
apt-install all the development tools you need to get started with Microcontroller development. This includes rshell and mpremote for remote development and Thonny, a mini Python IDE for beginners.
Again, Dave’s blog has everything you need to get started.
Preparing for the future: transitioning the GPIO interface
This release we’ve also made a big change behind the scenes to move Ubuntu from relying on the now deprecated sysfs-gpio to an lgpio solution. Similar to the fkms to kms transition (do you remember which is which?) lgpio gives the kernel control of the GPIO pins rather than letting libraries interact with them directly.
In the long term, this is a significant improvement in both security and application management as it prevents two applications from trying to access the same pins simultaneously. In the short term, many key libraries that Raspberry Pi HATs rely on, such as RPi.GPIO, assume the use of sysfs-gpio.
To ensure there is no interruption in support for existing HATs, Ubuntu 22.10 now ships with a compatibility shim, the creatively named RPi.LGPIO. This allows us to boldly move forward with lgpio without fear of breakages!
To enable the shim, run:
apt install python3-rpi-lgpio
This will remove the existing
python3-rpi.gpio and run in its place for packages that depend on this library
The history of this migration is so long that Dave has written not one, but two blogs about the origins of this change and his journey to achieve this migration:
That’s all folks!
We hope you enjoy all of the new tools available for IoT developers available in this latest release of Ubuntu and look forward to seeing the creative projects and applications that these enable
Share your work in the Raspberry Pi discourse channel or check out some of our past blogs and tutorials for more inspiration on how to get started with the Raspberry Pi.
- Install Ubuntu Desktop on a Raspberry Pi 4
- How to install Ubuntu Server on your Raspberry Pi
- Install Ubuntu Core on a Raspberry Pi
- Raspberry Pi HAT tutorials part 1
- Raspberry Pi HAT tutorials part 2
- Host a Minecraft server on Ubuntu Desktop using the Raspberry Pi
- Run Flutter Applications on Ubuntu Core
- Build your own bare metal cloud using a Raspberry Pi cluster with MAAS
- How to build a Raspberry Pi Kubernetes cluster using MicroK8s
- Hosting a Tor Snowflake proxy on a Raspberry Pi