These steps describe using an Ubuntu desktop environment to install Ubuntu
and the Spinnaker Python interface on a Raspberry Pi 3 B+. Commands to be run
on the desktop are prefaced with (desktop)$
, and commands to be run on the
Raspberry Pi are prefaced with (pi)$
-
Flash the latest Ubuntu image (at the time of writing: 18.04) to an SD card and perform first-time setup by following these instructions. You will need an HDMI cable, a monitor, and a keyboard. The Raspberry Pi must also be connected to your local network via Ethernet.
-
Perform basic software updates on the Pi:
(pi)$ sudo apt update && sudo apt upgrade
-
Go to the FLIR File Download website for your camera. The software downloads will require a free FLIR account.
-
On the FLIR website, find the latest Linux Ubuntu ARM Operating System packages.
-
Download the ARM64 packages for the Spinnaker SDK and Spinnaker Python Interface, and transfer them to the Raspberry Pi. Eg:
(pi)$ ip a # check pi's ip address (desktop)$ scp spinnaker-*-pkg.tar.gz spinnaker_python-*.tar \ ubuntu@<pi's ip address>:~
-
On the Raspberry Pi, untar the spinnaker sdk and enter the untarred directory
(pi)$ tar -xf spinnaker-1.*-pkg.tar.gz (pi)$ cd spinnaker-1.*
-
Read the README file fully, then run the install script. Eg:
(pi)$ sudo sh install_spinnaker_arm.sh
-
You will probably run into some dependency issues while installing the SDK. If that’s the case, missing packages can be installed manually with:
(pi)$ sudo apt install <name-of-missing-package>
-
Change back to your home directory, untar the python interface, then untar the python 3.6 interface.
(pi)$ tar -xf spinnaker_python-1.*.tar (pi)$ tar -xf spinnaker_python-1.*cp36*.tar.gz
-
Read the README.txt fully, then install numpy and the Spinnaker python interface. At the time of writing, there are no precompiled wheels for numpy on Ubuntu ARM, so pip will compile the package from souce. This will take several hours, but can be sped up a bit by increasing the Pi's swap size.
(pi)$ sudo apt install dphys-swapfile # (optional) # follow the rest of the increasing swap size tutorial (optional) (pi)$ sudo apt install python3-pip (pi)$ python3 -m pip install numpy (pi)$ sudo python3 -m pip install spinnaker_python-1.*.whl
-
Ensure the python module can be imported successfully:
(pi)$ python3 -c 'import PySpin' # should take a few seconds, then exit silently
You will probably run into more dependency issues here. When you try to import PySpin with
a missing dependency, you'll get an error along the lines of No Such File: <name-of-missing-package>.so
.
See step 8 for help resolving these issues.
-
Increase the space allocated to USB devices on the Pi. This is needed so that the images taken by the camera can fit properly within RAM. Note: This change will not persist through reboot and must be repeated.
(pi)$ sudo sh -c 'echo 256 > /sys/module/usbcore/parameters/usbfs_memory_mb'
-
Connect your USB 3.1 FLIR camera to the Raspberry Pi via USB.
-
Change into the Examples directory for PySpin, and run the Acquisition.py example as root. If this succeeds, the camera will take 10 pictures and store them as JPEGs in the current directory.
(pi)$ cd Examples/Python3 (pi)$ sudo python3 Acquisition.py
Hi,
I tried this out on a raspberry pi 4 running the ARM version of Ubuntu 20.04.1. When I ran the Acquisition.py code, I get the following output:
Library version: 2.2.0.48
Number of cameras detected: 1
Running example for camera 0...
*** DEVICE INFORMATION ***
DeviceID: USB\VID_1E10&SRL_00F89135&2&2&1
DeviceSerialNumber: 16290101
DeviceVendorName: Point Grey Research
DeviceModelName: Blackfly S BFS-U3-13Y3M
DeviceType: USB3Vision
DeviceDisplayName: Point Grey Research
DeviceAccessStatus: OpenReadWrite
DeviceVersion: 1603.2.6.0
DeviceDriverVersion: none : 0.0.0.0
DeviceUserID:
DeviceIsUpdater: 0
DeviceInstanceId: USB\VID_1E10&SRL_00F89135&2&2&1
DeviceLocation:
DeviceCurrentSpeed: SuperSpeed
GUIXMLLocation: Device
GUIXMLPath: Input.xml
GenICamXMLLocation: Device
GenICamXMLPath:
DeviceU3VProtocol: 1
*** IMAGE ACQUISITION ***
Acquisition mode set to continuous...
Acquiring images...
Device serial number retrieved as 16290101...
Error: Spinnaker: Failed waiting for EventData on NEW_BUFFER_DATA event. [-1011]
Error: Spinnaker: Can't de-initialize camera. Camera is still streaming. [-1004]
Camera 0 example complete...
From the bit of searching I've done on this, it sounds like the pi power supply through the USB may be an issue. Have you encountered this in your setup?
Thanks