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:
|
1 2 3 4 5 |
sudo apt-get update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc |
Then enter the following:
|
1 2 3 4 5 |
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update |
Then, Install the Docker packages:
|
1 |
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
Verify that the installation is successful by running the hello-world image:
|
1 |
sudo docker run hello-world |
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:
|
1 2 3 4 5 |
echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - sudo apt-get update |
Install the Edge TPU runtime:
|
1 |
sudo apt-get install libedgetpu1-std |
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:
|
1 |
lsusb |
The output will show the following:

Note that THIS IS NOT WHAT WE WANT TO SEE!
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:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
FROM debian:10 WORKDIR /home ENV HOME /home RUN cd ~ RUN apt-get update RUN apt-get install -y git nano python3-pip python-dev pkg-config wget usbutils curl RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" \ | tee /etc/apt/sources.list.d/coral-edgetpu.list RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - RUN apt-get update RUN apt-get install -y edgetpu-examples RUN apt-get install -y udev RUN apt-get install -y sudo RUN echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", ATTR{idProduct}=="9302", MODE="0666"' > /etc/udev/rules.d/CORALUSB |
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:
|
1 2 |
cd Docker/customimgs/Deb10 sudo docker build -t "coral" . |

Run Example in Docker
Run the following in the Terminal:
|
1 |
sudo docker run -it --device /dev/bus/usb:/dev/bus/usb coral /bin/bash |
Then, while inside the Docker container with the newly created image:
|
1 2 3 4 |
python3 /usr/share/edgetpu/examples/classify_image.py --model /usr/share/edgetpu/examples/models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --label /usr/share/edgetpu/examples/models/inat_bird_labels.txt --image /usr/share/edgetpu/examples/images/bird.bmp |
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:
|
1 |
sudo docker run -it --device /dev/bus/usb:/dev/bus/usb coral /bin/bash |
Then, while inside the Docker container with the newly created image:
|
1 |
python3 /usr/share/edgetpu/examples/classify_image.py --model /usr/share/edgetpu/examples/models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --label /usr/share/edgetpu/examples/models/inat_bird_labels.txt --image /usr/share/edgetpu/examples/images/bird.bmp |
You will then get the desired output!

Components used in this example
*As an Amazon & Ebay Associate I earn from qualifying purchases.
| Component | Link |
| Coral USB Accelerator | https://amzn.to/3WONMhW |
| Raspberry Pi 5 Starter Kit | https://amzn.to/3w0zdg8 |
