TITLE: Modified Frame-projected Independent Fiber Photometry (FIP) System_Triggering system
AUTHORS: Kenta M. Hagihara

[DESCRIPTION]
Frame-projected independent fiber photometry (FIP) is a method to measure fluorescent sensor signals through optical fibers implanted in living animals, using a camera to record video of the fiber faces. To precisely control timings of excitation and camera frame acquisition for FIP, and of other external stimulation apparatus (e.g. LEDs for photo-stimulation), we use a Teensy 4.1 microcontroller, which generates voltage pulses without relying on continuous communication with the operating system of the experimental computer for timing. This protocol is for the 3 excitation LED + 2 collection CMOS cameras design. 
Triggering-controlling software (an Arduino sketch) and data aquisition software (a Bonsai workflow) can be found in an associated github repository.

[BEFORE_START]
Please see the accompanying protocol for the main FIP hardware design:
 


[GUIDELINES]
Teensy 4.1 only provides ~3.3V. If the device you want to trigger requires 5V (or more), the voltage needs to be up-regulated.

[STEPS]
SECTION: Setting up an experimental PC and Teensy 4.1 device
5. Connect Teensy 4.1 device to the experimental PC using a USB cable, set proper COM port in the Arduino app, and upload the .ino sketch to the device. How to find and set up the corresponding COM port can be found here: https://support.arduino.cc/hc/en-us/articles/4406856349970-Select-board-and-port-in-Arduino-IDE.
SECTION: Setting up an experimental PC and Teensy 4.1 device
2. Install Arduino app on your experimental PC from the following link: Arduino software.

SECTION: Setting up an experimental PC and Teensy 4.1 device
3. Add Teensy extension to Arduino app by following the official instructions.

SECTION: Connecting the Teensy 4.1 device to hardware to be controlled
6. Place the Teensy 4.1 device on a breakout board (or a generic electric breadboard).
SECTION: Connecting the Teensy 4.1 device to hardware to be controlled
8. Solder wires between the breakout board and the BNC sockets according to this diagram for 3 excitation LEDs and 2 CMOS sensors configuration.
 

 

SECTION: Connecting the Teensy 4.1 device to hardware to be controlled
9. Connect the device to hardware (cameras and LEDs) to be controlled using BNC cables.
 


 


SECTION: Software parameter setting
10. Based on acquisition frame rate and the CMOS cameras to be used, set the acquisition parameters in the .ino sketch.

 
When acquisition is 60Hz (20Hz for each channel) with sufficiently fast CMOS sensors (e.g. FLIR, BFS-U3-20S4M-C), an example parameter set could be:
ExpT = 15650 μs
Δt1 = 666 μs
Δt2 = 300 μs
Δt3 = 50 μs
ExpT+ Δt1+Δt2+Δt3 = 16666 μs (= 1/60 s)

For better signal, Δt1/Δt2/Δt3 should be minimized to make the exposure time longer. If they are too short, however, the camera will not be able to unload the data (when Δt1 is too short) or LED instability at the onsets (when Δt2 is too short) would lead to periodic noise generation. Based on excitation light sources and CMOS models, optimize these parameters empirically.
SECTION: Connecting the Teensy 4.1 device to hardware to be controlled
7. Attach the breakout board and BNC(female) sockets to the enclosure.
SECTION: Preparing an enclosure
1. As the Teensy 4.1 is a bare board, it should securely covered in an enclosure. The enclosure should be able to securely house Teensy 4.1, at least 5 BNC sockets, and optionally a small breadboard. Plastic 3D-printing (CAD design can be found here:    ) would be sufficient and could be any materials and designs.

SECTION: Setting up an experimental PC and Teensy 4.1 device
4. Download .ino sketch from the github repo.