Home / Projects / Arduino Temperature Sensor

Arduino Temperature Sensor

Project Overview

I was recently commissioned to create a simple project for a coffee roasting machine. Basically, I need to measure the temperature of the machine in real time to monitor the progress of the roasting process. This includes a line graph that updates every second and is viewable on a computer. Here’s how I did my arduino temperature sensor project.

Temperature Sensor

The temperature sensor was already decided; a BBQ temperature probe that my client is currently using. This is exactly what it looks like:

bbq temp for arduino temperature sensor project

My client made a hole on the roasting machine where the end of the probe is inserted. Then he would record the temperature readings every thirty seconds on a spreadsheet and create a graph based on the records.

After some research I found out that the probe is a thermistor type K. So basically, I just need a way to read the resistance changes of the probe and have it read by an Arduino then send the data to a desktop application for graphing.

Some Thermistor Theory

A thermistor is a resistor that changes its resistance based on temperature. There are two types: NTC and PTC. The NTC type has its resistance decreasing when temperature is increasing. The PTC type behaves the opposite of the NTC type.

I found out that the BBQ temperature probe is an NTC type because the resistance was decreasing when heated.

The resistance of the thermistor can be converted to temperature using the Steinhart-Hart equation:

\frac{1}{T} = a + bln(R)+c(ln(R))^{3}

In the equation, T is the temperature in Kelvins, a, b, and c are known as Steinhart-Hart parameters. This parameters are unique for the device so I started digging them for the temp probe I was using. Thankfully, the probe is a common thermistor type and has these values as parameters:

a = 1.129148 x 10^{-3}

b = 2.3415 x 10^{-4}

c = 8.76741 x 10^{-8}

Read thermistor interfacing tutorial for more information.

Interfacing Circuit

I used a simple voltage divider circuit to convert the resistance into voltage and have that voltage converted to resistance in code. Here’s what I used:
Arduino Temperature Sensor Interface Circuit

The voltage to A0 of the Arduino should be:

V = \frac{3.3R_{T}}{R_{1} + R_{T}}

A temperature rise would result in a resistance decrease which should result in a voltage decrease to A0.

You might have noticed I used a 3.3V from the Arduino as a source and an analog reference. This is because 3.3V is less noisy compared to 5V on the Arduino board. This would make my reading less jittery.

Arduino Sketch

My plan for the Arduino sketch is to take a number of samples, take the average then convert that average to resistance.

Then I need to convert that average voltage to resistance:

After that, used the steinhart equation to find the temperature:

Now that I have the temperature value, all that is needed is to transfer that to a PC via the serial port.

PC Program

I used Visual C# (VS 2008) to capture the data from the Arduino via the serial terminal. Then I used MSChart to plot the data. If you are looking to duplicate my desktop app, you need both the MSChart Controls for .NET 3.5 and the MSChart Add-on for Visual Studio.

To capture data, I hooked a function to the DataReceived event of the serial port object:

The temp_cels and temp_fahr global variables now have the celsius and fahrenheit temperature readings respectively.

To plot the data, I created two MSChart objects: chartCelsius and chartFahrenheit. I needed to track time as well so I build a string variable time_s that increments in every tick of a Timer object. The string time_s is then converted to a TimeSpan object making it readable by the chart object.

I also decided to add an LCD to display both Celsius and Fahrenheit temperature readings.

Here’s the video showing the temperature waveforms on the desktop app:

If you are looking to build a similar project, feel free to send me an email!

Check Also

Adjustable Timer with Relay

Project Overview This adjustable timer displays seconds, minutes and hours and is powered by a …

Leave a Reply

Your email address will not be published. Required fields are marked *