element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Pi Chef Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Pi Chef Design Challenge
  • More
  • Cancel
Pi Chef Design Challenge
Blog The Cooker Connector - Blog #3: Thermistor Calibration (Pi Chef Challenge)
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: jschools
  • Date Created: 31 Jan 2018 7:28 PM Date Created
  • Views 1213 views
  • Likes 9 likes
  • Comments 4 comments
  • pi chef
  • cooker connector
Related
Recommended

The Cooker Connector - Blog #3: Thermistor Calibration (Pi Chef Challenge)

jschools
jschools
31 Jan 2018

In my last post, I chose some hardware that acquires and measures temperatures. Now that I have a thermistor probe and an ADC, how should I hook them together and interpret the ADC output to get a temperature value? This post explains some theory and my thought process, in three parts.

 

Part 1: Theory

 

Voltage Divider

A thermistor is a kind of variable resistor. As the temperature changes, its resistance changes. This resistance is what I have to measure using the Analog-to-Digital Converter (ADC), but an ADC can’t measure resistance directly: it only reads a voltage. Instead, I’ll need to place the thermistor in a circuit in order to produce a voltage that varies according to its resistance. The circuit I’m going to use is called a voltage divider, which is made up of two resistors connected in series, with the output connected between them.


image

Figure 1. Schematic of a voltage divider

 

If you know the resistance of one of the resistors and measure the voltage across it, you can calculate the resistance of the other one using this equation:

image

Figure 2. Voltage divider equation.

 

In my case, I’m going to use the Raspberry Pi’s 3.3V power pin as VCC, and my thermistor will be R1. I will have to choose a resistor value for R2. The voltage divider circuit will work with any resistor here, but I want to be strategic about my choice. Before I can make that decision, I need to know more about my thermistor.

 

Thermistors and the Steinhart-Hart Equation

I purchased ThermoWorks Pro Series thermistor probes. These thermistors are Negative Temperature Coefficient (NTC) type, which means that as the temperature increases, the resistance decreases. You can read about how thermistors work on Wikipedia, but the important thing to note is this relationship between temperature and resistance is not linear, so it’s not a simple task to convert the resistance into a temperature value. The relationship is described by the Steinhart-Hart Equation, and it requires three coefficients, A, B, and C, which depend on the material characteristics of the thermistor.

 

image

Figure 3. Steinhart-Hart Equation, where T is temperature in Kelvins.

 

These coefficients aren’t published for the probes I purchased, so I’ll have to do some tests in the kitchen in order to find them. Once I have the coefficients, I can plug them into the equation and start using it. Luckily, Wikipedia has instructions for finding the coefficients for the Steinhart-Hart Equation:

 


image

Figure 4. Steinhart-Hart Coefficient system of equations. Source: Wikipedia.

 

 

Part 2: Determining Steinhart-Hart Coefficients for a Thermistor

 

Testing the Thermistor

In order to solve for the three coefficients for the Steinhart-Hart Equation, I need to measure the resistance of the thermistor at known temperatures. I’ll need three data points in order to solve the system of three equations. It’s time for some kitchen science!

 

I’m going to use a stable room temperature, an ice bath, and a boiling water bath as my data points, and I will use a multimeter to measure the resistance of the thermistor when it is at each temperature. I’ll use my digital thermometer connected to the same probe to confirm these temperatures.

 

I used a mini TS jack and some alligator clips to connect the thermistor to the multimeter. The jack and alligator clips might add a little resistance to my measurements, but the TS jack is what I will be using in the final product, so this should be included in the measurement anyways. Also, my measurements are all several thousand ohms, so I’m going to consider this error negligible.

 


image

Figure 5. Connecting the probes to the multimeter

 

The first temperature I used was my ambient room temperature. My digital thermometer said it is 67°F. Next, I connected the probe to my multimeter and recorded its value.

 

To create the ice bath, I filled a glass full to the top with ice and then poured in distilled water to fill in between the ice chunks. After a minute or so, I gently swirled the probe in the water so that it wasn’t resting against any solid ice and confirmed that it was at 32°F using my digital thermometer. Then, I connected the probe to my meter and recorded its resistance. The number fluctuated a bit depending on how deep the probe was -- the digital thermometer I was using wasn’t capable of distinguishing between these values, so I recorded the highest value I saw, meaning, the lowest temperature that it reached. (This is the suggested calibration method from ThermoWorks, but I don’t feel very confident about this number because of the variance, so I would welcome any suggestions for a better way to do this.)

 


image

Figure 6. Measuring the temperature of an ice bath. I didn’t manage to get a photo of the actual measurement I used because I took the photo after much of the ice melted.

 

For the boiling water bath, I dumped the used ice bath into a pot and attached the probe using a pot clip. I added some more water and heated it on the stove until it started to boil. It was interesting to watch the resistance drop on the meter as the water increased in temperature, up until its boiling point. (How does that saying go? “A watched pot never converges to an asymptotically stable temperature?”) Once the water began to boil, I took a few temperature measurements with my digital thermometer and found a heat setting that would cause the temperature to stabilize at 212°F. Then I switched back to the thermistor and recorded the resistance shown on my meter. I’m at basically sea level, so the air pressure shouldn’t cause the boiling point of my water to deviate from 212°F. (32 and 212 are ridiculous numbers. Why am I not using Celsius for everything? Ugh, it’s too late to turn back now.)

 


imageimage

Figure 7. Measuring the temperature of a boiling water bath.

 

Calculating Steinhart-Hart Coefficients

I finally have the data points I need to find the Steinhart-Hart coefficients. I made a spreadsheet to help me convert Fahrenheit into Kelvin and organize all of the variables. In the end, I came up with the values in Table 1 below.

 

Table 1. Steinhart-Hart coefficients for my ThermoWorks Pro Series Thermistor probes.

A

7.62895078820644 x10-4

B

2.09018336028586 x10-4

C

1.25383014857396 x10-7

 

Plugging these values into the Steinhart-Hart Equation gives me this curve:


imageimage

Figure 8. Graphs of temperature vs. resistance for my thermistor probes. The first graph is a linear scale, and the one on the right shows the same data on a log scale.

 

 

Part 3: Optimizing the Voltage Divider

 

ADC Resolution

Now that I have an equation that converts between temperature and resistance, I can finally get around to choosing the other resistor for the voltage divider. My goal here is to find a resistor that gives me the best resolution in the temperature range I’m interested in. In order to make this decision, I want to be able to visualize how the resistance of R2 affects the resolution over the entire temperature range. I’ll need to create another spreadsheet and graph.

 

At the top of my spreadsheet, I define the constants for my voltage divider circuit, such as VCC and the bit depth of the ADC. It also has a slot for an experimental value of R2, which is what I will be tuning later. In the first column, I have a range of thermistor values for R1. I chose values that kind of follow a log scale (in fact, I used the standard E12 set of resistor values), so my data points aren’t bunched up at the low end. The next column has the temperature at that resistance, calculated using the Steinhart-Hart Equation including the coefficients I found. This will form the X-axis of my graph. The next column computes the expected output voltage of the voltage divider, taking into account the constants of my circuit and the resistance of the thermistor. Then, I calculate the expected ADC value at that voltage in the next column by dividing the voltage by VREF (which I’m setting equal to VCC) and multiplying by the ADC’s range. This predicts the integer value between 0 and 4096 that the Raspberry Pi will receive from the ADC. In the last column, I calculate the average ADC resolution between each row and the row above by dividing the change in ADC value by the change in temperature. Graphing this resolution against temperature gives me the tool I need to choose a value for R2. I also plotted the ADC values on the same graph, which illustrates how it corresponds to resolution.

 


image

Figure 9. Graphs of temperature vs. ADC resolution at several values of R2.

 

After trying a few different resistor values as the R2 parameter, I decided to choose R2 = 5.6KΩ. Because I plan to use this with a smoker, I want the best resolution in the low-and-slow cooking range, which is between 200°F and 250°F. 3.3KΩ puts the peak right over this range, but it also means that the resolution drops below 1 at temperatures below about 30°F. Since I may decide to get more probes and measure outdoor air temperature as well, I thought it would be nice to sacrifice a little resolution at 250°F in order to have a little more resolution at the low end. It might be interesting to see how freezing outdoor temperatures affect the cooker.

image

Figure 10. Graph of temperature vs. ADC resolution at my chosen R2 value, 5.6KΩ.

 

Now that I have chosen my R2 value for my voltage divider and have an equation to convert resistance to temperature, I’m ready to start prototyping! Be sure to check out my next blog post, where I actually hook everything up and get some sensor data!

 

If you would like to view my thermistor calibration spreadsheet, I have made it public on Google Drive here.

  • Sign in to reply

Top Comments

  • DAB
    DAB over 7 years ago +1
    Very good update. DAB
  • genebren
    genebren over 7 years ago +1
    Jonathan, Great work. Looks like you have the temperature range zeroed in. I look forward to your continuing updates. Keep up the good work! Gene
  • mcb1
    mcb1 over 7 years ago

    Excellent presentation of the task.

    (32 and 212 are ridiculous numbers. Why am I not using Celsius for everything?

    Yep 0 and 100 are nice numbers.

    However the math behind it doesn't actually care.

     

    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • three-phase
    three-phase over 7 years ago

    You explained very well how to get the most out of the thermistor setup. Very interesting read.

     

    Kind regards

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • genebren
    genebren over 7 years ago

    Jonathan,

     

    Great work.  Looks like you have the temperature range zeroed in.  I look forward to your continuing updates.

    Keep up the good work!

    Gene

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 7 years ago

    Very good update.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube