Abstract
Two-photon (2P) microscopy is a cornerstone technique in neuroscience research. However, combining 2P imaging with spectrally arbitrary light stimulation can be challenging due to crosstalk between stimulation light and fluorescence detection. To overcome this limitation, we present a simple and low-cost electronic solution based on an ESP32 microcontroller and a TLC5947 LED driver to rapidly time-interleave stimulation and detection epochs during scans. Implemented for less than $100, our design can independently drive up to 24 arbitrary spectrum LEDs to meet user requirements. We demonstrate the utility of our stimulator for colour vision experiments on the in vivo tetrachromatic zebrafish retina and for optogenetic circuit mapping in Drosophila.
Introduction
In neuroscience, two-photon (2P) microscopy is the gold standard for imaging deep into living tissue. However, a major challenge arises when researchers want to simultaneously stimulate the brain with light—either to provide visual stimuli or to activate specific neurons via optogenetics. The detectors used in these microscopes, Photomultiplier Tubes (PMTs), are extremely sensitive. Even if the stimulation light is spectrally distinct from the measured fluorescence, it often "leaks" into the detector, creating bright artifacts in the image or potentially damaging the hardware.
While mechanical shutters or optical choppers can block light, they are often bulky, expensive, and introduce vibrations. "LED Zappelin" offers a sub-$100, high-speed electronic solution to interleave stimulation and imaging, ensuring the microscope never "sees" the stimulus light.
Hardware Design
The system is built around two primary off-the-shelf components: an ESP32 microcontroller and a TLC5947 LED driver. The ESP32 provides a fast (240MHz) processing environment capable of handling the high line rates of modern resonant scanners. The TLC5947 driver allows for 24 independent LED channels with 12-bit (4,096 levels) resolution, providing precise and linear control over light intensity.
Unlike many DIY controllers that use simple Pulse Width Modulation (PWM), which often results in a non-linear brightness curve, the TLC5947 provides a near-linear output. This linearity simplifies experimental control, as doubling a value in the code directly corresponds to doubling the light power. This dedicated driver also prevents thermal runaway, ensuring the longevity of the LEDs.
Temporal Synchronization: The "Blanking" Trick
The core of the LED Zappelin’s functionality is temporal synchronization with the microscope's scanning mirrors. Most 2P microscopes scan a laser in a raster pattern. At the end of each line, there is a brief pause called the "retrace" while the mirrors reset.
The controller receives a "blanking" signal from the microscope and turns the LEDs on only during this retrace period, and off while the laser is actively acquiring image data. Because this switching occurs at kilohertz rates, the animal perceives continuous light, but the PMTs are protected from exposure during active sensing. A physical jumper allows users to invert the blanking signal logic, ensuring compatibility with various software suites like ScanM and ScanImage, which use opposite TTL logic.
Validation and Results
The authors validated the system using two in vivo biological models:
- Zebrafish Larvae: Mapping color processing in the retina across four spectral channels (Red, Green, Blue, and UV).
- Drosophila Larvae: Mapping olfactory circuits by optogenetically activating sensory neurons with red light while imaging brain responses.
The system demonstrated artifact-free imaging in both cases, even with high-power LEDs. Key advantages include its low cost (under $100), high precision (trigger signals within 0.1 μs), and scalability to 24 channels for complex "arbitrary spectrum" stimulation, such as simulating the light environment of a shallow pond.
Conclusion
LED Zappelin provides an accessible, open-source tool for complex visual stimulation and optogenetics. While it requires a "blanking" signal from the microscope and regular calibration of LEDs, its performance rivals commercial light engines at a fraction of the cost. All code, PCB files, and 3D models are available on GitHub for the research community.
Summary updated