The following procedure will allow you to define a linearization table for your Pockels’ cell so you can obtain a linear power change with equal steps in the value of the power slider in Scanbox.
During imaging the laser power is controlled by an 8-bit DAC that ranges from from 0V (at a DAC register value of 0) to 2V (when the DAC register value is 255).
The DAC provides the control voltage used by your Pockels driver. I have the Conoptics 302RM driver, which accepts a maximum of 2 Vpp as its control signal. Other users may have different drivers, but the instructions below should apply for all of them.
The curve relating laser power to voltage depends on your driver, Pockels’ cell and laser wavelength. The first step to compute your linearization table is to measure the power of the laser during imaging as a function of the DAC register value. Typically doing this measurement at steps of 8 or 16 is enough.
To do this you begin by resetting the default lookup table to the identity. With Scanbox open (but not imaging), simply go to the Matlab command window and type:
>> sb_pockels_lut_identity
Now, you can manually set the power to an arbitrary value by typing:
>> sb_pockels(0,newValue)
This allows you to directly set the DAC register value to newValue. Note that after resetting the LUT to the identity the range of the DAC will be from 0V to 2V for a DAC value of 255.
Set the DAC register to your desired newValue. If you now get the microscope to scan, you can measure the average power at the newValue. Once you have obtained sufficient measurements at different levels, spanning the range 0 to 255, you can interpolate and determine how the power depends on the DAC register value.
The result is likely to be a non-linear and non-monotonic curve, where the maximum power is obtained as some intermediate value and then it starts to decrease. This is normal behavior.
From the interpolated curve you can calculate a linearization table such that changes in power will be linear and it will attain the maximum possible power for a setting of 255.
The final step is to include your linearization table in the Scanbox configuration file, which now includes a line that reads:
sbconfig.pockels_lut = uint8([]);
Simply replace the empty array with your lookup table and it will be delivered to the firmware every time Scanbox starts up. The list must have exactly 256 entries or Scanbox will ignore it.
For this procedure to work you must first update your firmware (which you will find under the Yeti/drivers directory).
If you have any questions let me know!
Warning: Please make sure the maximum voltage you test is the one allowed by your driver!
Is interp1 an acceptable way to generate the lookup table or is a more sophisticated interpolation method required?
Depends on how many points you have. With ~10-12 points covering the entire range it should be reasonable enough.
Thanks!
We have a couple of questions regarding how to define a linearization table for our Pockels’ cell.
(1) ‘For this procedure to work you must first update your firmware’ How do we confirm that our firmware is appropriately updated?
(2) We have the ConOptics driver. When manually setting the power to an arbitrary value, what should we set the driver bias pot to? Zero?
(3) I understand that the values we should test should be in the range of 0 to 255, correct?
Thx!
Firmware: In the command window type:
>> scanbox_config
>> sb_open
>> sb_version
You should see version 4.6.
The bias should be untouched. It is set so there is minimum transmission at a command voltage of zero.
Yes, values to be tested in the 0:255 range.
Also, I see in the config file: sbconfig.pockels_range = uint8([1 2]); % set pockels range [vdac pga]
Based on the above description, I might expect that sbconfig.pockels_range should be set to uint8([0 2]). Can you let us know what this value should be or tell us how to set it?
Thx!
That sets the range of the command signal. Do not touch — [1 2] means the range is 2V