Resonant mirrors vary somewhat in their resonant frequency and the settings of the mirror controller must be adjusted to obtain the best possible images in bidirectional mode.
A synchronization signal from the resonant board must be adjusted so that it is both symmetric and its phase is aligned with the zero crossings of the mirror velocity.
First, connect an oscilloscope to the HSYNC signal in the extension header of Scanbox. The HSYNC signal is exposed on the header only in the latest version of the firmware, so please download and install it from Github before proceeding. It is the fourth pin from the left on the top row of the connector as one looks from the top. Tip: A jumper wire makes it easy to get access to this signal without shorting nearby pins with your scope probe.
Look at this signal on the oscilloscope while scanning. Any modern oscilloscope will allow you to measure the period of the signal as well as the positive and negative pulse width. In the example below, the resonant frequency is 7928 Hz, the positive pulse width is 63.22 us and the negative pulse width is 62.91 us.
The first step consists in making sure the signal is symmetric. In other words, the positive and negative pulse widths should be equal. You can adjust this by rotating the SYM pot on the resonant scanner driver board, which is the small board mounted on top of the main Scanbox card. There are 3 pots on this card labeled SCALE, SYM and PHASE. The SYM pot is the one in the middle. Slowly rotate the pot until you get the high and low pulse widths to be within 0.5 us of each other. In the example above the difference is 0.31um.
Now, measure the laser frequency at the wavelength you typically image. This can be done by measuring the frequency of the signal that comes out of the SYNC OUT of the Chameleon. It will be close (but not exactly) to 80 MHz. In my case, I get 80.10 MHz.
Now, we need to calculate the number of samples that comprise one line. This is ratio between the laser frequency and the resonant frequency divided by 8 (because each period is two lines and each pixel is 4 samples). Given the numbers above, we get: round(80100000/7928/8) = 1263 samples per line.
Ideally, this is where lines should be “folded” during bidirectional scanning to get even and odd lines aligned. So, lets start by setting the ncolbi variable to be 1263 (or the value that you found for your setup) for all 3 entries in the scanbox_config file. (Remember you need to restart Scanbox for these new values to take effect).
Now scan a target that has some nice structure at a magnification of x1. It may still be the case that the lines are not perfectly aligned. While looking at the image, rotate the PHASE pot on the resonant controller to make the even and odd lines align as close as possible. Warning: this pot is VERY sensitive, so turn it slowly. The result does not need to be perfect, but close enough so that even and odd lines do not look obviously displaced from each other.
Now, with the target in place, run the auto-calibration procedure described here. Scanbox should be able to find the optimal values that makes the even/odd lines align as much as possible.
Note: your PMT amplifiers should be set at full-bandwidth and a gain of 10^4, resulting in a bandwidth of 80 MHz for this procedure (and for imaging in general).
After going through this procedure you should be getting nice, sharp images in bidirectional mode across the entire field (both in the center and the sides of the image).
It is typical for some resonant mirrors to experience a small change in frequency with time. A typical measurement looks like this:
Resulting in 2 parts per 8000 change in frequency over the first 5 min of operation. This change can misalign the odd/even lines by ~1 or 2 pixels, which is visible. To ensure stable calibration and operation during bidirectional scanning, we recommend you use Scanbox in continuous resonant mode. Here, the resonant mirror will remain in operation throughout your acquisition session. Of course, you should also perform the above calibration after the mirror has been operating for 5 min or more.