PIC Optical Spectrum Analyser

PIC Optical Spectrum Analyser

Design for a practical working optical spectrum analyser.

Written by Guy Fernando.

Click to download the full article

Guy Fernando has presented his design for a practical working optical spectrum analyser. Having previous worked with these instruments 25 years ago, he thought it time to investigate creating a spectrum analyser that can easily and cheaply be constructed using readily available components.

The optical spectrometer is an instrument used to measure properties of light over a specific portion of the electromagnetic spectrum, typically used in spectroscopic analysis to identify materials, and in spectroscopy for producing spectral lines and measuring their wavelengths and intensities. Professional optical spectrum analysers, also known as spectrometers or monochromators are mostly prohibitively expensive, and often out of reach of the humble experimenter. However it is possible to construct a respectable visible range spectrometer from cheaply available optics, and electronic components. This document aims to describe the means to build such a device. It is hoped that the open nature of this design will inspire others to add and extend to the design and functionality contained within.

The Optics

Layout of Optics

The main objective was to design a spectrometer with no moving parts and for it to be powered and operated solely by the attached host computer via its USB port, with accompanying application software to provide both spectral and colour analysis. A solid state spectrometer typically uses mirrors or lenses to collimate and focus the light rays under measurement, and a prism or diffraction grating to refract and split the light into its constituent colours. A linear light sensitive device such as a CCD or CMOS detector is typically used to convert the projected spectrum into an electrical signal. The most expensive parts in a spectrometer are the detector, mirrors and diffraction gratings, which can each run into thousands of GPB depending on their quality and performance.

Optics Equations

The Electronics

The electronics is separated into three sections namely the microcontroller, power supply, and detector head section. The author selected a Microchip based microcontroller as he has much experience working with this microcontroller manufacturer. The chosen PIC18F14K50 has the required inbuilt USB, SPI, ADC and I/O modules for interfacing with a host computer, reading and writing to external static RAM, and the acquisition/control crucial for reading the CCD pixel data. Unfortunately as there is insufficient RAM within the microcontroller to store the acquired CCD pixel data and to run the firmware, external static memory chip 23LC1024 is used to store the acquired spectrum. When the firmware receives a READ_SPECTRUM USB command from the host computer, the stored spectrum is streamed out to the host computer. As the CCD detector requires a 12v supply to operate, the 5v USB power supply is stepped up using a standard boost converter.

Microcontroller and Memory Schematic Diagram

The detector head is a separate PCB on a flying lead connector, which houses the CCD device and analogue signal conditioning electronics. The single rail CA3140 op-amp is used to combine the R, G, and B colour pixels from the CCD and invert the signal such that increasing intensities result in a positive swing from the op-amp output. The two preset potentiometers VR1 and VR2 provide RGB offset and RGB gain control respectively.

Boost Schematic Diagram
Detector Head Schematic Diagram

The Application Software

The application software currently runs on Windows (XP, Vista, 7, 8 and 10). The software is used to acquire and view incoming real time spectral data from the attached spectrometer device. Once set to acquire, the real time data is displayed and refreshed once a second. The acquisition can be stopped at any time to freeze the spectrum for closer inspection, or saved as a binary document for later analysis or as a means of archiving spectra. As well as controlling the acquisition, the toolbar allows the adjustment of integration time and optical resolution. Increasing the integration time allows more photons to hit the CCD device and so increases sensitivity. The optical resolution should be adjusted to match the entrance slit width. The spectrum view displays the familiar relative spectral intensity against wavelength line graph. The peak wavelength, peak intensity and illuminance values are also displayed.

Spectrum View

Prior to use, the spectrometer must be calibrated both in terms of wavelength calibration and intensity. The application software incorporates functions to perform these calibration steps.

CIE Colour View

The CIE colour view displays a CIE 1931 chromaticity diagram, and plots a circular marker at the x and y coordinate. The x, y and z colour coordinate values are also displayed.


It is certainly possible to construct a respectively well performing spectrometer from readily available cheap components for only a fraction of the cost of most commercially available spectrometers. The author has so far successfully used the spectrometer to determine the colour variation in a batches of LEDs, chemical analysis using Raman spectroscopy, and for detecting the absorption lines from sunlight. As already mentioned, the Sony ILX518K CCD device used was pulled from an old scanner and is not specifically intended primarily for use in spectroscopy. As a result the spectrometer is prone to lacking sensitivity especially when using narrow slit widths. The sensitivity of course can be improved by increasing the integration time setting from the application software. The half second spectrum update rate is about the best that can be achieved with the current hardware. However by using a faster ADC converter, using local memory instead of external memory, and improving the USB data transfer, a better update rate could be achieved. It is expected that by replacing the current CCD and microcontroller to higher performance parts in the next version, these limitations will be improved upon.