Setup Coral TPU USB Accelerator on Raspberry Pi 5

Setting up the Coral TPU USB Accelerator on the Raspberry Pi 5 comes with challenges since the Raspberry Pi 5 comes with the latest Operating System, which currently is Pi OS 12 (Bookworm), and Coral’s PyCoral library only runs on Python 3.9. So, then your options are:
* Run inside Docker with an earlier version of Debian that allows running Python 3.9.
* Or simply install an older Raspberry Pi Operating system in your Pi.

You might not want to change the default for your whole operating system, so running in Docker allows you to keep the latest OS on your Pi while still being able to make use of your Coral USB Accelerator.

Install Docker on Raspberry Pi 5

Open the terminal and enter the following to setup the Docker’s apt repository:

Then enter the following:

Then, Install the Docker packages:

Verify that the installation is successful by running the hello-world image:

Successful installation will result in the following output:

Install the Edge TPU Runtime

Add the Debian package repository to your Raspberry Pi 5 – Enter the following in the Terminal:

Install the Edge TPU runtime:

Now connect the USB Accelerator to your computer using the provided USB 3.0 cable. If you already plugged it in, remove it and replug it so the newly-installed udev rule can take effect.

Then, Reboot the Raspberry Pi 5

Confirm Parameters from USB device being detected

Open the terminal and check for the USB devices that are connected as follows:

The output will show the following:


The output we want to see will show the ID as “18d1 : 9302” and will be associated with “google Inc.”. To get this, we’ll have to try to run an example at least once, and then check again, so let’s continue. The desired output is as shown below:

Create and Build Docker File

In the Raspberry Pi 5, created Folder as /home/pi/Docker/customimgs/Deb10

Then, create a file with name “Dockerfile” with the following contents:

Next follow these steps:

Go back to Terminal, and go to directory in which Docker File was saved, the run the command to build the Docker image:

Run Example in Docker

Run the following in the Terminal:

Then, while inside the Docker container with the newly created image:

At first, the output will most likely be an error such as this: RuntimeError: Error in device opening (/sys/bus/usb/devices/4-1)!

So, next, exit out of the container by pressing Ctrl + D, then re-run lsusb in the terminal, and you should now see the desired USB device (as previously mentioned):

So, then you need to re-run the example as follows:

Then, while inside the Docker container with the newly created image:

You will then get the desired output!

Leave a Reply

Your email address will not be published. Required fields are marked *