The ASI auto-focus system is an electronic circuit that detects the high spatial frequency information present in a video signal coming from an analog camera, and converts it to a focus signal for each frame – the better the focus, the larger the focus signal. The focus signal has amplitude between 0 to 5 Volts. An onboard ADC is provided; lets the user read the focus signal as an 12bit binary number with an I2C interface. Depending on the sample and the type and power of the objective, the conditions to achieve the best focus signal may change. To compensate, the system incorporates a set of I2C controlled digital potentiometers that lets the user calibrate various internal parameters to get a good focus signal. The system also allows user to highlight any subset of the video field and generate focus signal for it.
0x90 (1001000x)| Table 1: Molex Header pin out | |
|---|---|
| 4-Pin Molex | Header pin out |
| 1 | 5V |
| 2 | GND |
| 3 | SDA |
| 4 | SCL |
0x58 (0101100x).0x5A (0101110x).
Video Sampling option is available to users to define a subset video and generate focus signal for only that video field. This feature is useful in avoiding false focusing when a video has multiple objects or noisy background. Selection of subset video is done by changing resistances with AD5252 IC; it’s a dual channel, digitally controlled potentiometer with 256 positions, with nonvolatile memory and an I2C interface. The datasheet of this IC can be found here. The address of this IC on the board is 0x58 (0101100x)
Each channel controls the resistance and thus controls the width of the actively sampled region vertically and horizontally. Each channel has an 8bit register (0x00 to 0xFF) RDAC1 (internal chip address 1) and RDAC3 (internal chip address 3) that carries setting for each channel/potentiometer. When both the channels are set to 0xFF, then the entire video is sampled, and when the channels are set to 0x00, then the entire video is ignored. Since the IC are nonvolatile, once the values are picked they can be saved into the non volatile memory, which are restored to the RDAC registers at system power-on.
Please refer to the AD5252’s manual for details on communication with the IC.
Connecting a monitor to the Monitor out of the autofocus card shows the sampled video as a highlighted rectangle. Two mechanical trim potentiometers are provided to let the user centering the sampled video.
The second dual potentiometer is also an AD5252. The address of this IC on the board is 0x5A (0101110x). This IC controls some of the circuitry that detects and converts the high spatial frequency signal in a video to a focus signal. The first channel/potentiometer is a zero adjusts and the second channel controls the amplitude of the video signal applied to the circuitry.
The first channel of the second potentiometer is the zeroing potentiometer. When a blank video signal (completely white or black) is applied the focus signal generated must be zero volts. But due to internal offsets this value is not zero, the zero potentiometer is adjusted so that a blank video signal results in zero focus signal. To set the potentiometer, first video signal to the focus signal circuitry must be cut off. This can be done with the second channel of the potentiometer. By writing to the RDAC3 register a value of zero, video signals amplitude is reduced to zero. Now set the RDAC1 register i.e. first channel such that focus signal is zero.
The second channel/potentiometer controls the amplitude of the video signal applied to the focus signal extractor circuitry. During normal operation RDAC3 register is written with 0xFF, to let all the video signal pass, but during calibration this channel is set to 0x00, to help in setup of zero adjust potentiometer of channel one.
The User can read focus signal by connecting a coaxial cable to the Autofocus card. Or can read digitally through I2C. Analog to Digital Converter ADS1000 IC is provided on the card, it is a 12bit ADC(12th bit is sign bit, so only 11bit 0 to 2047) it has an I2C interface and runs at 128 samples per second. Please refer to the ICs datasheet on further details on how to communicate with the IC. Address of this IC on the board is 0x90 (1001000x)
This is the focusing routine ASI uses with the autofocus card and its MS2000 Microscope Z stage controller. When the controller is given an auto-focus command, it moves from a starting position to a stop position, constantly checking the focus signal. The focus signal goes through a filtering/averaging process to remove unwanted false focuses caused by noise and other disturbances. The controller takes the filtered signal and watches for focus signal to increase in value. When a new maximum value is detected, the controller keeps track of the position where it was found. When the end of the scan is reached, the controller goes back to the position that had the highest focus signal.
A slight improvement of this routine is “Hill Detect“ routine. In this routine, the auto-focus controller watches for the focus signal to increase in value and then when it starts to decrease, a hill is detected. At this point, the auto-focus controller stops the scan and goes back to the position that had the highest focus value found on the hill. This is somewhat subject to false focusing and should be used only on high contrast single-layer samples.
Before shipping, ASI uses a series of test video patterns to test and calibrate the cards.
ASI uses a computer with NTSC video out graphic card to apply these test patterns to the autofocus card.
Focus signal depends a lot on the quality of video input. A fast moving or noisy video can result in fast fluctuating focus signal. Try running the signal through a low pass filter, or an averaging algorithm if read digitally.
Here are a few things you can try when the focus signal reads a higher value at a defocused spot than at a focused spot:
This problem occurs when the Zero Potentiometer (First channel of 2nd potentiometer) is incorrectly set. This can be corrected by calibrating the potentiometer again as described in Settings Zero Adjust section
Try reducing the width of actively sampled video as described in section Video Sampling section. Or try reducing the amount of video signal applied to focus signal generator circuitry as described in Video Gain section