kavli-ntnu / MINI2P_toolbox

The codes, software, models, protocols, and etc. for building and using MINI2P to do the freely-moving recording and analysis. More details can be found in the original paper "Large-scale two-photon calcium imaging in freely moving mice(2021)".
MIT License
85 stars 19 forks source link

ScanImage settings for MEMS mirror #36

Open chenhungling opened 8 months ago

chenhungling commented 8 months ago

Dear Mini2P developers,

We have the A3I12.2 (MEMS-L, max mechanical angle $\pm 5.1°$) and the T180 driver. I realized A3I12.2 has Vbias=80V and T180 driver is biased at 90V, they should work but just lose some voltage range I think... I would like to understand the settings in Machine_Data_File_2000Hz.m

  1. ResonantAxis :
    • inputVoltageRange_Vpp=3.87 : this means vDAQ applies -3.87 to 3.87V to the MEMS driver, right?
    • angularRange_deg=16 : I guess in horizontal scan, this is related to $5.1\times 2 \times\sqrt{2}$ or?
    • xFilterClockFreq_Hz=250 000 : related to 2000 Hz set here
    • yFilterClockFreq_Hz=100 000 : slow axis operates at quasi-static condition, the recommended low-pass filter cut-off is 1000 Hz, why a x100 factor? I read x60 in Mirrorcle report (related to DAQ sample rate). How do you choose these filter clock frequency?
  2. GalvoPureAnalog :
    • angularRange=8 : How is this determined? This seems to me a small angle (I would say $5.1\times 2 \times 2$ that is 20 optical degree for vertical scan)
    • voltsPerOpticalDegrees=-1.1 : Multiplying the angular range above, does this means voltage range is 8.8V? 0 to 8.8V or -8.8 to 8.8V?

I don't want to burn the MEMS mirror thus try to understand the settings. Any hint will be very helpful, thank you!

WeijianZong commented 8 months ago

thanks for these question. Here are some of my thoughts of these question:

ResonantAxis : inputVoltageRange_Vpp=3.87 : this means vDAQ applies -3.87 to 3.87V to the MEMS driver, right? Yes. angularRange_deg=16 : I guess in horizontal scan, this is related to or? --Yes. xFilterClockFreq_Hz=250 000 : related to 2000 Hz set here --Yes yFilterClockFreq_Hz=100 000 : slow axis operates at quasi-static condition, the recommended low-pass filter cut-off is 1000 Hz, why a x100 factor? I read x60 in Mirrorcle report (related to DAQ sample rate). How do you choose these filter clock frequency? --Because the cutting-band is not very sharp so we need to give some mergins.

GalvoPureAnalog : angularRange=8 : How is this determined? This seems to me a small angle (I would say that is 20 optical degree for vertical scan) --the absolution angle does not matter here. Instead, the final output power determines the scanning angle of MEMS. Maybe you can go to Scanimage website where you can find how ScanImage defined these paramters (here:https://docs.scanimage.org/Configuration/Scanners/Resonant%2BScanner.html) voltsPerOpticalDegrees=-1.1 : Multiplying the angular range above, does this means voltage range is 8.8V? 0 to 8.8V or -8.8 to 8.8V? --Yes

chenhungling commented 8 months ago

Thanks for your answers. I test the MEMS scanner at 45° incidence with laser beam coming vertically from the top. Viewing from a screen set 75cm away, resonant X axis results in horizontal scan and slow Y axis in vertical scan and the mechanical mirror tilt can be determined by measuring the scanned width and height.

20231107_Test_MEMS_scanner

I test ScanImage starting from small voltages and small angles. The voltage settings correspond to what are expected, but the weird thing I observed is that increasing the resonant angularRange_deg with all other settings unchanged decreases the X scanned width. Moreover, increasing the galvo angularRange increases the Y scanned height (this is normal as the total voltage increased) but also increases the X scanned width (surprising!?). All ScanImage needs to drive the scanner is the voltages, but why and how angular settings involve still puzzles me. I don't have a stock of MEMS mirrors to test so just stick to some settings that work. Finally, I guess I will need to calibrate the resonant phase and distortion later. I read in your protocol a method preparing a fluorescent distortion grid. What is this fluorescent marker used? Will this marker stick on the chrome coating of Thorlabs test target and not on glass substrate? Thanks again for all these helpful information.

chenhungling commented 7 months ago

Hello, I am now testing our assembled miniscope simply using a target placed above a NIR phosphorescence card. I can see horizontal lines but not vertical lines, even if horizontal lines are rotated with a small angle, I no longer see them. I imaged a series of displaced L-shape but got only horizontal patterns (here the FOV is about 400 µm and L-shape thickness is about 100 µm): Test Lshape It looks like something wrong with the resonnant frequency and the synchronization between lines. I tried different syncPhase_deg in machine configuration and scan phase setting in scanimage but still don't see visible vertical patterns. I think of the end-of-line trigger because scanimage setting for mirrorcle.ResonantAxis requires hDOSync for the digital output of the sync signal. Should it be connected to somewhere? Any other suggestion would be helpful.

Devices: