Lab Report
Lab Report
Lab Report
Orientation
The ideal gas equation of state (pV = mRT) provides a simple relationship between
pressure, temperature, mass, and volume for gases at relatively low pressures and high
temperatures. This experiment illustrates the application of the ideal gas equation of state
to relate the properties of air contained in a rigid vessel with heat addition.
Assignment
A pressure vessel with a volume of 1 liter has been instrumented with a pressure
transducer and thermocouple to measure the gage pressure and temperature, respectively,
of the air inside the vessel. The pressure transducer produces a voltage signal that can be
related to the gage pressure in the cylinder by a calibration curve that is supplied with the
instrument. Note that atmospheric pressure in Blacksburg is approximately 13.6 psia. The
calibration curve for the pressure transducer is given by the following equation:
p = 4.3087(V·V) - 13.1176V + 10.7276
where V equals the voltage output (volts) from pressure transducer, and p equals the
absolute pressure (kPa).
The thermocouple in the pressure vessel is connected in series with a second
thermocouple that is located in an ice bath that provides a reference temperature. The
thermocouple pair produces a voltage signal that is related to the temperature (T) of the
air in the pressure vessel by the following expression:
T = Tref + V/S
where Tref equals the ice bath reference temperature (0°C), V equals the voltage (volts)
measured across the thermocouple pair, and S equals the thermocouple constant, 42.4
µV/°C.
A signal processor displays and records the voltage signals from both the pressure
transducer and the thermocouple during the course of an experimental trial. In addition,
the signal processor records the data in a data file that can be downloaded to other
programs for data analysis and plotting.
The steps you should follow to carry out the experiment are as follows:
1. Turn on the signal analyzer. Identify the location of the "start" and "pause"
buttons.
2. Make sure the voltage ranges are appropriate. The signal analyzer should display
two different plots of voltage versus time. The first should show the voltage
coming from the pressure transducer; the second should show the voltage coming
from the thermocouple pair.
3. Check to verify that the hot plate is operating.
4. Press "start" to begin reading data, and then heat the pressure vessel by placing it
on the hot plate. Continue heating the vessel until the pressure reaches
approximately 400 kPa.
5. Save the data appearing on the display onto a disk (ask the T.A. for help). Choose
a meaningful name such as "LabTemp.dat" for the files. You will have to save
two sets of data--one for temperature and another for pressure.
6. Using the two equations above, and appropriate software, determine values for
pressure and temperature from the recorded voltage data.
Analysis
Using the initial values of the measured pressure and temperature, the volume of the
vessel, calculate, from the ideal equation of state, the mass of air in the vessel. Assuming
the volume and mass are constant during the heating process, calculate the temperature of
the air (from the ideal gas equation) for each of the pressure values--remember that the
recorded values of the pressure are absolute. Plot the experimental and calculated
temperatures as a function of the measured pressure. Clearly label the graphs. Compare
the experimental results with the theoretical results. What might be responsible for the
differences?
Report
Prepare a brief report (1 - 1.5 pages, plus the graph and appendices) that summarizes your
work. Your report should include the following items:
Title
Introduction
Procedures
Results and Discussion
Conclusions
Appendices
Prepare the report with a word processor and the plots with plotting software.
>
Design of a Temperature Measurement and Display System
Using the 68HC11 Microcontroller
>
>
Introduction
>
This report presents a design of a temperature measurement and display system that
incorporated the Motorola 68HC11 microcontroller, simply referred to here as the HC11.
This design was a valuable experience because similar temperature measurement and
display systems often are used in buildings and vehicles [Spasov, 1996]. The design
presented in this report made use of the HC11's analog-to-digital (A/D) converter and the
serial subsystems. As shown in Figure 1, the design included a temperature sensor
connected to one of the HC11's A/D input pins on Port E, and light emitting diodes
(LEDs) connected to Port B. These LEDs acted as temperature indicators. Additionally,
the design included a connection between the HC11 and a remote personal computer
(PC). This connection served to send messages regarding temperature to the PC. An
assembly software program developed for this design performed various functions for
using the added hardware.
The design had two main objectives. The first objective was to use the HC11 to measure
temperature. Included in this objective was the task of connecting the temperature sensor
and the LEDs to the HC11. Also included in this objective was the task of designing
software to do the following: initialize the A/D converter and serial subsystems; control
the measurement and storage of temperature in a RAM variable called TEMP; and
control the display of temperature on the LED outputs. The second objective of the
design was to use the HC11 to indicate if the temperature went outside of prescribed
limits: below 20 degrees Fahrenheit or above 90 degrees Fahrenheit. Included in this
objective was the task of connecting the HC11 to a remote PC terminal through an RS-
232 connection. Another task within this objective was developing software to initialize
the serial subsystem. The final task of this objective was to create subroutines for the
software program of the first objective to have the HC11 send a message to the PC if the
measured temperature went outside the stated limits.
This report first presents the procedures for and assessment of the design to have the
HC11 measure temperature. Then the report discusses the procedures for and assessment
of adding a serial output to the HC11 design to communicate whether the temperature is
outside of prescribed limits.
Figure 1. Temperature measurement and display system developed for the Motorolla 68HC11
microcontroller, which is attached to a universal evaluation board (EVBU).
>
>
Connecting a Temperature Measurement Circuit to the HC11
>
Connecting a temperature measurement circuit to the HC11 microcontroller involved
both hardware and software. Hardware was added to control the measurement and
display of the temperature. Software served to control this added hardware. In performing
the testing and design for this part of the project, my laboratory partner and I divided the
work in the following way. My partner assumed the lead role in connecting the hardware,
and I assumed the lead role in writing the programs. Although one of us had a lead role in
performing either the hardware or the software, we worked collaboratively in checking
both the hardware and software and in troubleshooting any problems.
>
Procedures for Design. The hardware for the temperature measurement circuit included
both a temperature sensor attached to Port E and LEDs attached to Port B. The circuit,
which is shown in Figure A-1 of Appendix A, was designed according to the
specifications obtained from the Computer Engineering Laboratories web site for ECPE
4535 [Lineberry, 2001].
Within the circuit was an LM3911 temperature controller integrated circuit (IC), the
output of which we connected to a non-inverting op-amp. The output of this op-amp
attached to the HC11 A/D input pin E2 through a 1000-ohm resistor. The circuitry was
scaled so that 0 volts out corresponded to 0 degrees and 5 volts out corresponded to 110
degrees. To each of the output pins of Port B, we connected LEDs using a 74HC244
buffer IC and 330-ohm current limiting resistors, all of which are shown in Figure A-1.
The LEDs were located in the breadboard area of the trainer kits.
To control this added hardware, we programmed the HC11 following the pseudo code
and program listing given in Appendices B and C, respectively. The program shown in
Appendix C consisted of three subroutines that were called from the main program
(Main). The three subroutines were named Startup, GetTemp, and SetDisp. The Startup
subroutine was used to enable the A/D converter subsystem. First the A/D charge pump
was powered up by setting bit 7 of the Option register. Then, bit 6 was cleared so that the
charge pump used the system E-clock [Spasov, 1996]. After a 100 microsecond delay to
allow the charge pump to stabilize, the control word $22 was written to the ADCTL
register to start continuous, single-scan conversions on pin E2 of Port E.
The subroutine GetTemp was used to input and scale the analog voltage from the
temperature sensor circuit. The register ADR3 held the result of the A/D conversions,
which was treated as an 8-bit binary fraction between 0 and 1. This value was loaded into
accumulator A and then multiplied by a scale factor of 110 using the MUL instruction.
The result of this multiplication was a 16-bit number between 0 and 110, with an 8-bit
integer portion stored in accumulator A and an 8-bit fractional portion stored in
accumulator B. The integer portion of the temperature was then stored in the RAM
variable TEMP.
The subroutine SetDisp controlled the lighting of the LEDs connected to Port B. The
amount of lighting was based on the present value of TEMP. First, TEMP was loaded
into accumulator A and compared with the value 20, the designated cut-off for low
temperature. Accumulator B was cleared to zero and represented the initial value to be
written to Port B. If the value in accumulator A was greater than or equal to 20, then the
value in accumulator B was shifted one position left and incremented, and 10 was
subtracted from accumulator A. The process then repeated itself as long as the value in
accumulator A was greater than or equal to 20. An abbreviated form of this process
appears in Figure 2 (the complete process appears in Appendix C). After the number of
LEDs to turn on were determined, as shown in Figure 2, the number of bits indicated by
the count value in accumulator B were set high on Port B beginning with bit 0 [Motorola,
1991].
Figure 2. Flowchart illustrating the determination of the number of Port B bits to enable for the
LED display.
>
>
Assessment of Design. To test the operation of the GetTemp and SetDisp subroutines,
we measured the actual temperature with a temperature probe and compared that with the
measured value represented by the LED display indicators at several different
temperature settings. Table 1 shows the results of the measurement comparison, where
the actual temperatures measured are shown on the left, and the temperatures represented
by the number of LEDs lit are shown on the right. From Table 1, we verified that the
developed hardware and software for this part of the lab were functioning properly.
Overall, this section of the laboratory went smoothly.
15°F 0
28°F 1
33°F 2
56°F 4
110°F 8
>
>
Adding Serial Output to the HC11
>
This section presents the addition of four subroutines to the existing software developed
in the previous section. The added subroutines, listed in Appendix D, were called InitSCI,
SendChar, SendMsg, and CheckLimits. The InitSCI subroutine initialized the serial
subsystem of the HC11 so that it could communicate with the host PC at 9600 baud
[Spasov, 1996]. This initialization was done by writing control words to the BAUD,
SCCR1, and SCCR2 control registers in the HC11 as shown in Appendix C.
In performing the testing and design for this part of the project, my laboratory partner and
I divided the work in the following way. My partner assumed the lead role in connecting
the hardware, and I assumed the lead role in writing the programs. Although one of us
had a lead role in performing either the hardware or the software, we worked
collaboratively in checking both the hardware and software and in troubleshooting any
problems.
>
Procedures for Design. The first subroutine, SendChar, was added to send a single data
byte from the HC11 to the remote PC terminal. The data byte to be sent was contained in
accumulator A. After waiting for the TDRE bit in the SCSR register to be set, indicating
that the HC11 is ready to transmit another byte, the value in accumulator A was written
to the SCDR register to begin the transmission [Motorola, 1991].
The second subroutine, SendMsg, used the SendChar subroutine to write character strings
to the remote PC terminal. Before calling SendMsg, the X index register was set to point
to the beginning of the character string to be sent. The SendMsg subroutine then sent out
the string by calling SendChar for each character until the NULL character was reached,
which marked the end of a string.
The third and final subroutine, CheckLimits, was added to the existing software program
to check the temperature range. The subroutine CheckLimits called SendMsg to print the
following message if TEMP was less than 20 degrees Fahrenheit: "Temperature is very
low." If TEMP was greater that 90 degrees Fahrenheit, CheckLimits called SendMsg to
print the following message: "Temperature is very high." If TEMP was between 20 and
90 degrees Farenheit, CheckLimits called SendMsg to print the following message:
"Temperature is acceptable." A flag variable called FLG ensured that the messages were
not repeatedly sent for each entry into the very hot, very cold, or acceptable temperature
regions. FLG was set to zero if TEMP was between 20 and 90 degrees, one if TEMP was
less than 20 degrees, and two if TEMP was greater than 90 degrees.
>
Assessment of Design. While developing the design presented in this section, several
mistakes and difficulties were encountered. The initial setup of the serial subsystem of
the 68HC11 involved some troubleshooting. We also had problems with sending the
alarm messages more than one time because a flag variable was not set. The diagnosis
and solutions to these problems are discussed in this section.
Initially, the serial writes from the 68HC11 to the host PC did not work properly because
the SendChar routine did not check the TDRE bit before writing to the SCDR register.
This caused characters to be dropped when sending a message. We also had a problem
sending out messages using SendMsg because we did not terminate the message strings
correctly with the NULL zero. By adding the NULL zero to the end of the strings, the
sending of messages worked as expected.
A final problem was the output rate of the alarm messages. At first, we did not set a flag
to indicate to the program that a message had already been sent to the PC. This failure
caused messages to be continually sent to the PC terminal when the temperature was
outside of the normal operating region. This problem was fixed by making a variable
called FLG that was set as soon as the alarm message was sent and then cleared when the
temperature returned to the normal operating region.
>
>
Conclusions
>
This report has discussed the development of a temperature measurement and display
system. The objectives of this lab were to develop the necessary hardware and software
to have the HC11 measure temperature and indicate whether that temperature fell outside
of prescribed limits. Both objectives were met. By keeping track of the measured
temperature, the HC11 was able to control an LED temperature display. Also, if the
temperature became very cold or hot, the HC11 sent an alarm message to a host PC
terminal.
This lab has introduced us to the important topics of A/D conversion and serial
communications. In the lab, an A/D converter allowed us access to analog inputs of
temperature from a remote computer. Besides temperature measurement, A/D converters
have many applications in automatic control systems and factory automation. For
example, in an electric motor drive, the phase currents and flux are continually measured
by using scaling circuitry and an A/D converter input to a microprocessor.
>
>
>
Appendix A: Hardware Schematic
>
>
Figure A-1 presents the hardware schematic for the temperature circuit. The circuit was
designed according to the specifications obtained from the Computer Engineering
Laboratories web site for ECPE 4535 [Lineberry, 2001].
Figure A-1. Hardware schematic for the temperature measurement circuit designed for this lab. In
an actual report, all the connections, pin numbers, and pin labels should be shown.
Introduction
Procedures
In this experiment, air (an ideal gas) was heated in a pressure vessel with a volume
of 1 liter. Attached to this pressure vessel was a pressure transducer and
thermocouple to measure the pressure and the temperature, respectively, of the air
inside the vessel. Both of these transducers produced voltage signals (in Volts) that
were calibrated to the pressure (kPa) and temperature (K) of the air (the
atmospheric pressure for where the experiment occurred is assumed to be 13.6
psia). In addition, the theoretical temperature (K) of air was calculated as a
function of the measured pressured values (kPa).
This section analyses the results of the experiment. The experiment went as
expected with no unusual events that would have introduced error. The voltages as
measured for the pressure and temperature transducers appear in Table A-1 of the
Appendix. Also included in the Appendix are the equations used for calibrating
those voltages with the actual pressures and temperatures. These equations led to
the values of pressure and temperature that are shown the third and fourth columns
of Table A-1. From these values, a graph between temperature (K) and pressure
(kPa) was created (Figure A-1). As can be seen from the graph, the relationship of
temperature versus pressure is roughly linear.
As part of this experiment, the theoretical values of temperature were calculated for
each measured pressure value. In this calculation, which used the ideal gas
equation, the volume and mass were assumed to be constant. These theoretical
values of temperature are shown in the final column of Table A-1. From this final
column arose Figure A-2, a graph of ideal temperature (K) versus pressure (kPa).
As shown in this graph, the relationship between temperature and pressure is
exactly linear.
A comparison between the graph showing measured data (Figure A-1) and the
graph showing theoretical data (Figure A-2) reveals differences. In general, the
measured values of temperature are lower than the ideal values, and the measured
values are not exactly linear. Several errors could explain the differences: precision
errors in the pressure transducer and the thermocouple; bias errors in the calibration
curve for the pressure transducer and the thermocouple; and imprecision in the
atmospheric pressure assumed for the locale. The bias errors might arise from the
large temperature range considered. Given that the temperature and pressure ranges
are large, the calibration equations between the voltage signals and the actual
temperatures and pressures might not be precise for that entire range. The last type
of error mentioned, the error in the atmospheric error for the locale where the
experiment occurred is a bias error that could be quite significant, depending on the
difference in conditions between the time of the experiment and the time that the
reference measurement was made.
Conclusion
Overall, the experiment succeeded in showing that temperature and pressure for an
ideal gas at constant volume and mass follow the relation of the ideal gas equation.
Differences existed in the experimental graph of temperature versus and pressure
and the theoretical curve of temperature versus pressure. These differences,
however, can be accounted for by experimental error.
This appendix presents the data, calculations, and graphs from the experiment to
verify the ideal gas equation. The first two columns of Table A-1 show the
measured voltages from the pressure transducer and the temperature transducer.
Column three shows the measured values of pressures calculated from the
following calibration curve for the pressure transducer:
p = 4.3087(V·V) - 13.1176V + 10.7276
where V equals the voltage output (volts) from pressure transducer, and p equals
the absolute pressure (kPa). Column four presents the measured values of
temperature (K) calculated from the calibration curve for the thermocouple:
T = Tref + V/S
where Tref equals the ice bath reference temperature (0°C), V equals the voltage
(volts) measured across the thermocouple pair, and S equals the thermocouple
constant, 42.4 µV/°C. Finally, column 5 presents the ideal values of temperature
for the corresponding measured values of pressure. These ideal values arise from
the ideal gas equation (PV=mrt). Figure A-1 shows the graph of temperature (K)
versus pressure (kPa) for the measured case. Figure A-2 shows the graph of
temperature versus pressure for the ideal case.