Physics Course 2 Project
2003
The development of the Computer
Controlled Spectrograph to study the Fraunhofer lines of the Solar Spectrum
By S.J. George
Supervisor: Dr K Elliott
Tutor: Dr L Jones
Abstract
The aim of this project was to design a fully working graphical user interface for use with the Triax 180 Spectrograph and then observe the Fraunhofer lines in the solar spectrum. This was achieved by writing a program in Visual C++. The spectrograph was calibrated using a Sodium Lamp and then the Fraunhofer lines were observed.
Introduction
The University had recently purchased
a Triax 180 spectrograph and had intentions of using this on the University telescope,
however the spectrograph needed to have a user interface written for it; this
had to be compatible with the Microsoft ® Windows Operating System. This
naturally led to the program being written in Microsoft ® Visual C++. This will
then allow the spectrograph to be used on future projects on the University
telescope.
A spectrograph is a device which is used in many optics experiments to determine the composition of the source of light. A spectrograph is an instrument which presents a range of wavelengths at an aperture for detection by an array detector, in this case a Charged Coupled Device (CCD). This then allows the spectral lines of a source of light to be viewed. [1]
![]()
Spectral lines are brightly
coloured bands separated by regions of darkness when a source of light is shone
into the spectrograph. The spectral lines are associated with different
wavelengths and depend on what the source of the light is. [2] This is commonly
seen with Sodium (Na) discharge tubes where there are clear spectral lines (see
figure 1) with dominate lines known as the Sodium D - Lines at 588.9950 and
589.5924 nanometres [3]. The Sodium D-lines are produced due to the emission of
photons due to accelerated electrons in various orbits around the Sodium
nucleus. Spectral lines are a ‘chemical fingerprint’ for each different
element. [4] [6]
Spectrographs work by focussing diffracted light onto the exit aperture (connected to a CCD). In general the Czerny-Tuner configuration is used (see figure 2), in this case the source light is collimated by lenses (producing a parallel light) onto the diffraction grating (in this case a reflection grating), it is then focussed on the exit aperture.

The diffraction grating is the main constituent of this arrangement, as it spatially separates the spectrum of the incident light producing the characteristic spectral lines. Each wavelength of the light is incident upon the exit aperture at different angles, rotating the diffraction grating produces different wavelengths of light being able to be viewed at the exit aperture. [2] [5]
The Triax 180 Spectrograph has a turret which has 3 diffraction gratings on; these grating are all of different groove densities (1200 g/mm, 300 g/mm and 150 g/mm respectively). This is a good feature as it allows the user complete control over what type of image that is taken, either a high resolution image or a strong signal. This is due to the resolution increasing with an increase in the groove density of the grating, but at the expense of spectral range and signal strength. [5]
As the spectral lines of the source of light can be found then this means that the spectrograph is very useful in astrophysical research. For example the spectrograph can be used to observe the Fraunhofer lines of the solar spectrum; this is the final aim of the project. Fraunhofer lines (figure 2) are dark lines in the solar spectrum, these where first observed by William Wollaston and he incorrectly interpreted as gaps separating the colours of the sun. [7]

Figure 3 - the Solar Spectrum.
In 1817 Joseph Fraunhofer (whom the
lines are named after) discounted Wollaston’s
interpretation as his own observations did not produce these gaps, he actually
observed a continuous change of colour across the solar spectrum (figure 3). He
then used similar techniques to observe the spectra produced by other stars and
again found these dark lines in there spectra. While he was doing this he also
noted that some of these lines did not appear in all stars so he concluded that
these lines where not of terrestrial origin. There are many prominent lines in
the solar spectrum, for example the Sodium D-lines (at 518.4nm and 517.3nm [3])
are quite strong (see appendix 1 for typical values of the Fraunhofer lines).
![]()
Theory
Diffraction Gratings
A diffraction grating is a set of parallel slits used to disperse light using Fraunhofer diffraction. Fraunhofer diffraction is when the Fresnel number is much less than 1. The Fresnel number is defined by:
Where a is the radius of the aperture, λ is the wavelength and R is the distance from the aperture.
The scalar diffraction theorem can then be used to find where minima and maxima points due to diffraction are. If there are N slits of width 2a (centred at the origin) and separated by a distance d, then the scalar diffraction theorem is given by:
Where k is the wave number and x is the distance from the origin (perpendicular to the slits).
For Fraunhofer diffraction, the slit width is D, thus giving:
If this is integrated then this gives:
Where C is a constant of integration
and
.
By squaring the magnitude of the wave function we get the intensity, I, which is:
The maxima and minima are then found by differentiating equation 5 and then setting the derivative to zero. So:
So minima occur at:
, or
, or
, or ![]()
![]()
So:
Maxima occur at:
This allows the maxima and minima points of diffraction to be calculated and the diffraction grating can be set up to these points. [8] [9]
This will allow images to be taken, but diffraction gratings also cause the source image to be angularly magnified, so have to account for this angular dispersion which is defined as, the ratio of the angular separation between two wavelengths (in radians) to the differential separation between the two wavelengths in nanometres. The ratio is given by:
This leads onto the general equation for diffraction gratings:
Serial Communication
To communicate between the
spectrograph and the computer there are certain criteria that have to be met.
The major criterion which has to be met before anything else is done is the
protocol (language) which is going to be used. For the Triax 180 Spectrograph
it has two modes either RS-232 (which shall be used) or IEE488. This is so
important because both the port on the computer and the spectrograph need to
know when each piece of data has finished being transmitted or received.
For RS-232 this is handled by the device sending an extra bit (a binary value of 0 or 1) of information once the read buffer (RX) or the write buffer (TX) is empty, the extra data bit is read. Once this is done other items such as parity checks can be implemented, parity checks are used to check the consistent of the data (if needed).
The next part of establishing a protocol is to set what the speed of the communication is to be, this can vary from 2400 bits per second up to 115000 bits per second. This is used to ensure that the RX buffer is not filled to capacity; this is due to the hardware not being able to read from this buffer as fast as the computer is sending the data. If this is not setup then it can cause the system to crash or data to be lost.
Once this is done it means the
protocol is established and now the timeouts need to be set. These need to be
set otherwise the computer could wait for a signal for a long time when the
spectrograph could have possibly crashed, when the timeout is reached it means
the computer will no longer be waiting for the signal from the spectrograph.
Once this is set then communications to the spectrograph can begin.
Apparatus
The apparatus for the experiment can be split into two parts; the development of the computer program and the taking of the measurements. For the computer program development, the apparatus used was: a computer with Microsoft ® Visual C++ installed, the Triax 180 spectrograph, serial port communication cables, a light source and a Vernier travelling microscope.
For the measurements part of the project the apparatus used was; a computer which has a serial port so that the spectrograph can be connected, a computer with the appropriate CCD software installed (Maxim DL[1]), a CCD (in this case a Finger Lakes Instrumentation CCD was used, model number: CM9-OE), a Sodium Lamp, a telescope, fibre optic cables, a stand for the CCD and a box to protect the whole arrangement so that no background light gets into arrangement.

Figure 5 The setup of the spectrograph for measurements of the Sodium and Fraunhofer Lines
Triax
180 specifications[2]: (for
1200 groves/ mm grating) [10]
|
Focal Length |
0.19 m |
||
|
Aperture |
f/3.9 |
||
|
Resolution |
0.3 nm |
||
|
Dispersion |
3.53 nm/mm |
||
|
Accuracy |
Figure 6 - Triax 180 |
||
|
Step Size |
0.06 nm (nominal) |
||
|
Stray Light |
1 x 10-5 <20 nm from 632.8 nm laser line |
||
|
Optical Layout |
Corrected Cross Czerny Turner |
||
|
Magnification |
1.00 |
||
|
|
185 nm to far Infrared ( with appropriate gratings) |
||
|
|
0-1400 nm |
||
|
Flat Image Field |
30 mm x 12 mm |
||
|
Slits |
Motorised: 0-2 mm in 2 µm steps or Motorised: 0-7 mm in 6.35 µm steps or Interchangeable fixed slits |
||
|
Dimensions |
230 (W) x 260 (L) x 320 (H) mm |
Experimental
Procedure
Program Development
The first problem that needed to be addressed in the development of the program would be what mode of communication to use. The RS-232 mode was chosen over the IEE488 mode (see theory section), this will allow easy communication via the com port of the computer. The boot sequence then needed to be wrote, this will allow communication of the functions of the spectrograph (see appendix 2 for C++ code).
Boot Sequence (see figure 7):
1) Setup communication to the spectrograph via RS-232 mode.
2) Send “<space>”: the response from the spectrograph will be “*” if this is the first time power up or after a re-boot.
OR
WHERE AM I command “<space>”, true if the spectrometer controller has already been started; in this case the response will be either “B” (for Boot) or “F” (for Main) depending on what the previous state of the spectrometer controller was.
3) Then have to wait 0.5 seconds before sending any more information.
4) Flush the input buffer
5) Send the decimal value “<247>”
6) Send “<=>”
7)
Send “O2000<Null>”, this will
then transfer the control from the BOOT to the MAIN program. “<MAIN>” is
sent and then have to wait 0.5 seconds.
8) Initialize the mono and get initial settings from the user.
9) Main Program Code
The full boot sequence is shown in figure 7 which is the flow chart of operations that need to be followed to get the spectrograph to boot-up.
Once the boot sequence was executed then this would allow the main program to be initiated. The boot sequence does not need any user input so all that is required is for the user to click an activate button (figure 6).


Figure 7 - The spectrograph boot-up sequence
Main Program Code
Since Visual C++ was being used then this allowed a work space to be setup; this allows the design of the program to be easily designed and will allow the functions that are wrote in the main part of the program (see appendix 2) to be easily activated by clicking of buttons.
The functions that the Triax used
had to be then placed into the program so when a command
was sent from the interface then the program
would send the correct information to the spectrograph (see appendix 3 for
listing); these functions would later be called into by the interface when they
were used.

The interface itself then had to be created for the main program; this had to allow text to be input so that it could be used to easily set the spectrograph to the required wavelength. Firstly the layout of the graphical user interface was decided (see figure 8), including what type of input box would be used for each element of the program. For the choosing of the grating to use it was thought best to use radio boxes which are all grouped together, which will only allow one to be chosen at a time. The input of distances, i.e. wavelength and slit width was done by a text box which can have its value stored into the memory of the computer and sent to the spectrograph (the spectrograph is programmed to understand wavelengths in nanometres and slit width in steps, 1 step = 12.5 micrometres). Once all the buttons had been designed the clear function had to be setup so that all the information the user has typed in the program can be reset to a default value (see appendix 4). The only part of the interface left to setup is the status box which displays if the spectrograph has been set and what to, this is a useful feature as it is possible to see what the setting of the spectrograph are without having to remember the values.
Measurements
Once the program was fully developed and all the debugging of the program was completed, the spectrograph was then able to be used for measurements. The spectrograph was setup (see apparatus) inside the light protective box, this is important as the background light would interfere with the experiment as there would be spectral lines observed from the lighting.
Once inside the box, the CCD camera had to be placed in position so that it was perfectly level with the Spectrograph and that the CCD was at the focal point of the spectrograph; this was very hard to accomplish and would be a cause for errors in the results obtained. The CCD was connected to the PC with Maxim DL on and then was cooled down to an approximate temperature of -20şC. The protective box was the sealed up using tape so that no light could enter through the corners of the box and in points where the cables to the spectrograph and CCD camera go into the box. There was only one place in which light could enter the spectrograph and that was via the entrance aperture of the spectrograph.
The spectrograph had to be first setup with the Sodium lamp so that the calibration of the images could take place; this would allow the number of pixels per nanometre to be calculated and then allow us to calculate the position of certain dark lines in the solar spectrum. The Sodium lamp was chosen as the distance between the two prominent spectral lines of Sodium is well know; they are at: 588.9950nm and 589.5924nm [3], which is a difference of only 6 Ĺ.
Once the images of the Sodium D-lines where taken they could then be analysed in Spectra PC; this is a program which allows a cross section of the image to be taken and allows the intensity of the light (the number of photons) to be plotted against distance across the image (in pixels). This allowed accurate results to be taken as the peak intensities of the lines could be found and so the calibration could be achieved.
Now that the calibration of the CCD had been done it was then possible to move on to the main aim of the experiment which was to take an image of the solar spectrum and find the Fraunhofer lines. The equipment was in the same configuration as for the images of the Sodium lamp except for instead of having a Sodium lamp as the light source the Sun was the source. The image of the Sun onto the slits of the spectrograph was achieved by using a refracting telescope which was aimed at the Sun with optic fibres placed at the focal point of the telescope. The optic fibres where then placed so that they were shining on the slits of the spectrograph. Once protected from the background light allowed the image of the solar spectrum to be taken, this required a longer exposure of the CCD since the light through the optic fibres was not as intense as the light produced from the Sodium lamp.
Again the images where analyzed using Spectra PC which gave a plot of the Spectrum and so the Fraunhofer lines could be easily detected. Again the Sodium lines in the spectra where found and seen if they were in the expected position, if they were (within errors) then this would mean that the Spectrograph was operating as expected.
Results
From the design aspect of the computer program the result was that there was a fully functional program that seemed to operate the spectrograph perfectly, without any problems. However this would have been useless if the spectrograph did not produce any accurate images. The results found from the measurements part of the project are below.
Firstly the sodium lamp was used to check that the spectrograph was setup correctly before the images of the solar spectrum was taken.

Figure 9 Na D-Lines at 590nm
Figure 9 shows the two Sodium lines, this was with the spectrograph set at a wavelength of 590nm. The slit width was approximately 25μm and the exposure time for the camera was approximately 0.1 seconds. The grating used was 1200 grooves/mm.

Figure 10 - Intensity against Pixel (distance) plot of Sodium D-lines
Figure 10 shows a plot of the intensity of the photons at each point across the spectrum; the two peaks are at values of 73 pixels and 82 pixels (produced by using Spectra PC). So the two peaks are 9 pixels apart.
The spectrograph was then setup so that the solar spectrum could be taken (see experimental procedure):

Figure 11 - The Solar Spectrum taken at 400nm
Figure 11 shows the solar spectrum, this was with the spectrograph set at a wavelength of 400nm. The slit width was approximately 25μm and the exposure time for the camera was approximately 60 seconds. In this case the grating that was used to produce this image was the 300 grooves /mm.

Figure 12 - Intensity against Pixel (distance) plot of the Solar Spectrum
Figure 12 shows a plot of the intensity of the photons at each point across the spectrum; the two there are many troughs where the Fraunhofer lines are, the two most obvious are what are believed to be the Sodium lines, these occur at 338 and 350 pixels. (produced by using Spectra PC). So the two Sodium peaks where 12 pixels apart.
Errors
In this experiment it is quite hard to get a numerically value for the errors in the measurements this is due to the equipment being used. The major problem was that the spectrograph did not have a mount for the CCD camera being used, so not only was it difficult to get the camera to the focal point of the Spectrograph, which caused the image not to be of the greatest resolution, but also it meant that it was difficult to get the camera into a position where it was in the central point (horizontally and vertically) of the exit aperture. This definitely caused there to be errors in the measurements. With the images being slightly rotated and since the resolution was slightly lost then the peaks will not be as clears as possible, so it was believed that the peaks associated with the spectral lines could easily be at a position of ±1 pixel.
Discussion and
Interpretation
It was found that in the case of the Sodium Lamp that the two peaks where 9 pixels ± 2 pixels apart, so this meant that the calibration of how many pixels per nanometre could be calculated:
Since the two Sodium lines in question are 0.6 nm apart and the pixel distance apart is known to be 9 pixels ± 2 pixels then this leads to there being 0.067 nm per pixel ± 0.02 nm per pixel.
This can then be compared with the values obtained for the solar spectrum, in this case the two Sodium lines where 12 pixels ± 2 pixels and within the errors this can be found to be similar to what was obtained with the calibration of the Sodium lines, in this case there is 0.050 nm per pixel ± 0.02 nm per pixel. So within errors the two values agree, this shows that the Spectrograph was calibrated properly and that the image obtained of the solar spectrum is accurate and that the Fraunhofer lines on the image are quite accurate.
It was expected that the two images may not be exactly the same as there was considerable problems in getting a good image of the Sun as the only method to get a good image was via the optic fibres and this lead to light leakage into the experiment, however within the errors of the measurements the two values agree.
There were horizontal lines
produced on the images (see figure 10), this seems to be due to the edge of the
slits of the spectroscope not being flat, possible some dust on the edge of the
slits causing this pattern in the data; this does not interfere with the
results taken.
The solar spectrum with the Fraunhofer lines and possibly some atmospheric absorption lines is quite clear, this may lead to these atmospheric lines being identified and then being able to discover what atomic transition is responsible for these spectral lines. Since the solar spectrum was taken quite accurately this may lead the spectrograph being fitted on to the University telescope and being used to take spectra of other stars in the sky, again to find the chemical composition of the star via these dark absorption lines in the spectra of the stars.
Conclusion
From the results obtained it would be possible to say that the computer interface that has been written for the spectrograph seemed to work well. The results we obtained were consistent with what we believed would occur, the two Sodium lines were observed at the correct wavelength, when the spectrograph was set to there wavelength then they appeared in the images which indicates that the spectrograph was moving to the correct position. Also the solar spectrum image produced was what was expected and since the sodium lines where in the spectrum then this allowed the two to be compared. The errors associated with the measurements taken can be reduced if this was repeated, this could firstly and most importantly done by building a proper mount for the CCD camera based on the exit aperture of the Triax 180; this would allow the images to be resolved properly as the CCD would be fixed at the focal point, it would also reduce the problems with the images being rotated. Another way in which errors could be reduced would be by having a better light protective case for the arrangement; obviously if this was being used on the University telescope at night then this would not be strictly necessary.
In conclusion the experiment was a successful one; the aim of writing a working computer controlled interface was accomplished. This was verified by observing the solar spectrum; this lead to the experimental evidence needed to show that the computer controlled interface had in fact worked as it was designed to.
Acknowledgements
As always there are a few people whom I would like to thank
for the help during this project. The below are the people I would like to
thank:
Mr Jordan Stewart (Laboratory Partner)
Mr Colin Bull (Laboratory Par