CCDs are analog devices that collect photons and convert them into charge. The collected charge is then shifted to the output, where an ADC digitizes it.

The TCD1304 datasheet provides this figure.


The output signal from the TC1304. A dummy-pixel or an unexposed pixel has the value OS and the higher the exposure, the lower the output voltage.

In brief; the output signal is the reverse of the intensity of the light hitting the pixels. The two key values to know is the voltage of an unexposed pixel (OS), and the voltage of a fully saturated pixel (Vsat).

The raw output from a TCD1304 on an oscilloscope looks like this:


The output (blue) from a TCD1304 connected directly to GPIO’s on a Nucleo F401RE.  OS = 2.5 V. Vsat = 0.6 V. The ICG-pulse is also shown (red).

The picture changes slightly when the TCD1304 is placed in the drive circuit described in the datasheet:


The output from a TCD1304 in the typical drive circuit. The signal is buffered by a transistor (SA1015-Y),which changes the values of OS to 3V and Vsat to 1.5V.

The noise seen in both figures stem in part from the oscilloscope. When the capture is done with the ADC in the STM32F401RE it’s cleaner:


The output from a TCD1304 read with the ADC in the STM32F401RE.

And if you want it really neat, you can average several exposures:


The output from a TCD1304 averaged over 5 identical exposures.

You may argue that it would be nicer to have a signal that is proportional to the intensity of the light striking the sensor. This is not impossible and Dave Allmon’s CCD Transmission Spectrograph has an example of such conditioning of the TCD1304’s output to the ADC he uses, and I took the liberty of copying his idea. Read more about that here.

However, as long as the output from the CCD is in the ADC’s range¹ you can also do that in software, though it will be at the expense of the resolution if the ADC’s range is underfilled.

¹ The range of the STM32F401RE’s ADC is 0-3.3V. The ADC has 12-bit resolution, so an input of 3.3V corresponds to a value of 2¹² = 4096, and 0V corresponds to a value of 0. There’s a linear correlation between input voltage an the converted value:


The original posts at erossel.wordpress.com:
Driving the TCD1304 with a Nucleo F401RE
A circuit board for the TCD1304
More on the Nucleo F401RE’s ADC