This is a Python-based toolbox for high-speed video acquisition with FLIR/Blackfly USB3 cameras using the Spinnaker SDK (PySpin). It supports: Camera live display and aquisition with trigger and metadata information(DAQmx or arduino) A Python-based toolbox using FLIR/Blackfly camera, initially for neuroscience experiments
- ✅ Real-time video display and recording
- ✅ Timestamp logging for each frame
- ✅ Dual analog input support:
NI DAQmx(e.g. PCIe-6351)- OR Arduino-based serial decoding of trial/stimulus signals
- ✅ Auto-generated filenames and safe overwrite checks
- ✅ CSV metadata logging
- ✅ Optional split-recording (WIP)
| Mode | Input Device | Notes |
|---|---|---|
main (default) |
NI DAQ | Reads analog line continuously (e.g. voltage-encoded trial number) |
arduino-version |
Arduino | Reads decoded trial/stim values via serial from Arduino Mega 2560 |
| Source / Device | Destination | Notes |
|---|---|---|
| Vout (Adafruit MCP4725 DAC) | → Arduino A0 (analog input) |
Common GND between DAC and Arduino |
| TDT Start Signal | → Arduino digital pin 2 | Use a shared ground with the TDT system |
| Arduino → Camera Trigger | → Camera Line 3 (green wire on the Hirose 6-pin connector) | Connect Line 3 and Camera GND |
| Arduino USB (Serial) | → Acquisition Computer (Igor workstation) | Check COM port in Device Manager |
| Camera USB 3.0 | → Acquisition Computer (same machine running the Python toolbox) | Plug directly into a USB 3.0 port for full bandwidth |
- Python 3.10 (conda recommended)
- FLIR Spinnaker SDK
- PySpin (installed from SDK) ---- >> SEE BELOW additional instruction
-
- OpenCV
- numpy
- tkinter (bundled with Python)
- For DAQ version:
nidaqmx - For Arduino version: standard
pyserial
We recommend creating a conda environment : in an anaconda command prompt ( !!! start promtp as administrator on windows !!!), type:
conda create -n TrigVideoCapture python=3.10
conda activate TrigVideoCapture
cd PathToThetoolbox
# recommend installing spinnaker sdk at that moment
pip install "YOURPATH\spinnaker_python-4.2.0.88-cp310-cp310-win_amd64.whl"
# test installation pf PySpin
python -c "import PySpin; print('PySpin OK')"pip install -r requirements.txtCamera is fully parametrized in Spinnaker SDK GUI (frame rate, exposure time, etc... ) After activation of the environment in the anaconda command prompt :
conda activate TrigVideoCapture
cd PathToThetoolboxrun the file accorindng to your setup
python Display_Record_Arduino_AIO.pyor
python Display_Record_DAQmx_AIO.pyThe software will prompt you to choose a folder and filename to save output. A window will open with 20Hz dipslay, and camera video is saved at the set framerate ( set in spinnaker SDK) an additional metadata file is daved along with the video with the same name
to exit the program, simply press "q" with the video display window active emergency stop the program by pressing Ctrl-C in the command bash