• No results found

EXPERIMENTS 49 devices using MAX. This way, possible interface communication errors were

Measuring CO 2 in air

3.2. EXPERIMENTS 49 devices using MAX. This way, possible interface communication errors were

taken care of initially so that they would not be a problem in a later more complex program.

The LabVIEW VI data acquisition procedure made for this project can be divided into three stages. First, the devices must be initialised and the ini-tialisation parameters set. Second, the data acquisition commences, i.e. the LD/TC controller performs the temperature sweep, and the LIA must record the sound signal. Third, the data is read from the LIA and plotted, and all the devises are turned off and closed.

The waveform generator uses the Agilent 33XXX series library. In the initial-isation VI the VISA resource name, frequency, waveform function, amplitude and DC offset is set. A case structure ensures that an acceptable amplitude input is given even if the user sets an amplitude that is out of range, that is less than 0.01V ppor larger than 10 V pp. Figure 3.9 shows the initialisation of the waveform generator.

Figure 3.10 shows the initialisation VI for the LIA. The VISA resource name, sensitivity, time constant, sampling frequency and total scan time is taken as input. One can also choose between internal and external reference input, but this option is always set to external. The inputs are combined in a com-mand string and sent to the LIA using generic VISA-GPIB communication.

The traces the LIA should put in the buffer is also defined as the amplitude

”R”, the phase ”θ” and the analogue input 1 and 2 (not used).

Figure 3.11 show the initialisation of the LD/TC controller. The tempera-ture and current limits have already been set manually so they do not need to be set using LabVIEW. The VISA write function is used to set the tem-perature and turn the temtem-perature controller on. Then the same function is used to set the current and to turn the laser on. A for-loop forces the current commands to wait to be executed until after the temperature has properly stabilised. A wait command is added after the laser has been turned on because the laser turns on 3 seconds after the command is given, and the temperature should have time to stabilise after the laser had been turned on.

The wait command after the for-loop is for redundancy. The command for turning on the laser has been placed in a flat sequence structure to ensure that an attempt to turn the laser on will not be executed until the tempera-ture controller is turned on and stable.

This concludes the initialisation part of the program. It is time to start the

50 CHAPTER 3. MEASURINGCO2 IN AIR

Figure 3.9: Initialising the waveform generator.

Figure 3.10: Initialising the LIA.

3.2. EXPERIMENTS 51

Figure 3.11: Initialising the LD/TC controller

Figure 3.12: Main section of VI where temperature sweep is performed and LIA data is read.

temperature sweep and for the LIA to start reading data. In figure 3.12, this section of the program is shown. Immediately after the LIA is set to start reading data, a timed loop is entered. The temperature is set to increase so that the desired temperature range will be swept during the selected time.

For each increase in temperature, the LIA stores one data sample. The dif-ference between the set and the actual temperature is monitored to ensure that the TC can keep up with the desired temperature changes. If it doesn’t, the temperature range must be decreased or the total scan time must be increased. The period of the timed loop must be sufficiently long for the commands in the loop to have time to execute. This means that the sam-pling frequency can not be too high. In the LIA function on the right, the data recorded by the LIA is placed into the LIA buffer and read by the PC.

The data is also stored in a 2D array and presented in a XY graph.

When the program terminates, the laser is turned off, and subsequently the TC is turned off and the communication is closed. The data is finally written to file.

In addition to the parts mentioned above, the VI also includes a conver-sion procedure from temperature to wavelength based on the data given in the data sheet of the laser. In order to calculate the laser wavelength, the

52 CHAPTER 3. MEASURINGCO2 IN AIR temperature and current must be known. During amplitude modulation, the current is simply the maximum current when the laser is on. During phase modulation, the current is the base current without the added modulation amplitude, since the modulation amplitude oscillates around zero. A Lab-VIEW case structure is added to determine which modulation is used. The current and the temperature array is input into a Mathscript procedure. The wavelength is 2002.000 nm at 40o C and 40 mA. It changes 0.046 nm/mA and 0.160 nm/oC. higher than these conditions. Equation 3.4 show how the wavelength is calculated.

λ = 2002.000 + (I−40)∗0.046 + (T −40)∗0.160 (3.4) I is given in mA and T is given in oC. λ is given in nm. Figure 3.13 shows a plot of this equation for a range of currents and temperatures.

Figure 3.13: Wavelength variations with temperature and current.

3.2. EXPERIMENTS 53