A simple sketch to demonstrate an interface between an Arduino and MATLAB, specifically for data-logging in MATLAB. This particular example utilizes this for creating a thermometer.
Since we are using MATLAB to log (and maybe further manipulate) data, we need to use scripts on both sides. The Arduino script (Serial_matlab_thermocouple.ide) configures it to read temperature from the thermocouple (interfaced with an amplifier), and print it (in degree C) on the serial port. The MATLAB script (MATLAB_thermocouple.m) timestamps this incoming data, and stores it in an array. The codes are set to read, transmit and log data in an infinite loop, and Ctrl + C should be used in MATLAB to stop data logging. A simple circuit can be used to use a pushbutton to print something else on the serial port, which MATLAB recognizes as a break signal.
-
Thermocouple amplifier MAX31855 To get cleaner, more accurate signal. Highly recommended
-
K-junction thermocouple Investing in a glass-braided one is recommended if used for high temperature applications
Assemble the circuit according to the following schematics:
The MAX31855 is factory calibrated. See datasheet for calibration notes. Alternatively, a calibration curve is usually obtained by linearly fitting readings from boiling and ice water.
Something like a wifi module with arduino can unleash this simple setup into a wireless thermocouple, say to be used in sealed experiments!