Introduction: Thermistor Test Plan

The goal of this test plan is to see if we can measure human body temperature. This test plan will give you instructions on how to build a simple digital thermometer, calibrate it, program it, and then use it to see if you can detect a simulated fever (a temperature of 40 degrees Celsius).

Step 1: Step 1 - Gather Your Materials

A good test plan should always start by laying out the materials you will need.

For our thermistor test plan, we require the following:

Arduino Uno microcontroller

USB cable (to connect the Arduino to the computer)

Laptop computer

Thermistor

Resistors (10,000 Ohm)

Breadboard

Beaker

Water

Hot plate

Tape

Alcohol thermometer

Step 2: Step 2: Connecting Your Circuit

The next step is to begin constructing the circuit that will allow you to measure temperature using the thermistor.

Follow the diagram above to connect your thermistor to your Arduino in a way that will allow you to measure temperature. As you can see, the 5V output of your Arduino is connected to your thermistor. The other end of the thermistor is connected to the 10kOhm resistor. Finally, the other end of the 10kOhm resistor is connected to the ground pin on the Arduino, completing the circuit.

You will also notice the yellow wire that connects the junction between the thermistor and resistor to the the analog input pin "A0" on the Arduino. Do not forget to connect this wire! That wire is the one that allows your Arduino to actually measure the thermistor. Without it, you will not get any measurements.

Step 3: Step 3: Programming Your Arduino

The next step is to program your Arduino so that you can start taking measurements of the voltage across your thermistor. To do so, copy the code above into your editor and then upload it onto your Arduino.

This code will take a reading from your thermistor one time per second, and will write that reading on the serial monitor. Remember: the values that will be written on the serial monitor here are voltage values. In order to produce temperature values, we will need to calibrate the device.

Step 4: Step 4: Recording Your Calibration Data

Right now, your Arduino is not producing temperature values. We need to calibrate it, which means taking a series of voltage measurements with the Arduino at various temperatures, while simultaneously recording the temperatures at each voltage measurement. In this way, we can create a chart that has voltage values on the left and temperatures on the right. From this chart we will be able to come up with an equation that will allow us to automatically convert between volts and degrees.

In order to take your calibration data, you will need to put a beaker full of water on a hot plate and turn it on. Place an alcohol thermometer in the water and watch as the temperature rises. When the temperature reaches 18 degrees Celsius, place your thermistor in the water as well and turn on your Arduino so that you can read the serial monitor.

When the temperature on your thermometer reads 20 degrees Celsius, write down that temperature. Next to it, write down the voltage reading that your Arduino is putting on the serial monitor. When the thermometer reads 21 degrees Celsius, repeat this. Continue repeating it until your thermometer reads 40 degrees Celsius.

You should now have a series of voltage values, with each corresponding to a specific temperature. Enter these into an Excel spreadsheet like in the photo above.

Step 5: Step 5: Creating Your Calibration Curve

Now that all of your data is in Excel, we will use it to create a calibration curve and generate an equation that will allow us to convert between voltage and temperature values.

In Excel, highlight your data (make sure the voltage values are on the left) and select "Insert" on the toolbar at the top, then click "Scatter or Bubble Chart" from the Charts section. A graph should pop up with a series of dots on it. Double-check that the Y-axis represents temperature values and the X-axis represents voltage values.

Right-click on one of the data points and select "Format Trendline". A dialogue box will appear. Under "Trendline options", select "Linear", and then at the bottom select the box that says "Display Equation on chart".

Your chart should now look like the one in the photo above. Write down that equation, as that is what you are going to program into your Arduino to make it convert voltage to temperature automatically.

Step 6: Step 6: Calibrating Your System

Now that you have successfully created a calibration curve and derived the equation that allows you to convert voltage values to temperatures, you must update your code so that your Arduino prints temperature values to the serial monitor.

Go back into your Arduino code and make the following changes:

Instead of establishing the variable "val" as an "int", call it as a "float". This is because "int" means integer, or a whole number. Since we are going to put the voltage value stored in "val" through an equation, we need to allow it to have decimal values or else our conversion will be incorrect. By calling "val" as a "float" variable, we will make sure our math works out properly.

Next you need to add a new line after "val=analogRead(0);". On this new line, write the following: "float temperature". This will establish a new variable, temperature, that we will display shortly.

The next step is to convert the voltage value in "val" into a temperature that we can store in "temperature". To do this, go back to your equation that you got from your calibration curve. As long as voltage is on the X-axis and temperature is on the Y-axis of your graph, then the equation can be translated as follows: y = a*x + b becomes temperature = a*val + b. On the next line, write "temperature = a*val + b", where "a" and "b" are numbers that you get from your calibration equation.

Next, change delete "Serial.println(val)". We are not going to look at the temperature itself, but instead will use an if statement to decide if we are above a certain temperature or not.

Finally, we are going to add a piece of code that will use the temperature information to make a decision about whether or not you have a fever. On the next line, write the following:

if (temperature > 40) {

Serial.println("I have a fever!")

}

Save your code and upload it to the Arduino.

Step 7: Step 7: Testing Your Device

Congratulations! You have now constructed a digital thermometer that can measure temperature using a thermistor and an Arduino. Now you must test it for accuracy.

Set up your beaker on the hot plate again and start heating the water. Place your alcohol thermometer and thermistor in the water. Watch the Serial monitor as well as the alcohol thermometer. When your Serial monitor says "You have a fever!", write down the temperature on your alcohol thermometer and turn off the hot plate.

Let the water cool to about 32 degrees Celsius and then repeat the above procedure. Do this 5 times, and record your observations in a chart like the one above.

Step 8: Step 8: Calculate Your Device's Accuracy

Now that you have recorded 5 trials of tests, you can calculate how far off your device was from the true temperature.

Remember that we set up your device so that it would show "I have a fever!" whenever it detected a temperature greater than or equal to 40 degrees Celsius. That means we will compare out alcohol thermometer values to 40 degrees and see how different they were.

In Excel, subtract 40 from each temperature value you recorded. This gives you the difference between each true value and your measured values. Next, divide these values by 40, and multiply by 100. This will give us the percent error for each measurement.

Finally, average all of your percent errors. This number is your overall percent error. How accurate was your device? Was the percent error under 5%? 1%?