When a digital camera is exposed to light, each pixel detector is bombarded with photons that free up electrons. The free electrons are allowed to accumulate as long as the pixel is exposed to light. Once the light source is shut off, the accumulated charge (voltage) is measured by an analog to digital (A/D) voltmeter and converts the analog voltage to a digital voltage. The pixel charge is removed from the pixel.
The number of bits (size) of the A/D convertor will influence the number of unique outputs (steps) available to represent the analog input. A/D size is very important. Too small and the output representation will be distorted. Too large and unwanted noise can be introduced in the output. The primary function of the A/D convertor is to faithfully represent the analog input in a digital format. The digital voltage is converted into a number that becomes the pixel value, commonly called counts, “Data Numbers” (DN), or “Analog-to-Digital Units” (ADUs). This conversion process can be scaled, if desired, without changing the relative pixel values. Somewhere during this process, the a gain factor is applied that relates the number of electrons in a pixel to the final number of pixel counts. It is possible to over-saturate a pixel by allowing too much light in. The amount of light a pixel can store is call it’s pixel well.
Gain = (Number electrons per pixel) / (Number counts per pixel)
STEP 1 Make several bias, dark and light frames taken with 2^n exposure settings (ie. 1s, 2s, 4s, 8s) at some constant CCD temperature. Because some cameras may compress high pixel count, be careful when the pixel well is getting full.
STEP 2 Subtract bias and dark frames from the light frames.
STEP 3 Find average of two corrected light frames with the same exposure settings by adding them together and dividing by 2 using PixInsight PixelMath process or other software. Repeat for the other light frames. Save each file with a name like: average_1s.fit, average_2s.fit, etc.
STEP 4 Subtract two corrected light frames with the same exposure settings using PixInsight PixelMath process or other software. Repeat for the other light frames. Save the file with a name like: difference_1s.fit, difference_2s.fit, etc.
STEP 5 Open the average file in PixInsight and define a area in the image of 5,000 to 10,000 defect free pixels. Calculate the mean value for all the pixels using PixInsight PixelMath. Record the Mean value for exposure n. Repeat for the other average light frames.
STEP 6 Open the difference file in PixInsight and define the same area used in STEP 5. Calculate the standard deviation (rms) for this area using PixInsight PixelMath. Record the Variance value for this area using the following formula:

Variance = ( (rms) * (rms) ) / 2.0
Repeat for the other difference light frames.
STEP 7 Plot Mean values on the X-Axis and Variance values on the Y-Axis using linear graph paper. Draw a line through the points.
STEP 8 Calculate the slope of the graph.
STEP 9 Camera gain is the reciprocal of the graph slope
