Typically, an individual's normal body temperature is about 37 degrees Celsius. When a body enters hypothermia, its temperature dramatically decreases below 35 degrees Celsius. In this situation, the body’s organs will slowly start to degrade in metabolic function and cardiac output and heart rate will become depressed. Likewise, in consequences, a fever, a body temperature between 38 to 42 degrees Celsius, may cause many systemic effects such as cognitive dysfunction and liver failure. In either case, it becomes equally important to have an instrument that can detect and warn the user of such drastic, pathological temperature changes. The objective of this lab is to create a digital thermometer and a Graphical User Interface (GUI) through MATLAB which will display a constant read of temperature values and warn a user when the temperature has changed from normal body temperature. In this lab, we will be creating a GUI that will display the continuous readings of a temperature sensor for later application on a human subject. The purpose of this GUI is to effectively diagnose if a person is suffering from a pathological condition regarding body temperature: fever or hypothermia. You need to accomplish the followings Milestones and Tasks: Milestone 1 – Create digital thermometer 1. Determine what circuit (if any) is necessary to read from the temperature sensor 2. Create GUI to display temperature readings and warn of dangerous changes in temperature Milestone 2: Perform experiment while subjecting the thermometer different temperatures, a pathological temperature state will trigger an Alarm, either a sound of your computer, or an external Buzzer conducted with the Arduino. Show the temperature in real time in graphic form, and play a sound if necessary.
%% Thermometer Demo
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Insets;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.ThermometerPlot;
import org.jfree.data.general.DefaultValueDataset;
import org.jfree.ui.ApplicationFrame;
% First Value of Thermometer
dataset = DefaultValueDataset((43.0));
% Generate plot object
plot = ThermometerPlot(dataset);
% Generate chart object
chart = JFreeChart('Thermometer Demo', JFreeChart.DEFAULT_TITLE_FONT, plot, false);
% Some optional Customization of the Chart
plot.setInsets(org.jfree.ui.RectangleInsets(5, 5, 5, 5));
plot.setThermometerStroke(java.awt.BasicStroke(2.0));
plot.setThermometerPaint(Color.lightGray);
plot.setSubrangeInfo(ThermometerPlot.NORMAL, 0.0, 55.0, 0.0, 100.0); % from 0 to 55 Normal
plot.setSubrangeInfo(ThermometerPlot.WARNING, 55.0, 75.0, 0.0, 100.0); % from 55 to 75 Warning
plot.setSubrangeInfo(ThermometerPlot.CRITICAL, 75.0, 100.0, 0.0, 100.0); % from >75 to 100 Critical
% generate Chart Panel
cp = ChartPanel(chart);
% New figure
fh = figure('Units','normalized','position',[0.1,0.1, 0.2, 0.4]);
% ChartPanel with JControl
jp = jcontrol(fh, cp,'Position',[0.01 0.07 0.98 0.88]);
% Matlab-Slider
sh = uicontrol(fh,'Style','slider',...
'Max',100,'Min',0,'Value',43,...
'SliderStep',[0.01 0.01],...
'Units','normalized', ...
'Position',[0.01 0.01 0.98 0.05], ...
'UserData', {plot}, ... % save the handle of the plot-object to Userdata to change values
'Callback',@sh_callback2);
% Slider Callback for Changing Temperature
function sh_callback2(varargin)
hObject = varargin{1,1};
% disp(['Slider moved to ' num2str(get(hObject,'Value'))]); % diplay stuff in Matlab Command Window
% Get Handle from java plot object
plot_cell = get(hObject,'Userdata' );
plot_h = plot_cell{1,1}; % handle of plot_object
% Update Thermometer
plot_h.setDataset(org.jfree.data.general.DefaultValueDataset(get(hObject,'Value'))); % change Values of the thermometer
Typically, an individual's normal body temperature is about 37 degrees Celsius. When a body enters hypothermia,...