User Tools

Site Tools


Controlling Temperature of the Fish Tank

Control Code

Background information

Characterizing the fish tank

  • Arduino code snippet to measure and display time, heater status and fluid temperature
  • MATLAB code (plot_heater_test.m) to automate the measurement of K.
  • Sample data for using with plot_heater_test.m to automate the measurement of K.

Additional information on MATLAB code to automate the measurement of K

The plot_heater_test MATLAB program automates the measurement of K, the slope of the temperature versus time curve. The code requires a plain text file with three columns separated by tabs or spaces. The three columns are time, heater status, and temperature. The heater status is number, either 0 or 1. A value of 0 in the second column indicates that the heater was off. A value of 1 indicates that the heater was on.

The MATLAB code uses mouse input to identify two regions of the data that will be used to create least squares line fits. The code will wait until you click on the starting and stopping points for both segments.

Two data files heater_test1.txt and heater_test2.txt are provided as sample data for running the code. Do not use the results from the sample data to specify values for your control program.

  1. Launch the code by typing plot_heater_test at the command prompt
  2. Click once at the start of the ramp in T versus t. This defines the start of the first line fit segment.
  3. Click again at the end of the ramp. This defines the end of the first line fit segment.
  4. Click once at a point where the steady state behavior appears to have asserted itself again after the heat input ramp has stopped.
  5. Click one more time a the end of the steady state behavior
temperature_control.txt · Last modified: 2019/03/06 17:15 by gerry