Howto access p-top display & buttons

I am working on a project that has already been developed on the Raspberry Pi OS, latest version. I only recently discovered Pi-top, and I love the hardware, all except it being proprietary.

I would love to be able to access the buttons and the display using python3 if possible. If not I’ll sadly have to limit how much I promote pi-top for the contest I’m putting together.

I’m all about FOSS and inspiring people to build through sharing, one of the primary aspects of the forthcoming contest. I’ve already announced the top prize, which is a pi-top Raspberry Pi 4 w/8GB RAM, so pi-top will at least get that much exposure.

I’m just here looking for technical details I can use to build an even better 1st prize by programming some cool things that use the display & buttons.

Any help, guidance or suggestions anyone is willing to reply with would be greatly appreciated.

Welcome to the forums Arman

Everything that works on Raspberry Pi OS works on pi-topOS as it is built on Raspberry Pi OS with all the software and the SDK pre-installed.

as for FOSS, you can check out pi-tops GitHub too which has a lot of stuff for you to look though

It is possible to use the pi-top[4] hardware on Raspberry Pi OS which requires you to install a couple things, and at this time can only run on 32bit

Firstly you need to install openCV, in terminal enter the following command

  • sudo python3 -m pip install opencv-python

If installing the SDK on Raspberry Pi OS Lite you need additional packages to openCV which was discovered by myself just recently

sudo apt install -y libopenjp2-7 libilmbase-dev libopenexr-dev libgstreamer1.0-dev libavcodec-dev libavformat-dev libswscale-dev

Next you need to install the SDK

The rest of the information can be found here

Step 1: Adding the pi-topOS software repository
First, you need to tell your pi-top how to install software from pi-top.
Open up a terminal window in Raspberry Pi OS, and type the following into a terminal:

echo "deb sirius main contrib non-free" | sudo tee /etc/apt/sources.list.d/pi-top.list &> /dev/null
curl | sudo apt-key add

This will provide your Raspberry Pi with information about pi-top’s software server, including the security key.

Step 2: Update package list
Now you will need to refresh your Raspberry Pi’s local copy of what software is available from the servers that it knows about.

Type the following into a terminal:

sudo apt update

You are now able to install pi-top software packages!

Step 3: Install software packages
Type the following into a terminal:

sudo apt install --no-install-recommends -y pt-device-manager pt-sys-oled pt-firmware-updater

Assuming that you got no errors - you should now have the core pi-top device drivers working!

To help you with the programming using the SDK you can find this helpful

Lastly, there is an educational tool called Further that can also help you out too. The feature on further, Further link does not work on Raspberry Pi OS at this time i have found.

Hope this helps, happy coding :slight_smile:


An absolutely awesome and complete answer, thank you sir!

The only reservation may be the 32 bit limitation you mentioned. I’ll look over the git repo and see what we can use. Greatly appreciate your thorough reply.

Have a great day!

there will be 64bit support when Raspberry Pi 64bit is officially released out of beta

I am actually working on a script to automate everything to install the SDK depending on the version of Raspberry Pi OS and just testing it on the different versions before making a post about it

@CAProjects thanks for the detailed explanation!

@Armando do you have more details of the competition you are running? Sounds fun!

Most of the software that runs on pi-top [4] is open-source, you can check our GitHub. The reason not all of our repos are public isn’t that we want to hide anything (most is in Python and readable on the OS anyway!), we just want to ensure that they are clearly documented and structured properly so that they are actually useful to people before making them public. This takes some time but over 2021 we have been actively pursuing this and have made excellent progress - it sounds like everything you need is already public and very well documented anyway :+1:

Finally, all hardware to some extent is “proprietary” (even elements of the Raspberry Pi itself), but we’re generally very open about discussing and documenting any details that are important to users being able to do what they want with it - just let us know if you need any support!

@CAProjects How’s the progress? A year ago I bought a pi-top4 diy for my Pi 4 (8GB). Unfortunately for the Debian system (64bit) there are no display or battery control packages available. Will it be available? Wait patiently or look for another solution?
Best wishes!

All packages are built from GitHub (e.g. pi-topd, python3-pitop, etc.)

At some point in the future, we aim to do arm64 builds of all of our packages that require compilation, but all other packages can be theoretically installed onto any system and should work the same.

The only issue that you may run into is that the packages may require some dependencies that are currently not packaged for arm64 (e.g. our upstream Debian package builds from PyPI).

So, that is to say:

  • it can be done
  • it requires some effort
  • we are not prioritising it at this time

Hope this helps!

1 Like