The theory and procedure are described in this paper: J. Brody and M. Brown, Am. J. Phys. 85, 582 (2017) https://doi.org/10.1119/1.4983649
You can download the Arduino software here
and the latest version of Python (3.6?) here.
Then, the pyserial library has to be installed separately by
opening the Anaconda Prompt (as administrator, if it gives you that option) and typing "conda
install pyserial".
To be able to generate real-time plots, open Spyder
(installed with Anaconda). Under the Tools menu, select
Preferences. Highlight IPython console, then select the
Graphics tab. Set the Graphics backend to Automatic.
If you have a single temperature sensor, use this Arduino sketch
and this Python
script.
If you have three temperature sensors at different positions on a
rod, use this Arduino
sketch and this Python script.
How to wire the TMP36GT9Z sensor to the Arduino: Here's the data
sheet. The middle pin is wired to one of the
Arduino analog inputs (use A0 if you have one sensor; use A0, A1, and
A2 if you have three sensors). The other two pins are ground
and 5 V (both provided by the Arduino). CAUTION:
It's extremely important not to reverse these two pins, or
the sensor will get very hot and burn your fingers!
How to use the Arduino sketches: Plug in the Arduino UNO.
Go to the Start menu (or equivalent) and find the Arduino in
the list of Devices and Printers. Note the "COM" port number
of the Arduino. Open the Arduino software. Under
Tools, select the appropriate Port number. Open and upload the
Arduino sketch. When it's running on the Arduino board, the
TX LED will flash every 5 s. You can open the Serial Monitor
to view the data (time in milliseconds and temperature in Celsius).
Close the Serial Monitor before running the Python script.
How to use the Python scripts: Open Spyder to run the
scripts. There are a lot of parameters you may need to change
(all material parameters are in mks units):
- "ta" is ambient temperature in Celsius. (The
sensors have a precision of about 0.1 degree, but an accuracy as poor
as +/- 3 degrees. To calibrate the sensors, the script
adjusts temperatures such that initial adjusted temperature is ambient
temperature.)
- "minutes" is how long you want to take data. For
sensors within an inch of the bottom of the rod, 10 minutes is
plenty. Higher up the rod, 15 or more minutes may be necessary to reach steady-state or even to see signficant cooling.
- a=serial.Serial('COM12',9600) must be changed to specify
the correct port number of the Arduino.
- x1, x2, and x3 are the distances of the sensors from the
bottom of the rod.
- l is the length of the rod.
- p is the perimeter of the rod, calculated by default from
the width (called "side"), assuming square cross section.
- a is the cross sectional area, calculated by default from
the width, assuming square cross section.
- rho is the density of the rod, which you can measure or
look up for the material.
- c is the specific heat, which you can estimate by looking
up typical values for the material.
- terms is the number of terms in the truncated infinite series.
I often find that 10 is adequate.
Open an IPython console. Start running the Python script at
the same time you immerse the bottom of the rod in ice
water. (time=0 has to be the instant the rod contacts the ice
water.) A real-time plot of the data should appear in a
separate window. When the data acquisition is complete,
fitted theoretical curves will appear in the figure (you may need to
zoom in to see them if the fits are really good), and the fitting
parameters (alpha, m, and h0) will be shown in the console.
If the data looks decent but the fit fails, you can try
adjusting the bounds and initial guesses for the fitting parameters.
If you have data in Excel, you can import it into Python and fit it
with this
script.
If you have any questions or suggestions, please don't hesistate to email me.