Your submission was sent successfully! Close

You have successfully unsubscribed! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates about Ubuntu and upcoming events where you can meet our team.Close

How to use the Raspberry Pi High Quality camera on Ubuntu Core

This article was last updated 3 years ago.


The new High Quality (HQ) camera from the people over at Raspberry Pi is now available. And as they say, it is really rather good. It has the option for interchangeable lenses, a 12 MP sensor, a distinct improvement from the previous 8MP V2 camera, and a tripod screw mount. In this post, I’ll walk you through the steps to stream video on Ubuntu Core and how to properly focus the camera for different lenses with and without the C mount.

What you will need

If you plan on following along with this guide, this is the list of things you will need:

  • A microSD card (4GB minimum, 8GB recommended)
  • A computer with a microSD card drive
  • A Raspberry Pi 2, 3 or 4
  • A micro-USB power cable (USB-C for the Pi 4)
  • A Wi-Fi network or an ethernet cable with an internet connection
  • A monitor with an HDMI interface
  • An HDMI cable for the Pi 2 & 3 and a micro HDMI cable for the Pi 4
  • A USB keyboard
  • The new HQ Raspberry Pi Camera
  • C and or CS-mount compatible lenses. 
These things, among others

Setting up Ubuntu Core with the HQ Camera

First, to get going with Ubuntu we’re going to need to install and set up Ubuntu Core on the Raspberry Pi. The best way to do this is to open the tutorial in a new tab, follow along to where you can SSH into the Pi, and come back when you’re done.

Once you’re in, we need to enable the camera for the board. This is a little hacky at the moment as you need to go into the config file to do it, but don’t worry. It’s nice and easy and we are working on making this process much more seamless. More on that later. 

Enable the camera to work with Ubuntu Core

Access the uboot config file with this command:

sudo vi /boot/uboot/config.txt

Once the file is open, scroll down to the last line and then type the following commands:

‘a’ 

This will initiate insertion mode so you can add to the file. Next scroll to the bottom of the file and type:

start_x=1 

This is the line that enables the camera. That’s it. Now to save and exit the file hit ‘Esc’ escape on your keyboard to exit insertion mode and type

 ‘:x!’ 

to save and exit the file. To be clear: 

Next, we need to install picamera-demo-application. This is a snap in the snap store developed and maintained by Ogra, a Canonical engineer. To do this use the following command:

snap install picamera-streaming-demo

Connect the camera and connect to the web

Now we can wire the camera up to the Raspberry Pi. In this example, we use the Raspberry Pi 3 Model B. It is important to connect the camera in the right way, pay attention in the following image to the orientation of the ribbon cable. The blue side facing towards the USB ports.

To connect it in this way, pull the black tab gently upwards until you feel it click. Slot the ribbon, orientated as shown, into the space, and press the black tab back down to secure it.

For clarity, this is an example of how not to connect it (in the wrong port):


This would be foolish, that is not the CSI port for the camera. Always take pretty photos after you have set everything up and it’s working.

Once that’s connected, reboot the Raspberry Pi with:

sudo reboot

Wait a few moments and in your browser type:

http://<board IP address>:8000/

And you will be able to see what your camera sees in a web page like this:

This image was taken using the 6mm lens, with bad lighting and then saved using a screenshot tool so doesn’t show quite how quality these photos can be. 

Focusing with and without the C-mount

Being able to focus the camera, is of course, crucial. For a photography novice like me, it took a while to work out how to do it. The C-mount is a type of mount usually found on 16mm cameras. Of the two lenses I bought, one required the C-mount, the other a CS-mount. A CS-mount lens is designed to be mounted ~ 5mm closer to the image sensor than a C lens. It’s important to note this before playing around with the lenses and misplacing the C-mount bracket and wondering why your 16mm lens won’t focus for an hour or so.

C-mount bracket for focusing C-mount lenses

What’s next

We are working to do a lot more to improve the user experience of Ubuntu on Raspberry Pi. This tutorial was non-typical. Usually, tutorials live at ubuntu.com/tutorials, where you can find ‘how-tos’ on getting set up with Ubuntu Server, or other projects, like building a Raspberry Pi cluster using MicroK8s

This tutorial utilises Ubuntu Core, Ubuntu Core is not developer-friendly, we recommend its use for appliances, for fire-and-forget devices and for production. If you want to try other applications or build applications for the Raspberry Pi on Ubuntu we recommend you look into snaps and Ubuntu Server and take it from there. 


rapsberry pi logo

Ubuntu Desktop for Raspberry Pi

Watch the live event of the 20.10 launch the and find out all the news about the new Ubuntu Desktop image for Raspberry Pi.

Discover more ›

Newsletter signup

Get the latest Ubuntu news and updates in your inbox.

By submitting this form, I confirm that I have read and agree to Canonical's Privacy Policy.

Related posts

Canonical releases Landscape 24.04 LTS

Landscape 24.04 LTS is Landscape’s first LTS release, with a modernised backend, web portal, snap management, and repository management features.

Achieving Performant Single-Tenant Cloud Isolation with IBM Cloud Bare Metal Servers, Ubuntu Core, Snaps, and AMD Pensando Elba Data Processing Unit

Discover how IBM Cloud’s bare metal servers offer highly confined and high-performing single-tenant cloud isolation through the use of Ubuntu Core and Snaps,...

Canonical’s Ubuntu Core receives Microsoft Azure IoT Edge Tier 1 supported platform status

London, 20 March 2024. Canonical has announced that Ubuntu Core, its operating system optimised for the Internet of Things (IoT) and edge, has received...