Microscope Environmental Chamber

Appendix A:

LabVIEW Code

All coding for this project was done in the LabVIEW coding environment by National Instruments (NI), due to the use of a NI USB DAQ device which is natively compatible with this program.

Front Panel (User Interface)

In LabVIEW, the front panel is the user interface. This is what the average user will observe when initiating and running the program. All user controls and desired functionality is interacted with through this panel.

For the Microscope Environmental Chamber front panel, the following input options are available:

  • Temperature Unit – user can select either degrees Fahrenheit (°F) or degrees Celsius (°C). Sorry Kelvin!
  • Desired Temperature – user can input a desired temperature (this should be equivalent to the culturing temperature of the cells to be observed). Note that desired temperature must be greater than ambient temperature, and should not exceed 50°C (this is outside the range of calibration)
  • Desired CO2 Concentration (%) – user can input the desired percentage of carbon dioxide to sustain in the chamber. As with temperature, this value should be the specified value for culturing the cells to be observed. This cannot exceed 20% (range of sensor).
  • How Often Do You Want to Take Data–user can input the rate at which the program should save data (this will also be the rate at which it displays graphical data). This is in samples/hour (so inputting 60 will result in one sample every minute). Decimals are acceptable (i.e. inputting 0.5 to collect one sample every 2 hours).

The numerical displays, graphs, and LEDs will all update automatically as the code runs.

There are no custom errors which would appear during running of the code, so any errors which surface would be searchable through Google or through National Instruments/LabVIEW digital documentation.

Instructions for use of code are included in the primary manual document.

Back Panel (Block Diagram – Code)

The block diagram is the code/logic of the program. It takes in user input data and performs the necessary operations of the chamber through sensor input and relay actuation. Three primary blocks comprise the code: the Setup Block, the Control Block, and the Data Output Block.

Code – Setup Block

The Setup Block is the initial state of the code. This allows the user to continually update their desired setpoints until starting control, by placing the code within a while loop. Additionally, property nodes are used to automatically set the y-scales of the graphs on the front panel, as well as the y-axis title for the temperature graph (customized to temperature unit). The upper case structure converts temperature into either Celsius or Fahrenheit both for display and control purposes.

Additionally, this portion of the code determines the start time of the experiment, as well as the location of the desktop directory (both for purposes of error messages through .txt files).

Finally, the lower case structure double-checks to ensure that the user wants to start control, and thus prevents accidental initiation of the Control Block.

Control Block

The Control Block is the bulk of the code, which drives the actual controlling of the chamber’s environment. It takes in the setpoint data from the Setup Block, and utilizes this to determine how/when to actuate the control devices.

The empty array in the very left at the top is used to initialize all data arrays, in order to wipe any previous data from the arrays (so that restarting should not result in data arrays including information from a previous run). The addition of 0.25 to the setpoint %CO2 is to compensate for the method of control (which tends to result in an error bias lower than preferable).

As with the Setup Block, all code (excepting the empty array) is within a while loop, which will only end when the user specifies so. (Also similar to the Setup Block, there is a case structure (bottom center, small) which confirms the user wants to end control to prevent accidental ending).

The code logic starts with the DAQ assistant in the upper-left corner, pulling the data from three thermocouples and the CO2sensor. More thermocouples/sensors can be added if desired, or sensors can be removed if there is some sort of issue or testing desired to be done.

This sensor data is passed into a 1Hz lowpass filter to remove noise, and then converted from waveform data type to an array of doubles. The portion of the array containing the thermocouple data is segmented off and the values averaged and converted into the proper unit for comparison to the setpoint value. The portion of the array containing the CO2 sensor data is also segmented off for comparison to setpoint.

Both types of sensor data are fed into their own two case structures: one to establish if the sensed value is out of range high, and one to determine if it is out of range low. For the thermocouples, 1% low or 3% high from setpoint is considered out of range, and for the CO2sensor 5% different is considered out of range. This is due to the precision of the two methods of control (peltier cells vs. gas valves).

Control is based on pulse width modulation (due to the inability to control actual amount of power supplied). Therefore a range is given based on whether the sensed value is just out of range, or at least twice the out of range percentage (i.e. %CO2 being 2*5% = 10% lower than setpoint). The function between these two values is linear. The code will actuate the given control device for the specified amount of time, then de-actuate and wait for a predetermined amount of time. This is to allow the environment to normalize somewhat and give the sensors time to detect the changes in the chamber environment due to controller actuation. The only exception to control is the case structure for temperature being too high, as the system cannot actively cool the chamber. However, since only heightened temperatures will be used with this device, the cooling is done simply through loss of heat to the ambient environment.In addition to the controlling, the case structures also have nested case structures. These determine whether the given condition has been out of range for at least 15 continuous minutes. If so, it will display a message on the front panel detailing this, which can be reviewed by the user when they come in to either check on the system or conclude control. (This warning function is included in temperature too high).

Note that ideally this would instead send an email alert to both the user and Dr. Bailey instead of displaying the error on the front panel. LabVIEW has this functionality, however RIT’s server setup and permissions (or lack thereof) disallow this from functioning well. If future modification is desired to allow this change, then Bill Finch or John Wellin may be of assistance.

The Boolean feedback loops around each control case structure are in place to retain information about control time, wait time, and comparators in order to allow pulse width modulation of the controlling functions.

In addition to the controlling code, the Control Block also determines when to save data based on the user’s specified frequency of data collection. There is a block of code which utilizes an array of rounded-down numbers related to sample number in order to determine when to save data, and the center-top case structure includes a function to save data continually to a simple file which can be opened in excel. If the file is open while the program attempts to write to it however, LabVIEW will throw an error and require user input to continue. The output of the case structure feeds into the graphs, and ultimately to the Data Output Block.

Data Output Block

The final code block is the Data Output Block. This block de-actuates all three control relays, as well as converting all saved data into signals which can be written to an Excel file. This block is not in a while loop, as it only executes once to save data and turn off the relays. Upon completion of these tasks, the code will end.