|
Site of Jakob Selbing [Main] |
Jakob Selbing's Quickcam Pro 4000 autoguider project UNDER CONSTRUCTION Last update: 07/04/05 Goals & status
Modifications investigated & to be investigated
Introduction The Quickcam Pro 4000 (referred to as "QC" from now on) is a webcamera in the upper price range. Price is around € 100 (March 2005). It has a CCD sensor, instead of the less-sensitive CMOS sensor which is often used in webcameras. This makes it suitable for any astronomical imaging, especially autoguiding. Unfortunately the QC cannot directly be put in a telescope for autoguiding, because the sensitivity is still quite low at the maximum exposure (1/5th second) without any further modifications. This page describes modifications that will hopefully turn the QC into a fully fledged autoguider, mainly under control of MaxIm DL, version 3.22 or later. What to expect from the modificationThe images below show the typical improvement of low-light image quality, when using some of the modifications and techniques described here.
Removing the IR-blocking filterSince CCD's are typically rather sensitive all the way into the IR spectrum, webcameras are usually equipped with an IR-blocking filter (IRB). If it is removed, the sensitivity is increased quite a bit. The drawback is that colors sometimes are rendered wrong. This doesn't really matter when using it as an autoguider, because we're not interested in the colors. To remove the IRB, the camera has to be opened, the lens mount has to be removed by unscrewing the two screws on the PCB, and the IRB must be forced out of the lens mount. If done carefully, the whole process can be reversed. Also the IRB seems to be of rather high quality (glass interference) compared to the ones found in other webcameras (plastic absorption filters). Frame integrationThe oldest trick in the book. By adding many frames, the signal-to-noise ratio (SNR) is increased. The effect is not as good as increasing the exposure time; instead the increase goes as the square root of the number of frames, as compared to linear increase with exposure time. This is under the assumption that the readout noise is the dominant source of noise in the image. The images below clearly displays the effect.
With an autoguider, one must limit the number of frames in order to get a faster guiding (typically around 1 Hz). For the analysis a maximum of 5 frames will be assumed. In the case with the QC, one can see that at 10 exposures the readout noise is not dominant anymore, but instead it is the dark current (described below), including fixed overlayed pattern, that is dominant. Dark frame calibrationAll CCDs suffer from a temperature-dependent accumulation of false signal, called dark current. One can remove it by creating a dark frame - an average (prefereably) of several exposures aquired under complete darkness. The dark frame is subtracted from any exposure done with the CCD. Dark current is visible as vertical stripes (typical for low quality cameras), hot pixels (rare pixels with very high dark current), and also increased noise due to the stocastic nature of the dark current. Webcameras usually have high dark current for several reasons: they are not cooled, and the image sensor inside them is not designed for low dark current since exposures are usually short. That is also the reason why an autoguider usually doesn't need cooling. Dark frame calibration on the other hand is "free", and has significant effect even at 1 s exposures (or 5 x 0.2 s) because the signal is usually very weak. Dark frame calibration also removes the bias signal. With the QC, dark frame calibration also removes the fixed pattern (diagonal stripes) that is overlayed the image. The exact source of this pattern is not currently known, but as long as it is additive it is not a problem. Unfortunately, MaxIm 3.22 does not support averaging of many autoguider dark frames. This means that when subtracting the dark frame, the noise is increased by approx. 41%. This effect could be almost completely eliminated by averaging a large number of dark frames; e.g. 100 frames would mean less than 5% increase in noise. In version 4 of MaxIm, there is support for user-defined calibration of the autoguider. Tests will be carried out using manual dark frame calibration, so that the QC's performance alone is being tested. Webcamera settings & EEPROM modificationSome special settings of the webcamera can be changed to optimize low-light sensitivity. These settings can usually be accessed through the camera driver interface. But inside many webcameras, like the ones based on the Philip's SAA8116 DSP (Digital Signal Processor) chip, there is also a small EEPROM (24C04) which contains information about what type of image processing should be applied on the raw CCD images. This includes color reconstruction, noise reduction, sharpness, color balance, etc. Some of this information is accessible through the camera driver interface, but most of it is not. Using specially written software (WcRmac) one can both read and write the EEPROM. The following settings are of interest:
Increasing the gain does not automatically increase the SNR proportionally, since the readout noise is also increased. Instead, some secondary noise effects, like power supply noise and quantization noise, can be proportionally decreased relative to the signal. Gain is accessible in the camera interface, and for autoguiding it should be set to maximum. Increasing the exposure time beyond the original range can be done if the exposure time is stored in the EEPROM, and the full range of the data format is not used. E.g. if the exposure time is a number between 0 and 100, one could write the value 200 to the EEPROM, and thereby forcing the camera to take longer exposures. Unfortunately this does not work on the QC. Still there is a possibility that the effective exposure time can be changed, e.g. by changing other parameters that effect CCD clocking, etc. This question is being investigated, but most likely there is no way to achieve longer exposures (without modifying the hardware). One strange property is that when the QC uses 1/5 s exposure (according to driver interface), 100 frames takes only around 8 seconds to aquire. This indicate that the exposure is not 0.2 s, but closer to only 0.08 s. This means there is a lot to gain on increasing the exposure time. Sharpness
is automatically enabled in the camera, and cannot be disabled through the
driver interface. Although the
sharpness function can make images look better by compensating for poor optics
and/or loss of resolution due to color reconstruction, it also increases noise and creates artefacts, especially in low-light conditions. That is why sharpness is the main
target with the EEPROM mod. Changing or completely disabling it is easily done
through writing to EEPROM address EAh (this only changes the factory settings,
so they must be loaded manually in the camera driver interface). A value of 0h
completely disables sharpness.
Gamma correction means changing the intensity-to-intensity response of the camera, enhancing shadows in the image. It is unwanted in autoguiders for several reasons. The first is that since gamma breaks the linear response of the camera, any dark frame subtraction will not be entirely accurate. The other is that noise is increased. Lastly the centroid calculation will in principle overestimate the weight of dark pixels that have been enhanced through the gamma correction. Gamma is accessible in the driver interface, and also at address EEh (factory setting) in the EEPROM, and should be set to 0 for optimum autoguider performance (this might need investigation and field testing). Other parameters of interests are e.g. the user-accessible contrast, brightness and saturation. The problem with these parameters is that it is not clear at what point in the data flow the algorithms are applied, therefor one can only make direct tests of the impact of these parameters. Experiments showed that high brightness did improve the SNR greatly for especially shadows, which might be an effect from the compression. The conclusion is that brightness should be set to maximum, as long as the CCD does not saturate. Contrast - to be investigated. Saturation - to be investigated. Black level offsets for Bayer pixels K1-K4 can only be accessed in the QC's EEPROM at address 102h-105h, and define the target black level offset of the pixels. This is probably accomplished in the AD-converter, but exactly how this works is not sure because the datasheet indicates that the black level must be the same for all pixels. With maximum gain and brightness, the black level should be around 24 decimal (18h), since noise otherwise causes some clipping to occur for "negative" pixel values. Color reconstruction can be disabled by changing the EEPROM, but since each pixel on the CCD has its own filter, the image will display a 2x2 pattern. This is not good for autoguiding, because the centroid does not accurately represent the actual position of the star. Instead one would like to receive a monochrome image, without pattern and with the highest possible SNR. This can be done in the camera driver, simply by selecting B/W image format. However, when color is used, MaxIm still receives a B/W image. If the SNR in this case is compared to when the camera is in B/W mode, then one can see that setting the camera to B/W is preferred, because the image received by MaxIm seems to be only the green channel from the color image. A better way would be to add all three channels to one monochrome channel, which seems to be what the webcamera is doing in B/W mode. The color reconstruction matrix and pre-matrix coefficients are very interesting parts of the DSP. The matrix defines each of the RGB color output as a linear function of the filter RGB colors, multiplied by their pre-matrix coefficients. Row 1 defines the red output, row 2 is green, and row 3 is blue. I will call the output signals Ro, Go and Bo ("o" as in output). Now the input signals - Ri, Gi, Bi - are the signals of the interpolated Bayer pattern. The original configuration for my QC was: Pre-matrix coefficients: Kr = 85, Kg1 = 128, Kg2 = 128, Kb = 235 Matrix, row 1: Ro = (41)*Ri + (-3)*Gi + (0)*Bi Matrix, row 2: Go = (-3)*Ri + (17)*Gi + (0)*Bi Matrix, row 3: Bo = (-1)*Ri + (-1)* Gi + (114)*Bi It seems likely that the pre-matrix coefficients mostly decribe the CCD's inverse quantum efficiency (QE), whereas the color matrix describe the filter characteristics. This configuration boosts the blue signal a lot, which is typical for most digital cameras, etc. That is why the blue channel is often much noisier than the others. That effect alone is not bad from an SNR point of view, because it is unchanged when a signal (including noise) is amplified. But when merging all channels to one monochrome frame the SNR will actually be worse than if the blue signal is left unchanged. A better approach would be to weight the direct pixel signals so that the RMS is the same for all three channels. However, one must take into account that the input values to the color matrix (and pre-matrix coefficients) are in fact averages of several pixels in 2 out of 3 cases (each reconstructed pixel has only one filter but three channels). If looking only at one 2x2 area, there are two green pixels, one red and one blue. Therefor the green signal is the direct pixel value in 2 cases and an average of 4 pixel signals in 2 cases. The red and blue are an averge of 2 pixels in 2 cases, 4 pixels in 1 case and the direct pixel value in 1 case. If the read noise is N, then the interpolated signals have Var(G) = (2)*(N2) + (2)*(N2/4) = (10/4)*N2 Var(R) = Var(B) = (2)*(N2/2) + (1)*(N2/4) + (1)*(N2) = (9/4)*N2 It should be pointed out that this analysis is not entirely correct, because it assumes independent pixel values, which is not the case due to the interpolation. A better configuration (higher SNR) would be: Kr = Kb = (10/9)*Kg = 1.111*Kg Matrix, row 1: Ro = X*Ri Matrix, row 2: Go = X*Gi Matrix, row 3: Bo = X*Bi Exactly which constants Kg and X to choose is unsure, but one guess is that Kg should be set to 128, hence Kr and Kb should be 142. The value of X is internally divided by 16, so a good idea is to set X to n*16, where n is an integer. Color balance is affected by two registers in the DSP which control red and blue balance. Following the previous motivation, the balance should be neutral for both red and blue, which seems to be accomplished by using a value of 0 in both registers. Testing this configuration revealed that the SNR was in fact reduced. Another critical property discovered is that when mering all 3 channels, SNR increases to a mere 10% instead of expected 73%. This means that most of the noise is correlated. It should be pointed out that the images were not dark frame calibrated, something which could give similar results if the dark current is dominating. This did not seem the case. More testing is needed. Modification of electronics It has been quite popular among amateur astronomers to cut the signals that control the shutter and reset of the CCD, and instead have these controlled by a printer port or serial port of a computer. This modification is called long-exposure mod, or SC mod. Controlling such a mod:ed webcam is actually supported by MaxIm. But since this is risky, and also involves cutting wires on the PCB, it is not a prioritized modification for my project. However, as the QC seems to limit exposure time to only 0.08 s, there is actually a lot to gain on this mod. In fact, if exposure can be increased to 1 s, one could expect a whole 2.74 magnitudes increase in sensitivity. CCD cameras are usually susceptible to noise from the power supply. By adding extra decoupling capacitors, it might be possible to reduce some of that noise, if there is any present in the QC at all. The USB specification states a maximum capacitance of 10 µF. Unfortunately it is difficult to examine what components are connected where in the PCB, due to the hidden middle layer, and if there are already any decoupling capacitors across the power supply. What seems to be a 4.7 µF decoupling capacitor can be found on the back, but it is connected to the OD pin of the CCD (described in next section). A few other components might need investigation, especially those connected to the CCD. The CCD is either a Sony ICX098 (older QC version) or Sharp LZ24BP. The Sony chip supposedly has better sensitivity (one figure mentioned is 25 lux vs. 1 lux, which seems very extreme). My QC has a Sharp CCD. Its datasheet reveals some interesting information, e.g. the variable electronic shutter is specified to between 1/30 s and 1/10 000 s, but according to the camera driver interface the shutter can be as slow as 1/5 s. Another interesting piece of information is the system configuration example, where a typical circuit is shown. Only two decoupling capacitors (unspecified values) are found, and they are connected to output transistor drain (OD pin) and P-well (PW pin), respectively. The OD pin is in principle the supply voltage for the CCD's internal amplifier, thus proper decoupling here would give results. It is connected to Vcc. But there is already a 4.7 µF capacitor connected to it, and it is not very likely that performance would change by increasing this value. Instead, one can look further in the suggested schematic and see that the buffering transistor at the CCD output (OS pin) is another point which would probably do better with decoupling. It is also connected to Vcc, hence also connected to the OD pin's decoupling capacitor, but the distance to the capacitor is longer (wire not visible though). One carefully selected capacitor placed between this point and ground might improve performance. One test was carried out, by adding a 200 nF ceramic capacitor between ground and the buffering transistor's connection to Vcc (collector). Exposure was 1/30 s, maximum gain, maximum brightness, B/W mode, and the WcRmac "optimized color" macro had been applied to the camera. To remove the fixed pattern noise, the difference between two images was used. In one case the two images were aquired without the extra decoupling capacitor, and in the other case with the capacitor. For the first case, the difference between the images had a noise (RMS) of 74.68, and for the case with capacitor 71.74. Thus the improvement is 4%; not much, but then again the modification is very simple.
On the Internet I also found a modification of the Cookbook 245 CCD-camera, in which the buffering transistor was completely removed, thus reducing noise. It is not sure that this modification can be applied to the QC, but the possibility is being investigated. The limiting factors are the CCD's output impedance, the ADC's input impedance and the readout frequency. Another area of interest is the AD-converter, which is an Exar Corp. D98L59AIG. It is a 10-bit / 20 MHz device, with nice features like programmable gain and correlated double sampler. There are two analog voltage references (top and bottom), plus one analog and one digital supply. All seem to be fairly decoupled. The snapshot button is a simple N.O. button, thus one can remove it without further modifications. The mic has a DC resistance of 1 kOhm, and one possibility is that if removed one should put a 1 kOhm resistor in its place. By looking at the SAA8116 datasheet, one can see that a current would continue to flow through this resistor, coming from the SAA8116's mic power supply pin. It might instead be better to use a larger resistance, perhaps no resistance at all. The resistor between the mic power supply is 20 kOhm, and thus a 1 kOhm resistor would in worst case (4.0 V mic power supply) cause around 3 mW dissipation. Measurements did however indicate that the resistor is actually 2kOhm, not 20 kOhm as in the system configuration example. To be determined. The LED, which lights whenever the camera is running, is activated by a transistor, which is switched on by the SAA8116. Most probably, the LED can simply be removed. Another option is to remove the LED's series resistor (150 Ohm), which will void the risk of damaging the LED (resistors are much less sensitive to heat). With my QC, I replaced the LED with two short wires attached to a yellow LED so that it can still be visible but will not leak into the optical system. Heat dissipation & camera coolingWhen investigating the properties of the QC, it soon was clear that at low-light conditions the dark current was significantly degrading the image quality. The reason is that the QC gets quite warm during operation. This was nice to discover because it means that by using air cooling of the CCD and the rest of the electronics, one can reduce the dark current a lot. The main heat sources are the DSP (typ. 280 mW, max 350 mW) and the ADC (typ. 120 mW). The clock driver, a Sony CXD1267AN, also produces typically 90 mW, and since it is placed directly under the CCD its effect is significant. The CCD itself does not produce any significant heat. Instead the capacitive loads of the CCD pins give rise to a power dissipation in the clock driver.
There is probably no point in installing active cooling, e.g. a Peltiér element, because the cost would be high and the gain in SNR would not be that great for autoguider usage. But since the electronics dissipates some 500 mW, some kind of air cooling would be a cheap and efficient modification. It will allow the CCD to have a temperature that is closer to the ambient temperature. One option is to install a small fan that blows air through the camera. However the noise generated from the motor might cancel the desired effect. Further the power consumption of the camera will be larger than defined in the camera's USB interface. Another way would be to make circulation holes in the camera body, and maybe even removing the cover completely. By installing heatsinks on the DSP, ADC and clock driver, most of the heat can be efficiently directed out in surrounding air. With extra ventilation holes on the top and bottom of the camera body, the generated heat will cause a circulation of air, as warm air rises through the upper hole and cooler air is sucked in through the lower hole. One possibility is to simply remove the top cover and the bottom hole mount. An even easier approach is to only remove the top cover and bottom hole mount, and move the PCB forward inside the camera body. To examine the effect of heatsinks and a fan, the camera was allowed to run for 15 minutes, then a fan was started, blowing air onto the PCB. There was either 0, 1 or 2 heatsinks connected.
Apparently the fan had much better effect than the heatsinks. These tests were made at room temperature, so it might be that extra cooling is not needed when using it during the night (it is usually quite cold at our observatory). Installing a fan introduces both noise, vibrations and also a separate power supply might be needed. One must also keep in mind that the dark current itself is not bad, since it can be removed by subtraction. It is instead the temperature instability and dark current noise that is the problem. Effects of temperature instability are smaller at lower temperature, and so is the dark current noise. Focal reducer A focal reducer would give a larger FOV, and also increase the signal peak of stars (at least under moderate seeing conditions). Jupiter observationsTo get an idea of the absolute sensitivity of the camera, on March 24 (2005) I made a few images of Jupiter and its moons. Conditions were very bad; full moon was only around 30° from Jupiter, seeing was bad, transparency was bad, and the air was hazy which worsened the sky background. There is also some light from the QC's LED leaking into the image (I hadn't done the LED modification yet). Telescope was an MC MTO-11CA 100 mm f/10 telescope.
The noise (including fixed pattern) in the image is 3.5 RMS. Background is 30, and peak at Callisto is 122. It not easy to say exactly how much fainter a star can be used for autoguiding, but one magnitude higher (2.51 times less signal) should be possible, maybe even 2. According to JPL's Horizion service, the apparent magnitude of Callisto was 6.13, so that would mean limiting magnitude 8. Now magnitude 8 is not that easy to find in the sky at such a small FOV (12.3' x 9.2'), but there are several factors that will improve the situation:
Next night of testing gave much better results. The conditions were better but still the almost-full moon was up, and transparency was moderate. The air was slightly hazy. Targets were Saturn, Jupiter and Praesepe (M44).
During this testing, I discovered that the black level of the camera was so low (temperature was only around 0°) that some pixels were clipped to 0. This is not good at all, because it introduces more noise when subtracting dark frame. The problem was the black level offsets settings, described earlier in this document. Long-exposure mod The long-exposure mod (LE mod) is a way to allow a webcamera to make longer exposures than it normally can. The principle is to block two signals to the CXD1267AN clock driver: shutter and vertical clock. By using an analog switch one can select when to block and when to allow signals. The mod was created by Steve Chambers for another webcamera, and adapted to the QC (and many other webcams, based on the SAA8116 chip from Philips) by Martin Burri. The whole procedure is described on Martin Burri's site. The mod nees only a few electronic components: one 4066 IC (quad analog switch), four 15k resistors, a DSUB-25 parallel port connector, and some wires. I chose a surface-mounted 4066, and 1/8 W resistors, in order to save space. The 4066 is glued to the snapshot button connector, and resistors are soldered directly to its legs. Power is taken from the USB supply. The vertical clock wire needs to be cut, and replaced by two wires soldered to the SAA8116 and the CXD1267AN. Leg 4 of the CXD1267AN needs to be lifted from the PCB, and wires to the leg and the pad are soldered. A fine-tip soldering pen is necessary, and so is patience and plenty of time. Completing the mod took me several hours.
The shutter and vertical clock switches in the 4066 are controlled by two signals, which are taken from a 3.5 mm connector mounted in the QC. A specially made cable connects pins 2 and 5 of the PC parallel port to the 3.5 mm connector. A nice feature is that if this cable is not plugged in to the QC or the parallel port, the QC operates as normal.
The LE mod did not function satisfactory initially. Many long exposures were in fact regular exposures. Martin Burri has instructions for some troubleshooting, but all the hardware seemed to function properly. . In the QCUIAG forum, I got some help with the problem. E.g. one can install the SAC7 driver, instead of Logitech's original Quickcam driver. SAC7 is a commercial CCD-camera for astrophotography and microscopy. In principle it is an LE modified Quickcam, and thus the driver works for that camera too. The driver seemed to work better than the original. but it didn't completely solve the problem. |