Home     Contact     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS     Terms of services     Privacy policy  
   
 Home      Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science   

14 December 2009
Author: Giorgos Lazaridis
Low Cost PIC Thermometer


The circuit on the bench for testing

There are certain citations where we need to measure the temperature to one or more places/positions, but it is not required high accuracy. I for example, needed once to measure (and monitor) the temperature to 6 hard disc drives and 2 more positions in a PC box. Totally i needed 8 temperature sensors. High accuracy temperature sensors cost 2 or more Euro. Only for the sensors i would need more than 16 Euro. Instead, i used simple thermistors, for 0.25 Euro each. The total price for 8 thermistors was 2 Euro. This is the most important reason why someone would prefer to use a thermistor instead of t sophisticated temperature sensor.

There is a major drawback though. Cheap thermistors have lower accuracy. I am not talking about 4 and 5oC. The once i used had about 2oC in temperatures much higher than 25 degrees. For room temperatures, the accuracy was very satisfying, and sometimes the measurement of the thermistor was the same with the accurate temperature meter.

The inaccuracy comes basically from the characteristic of each thermistor. The characteristic is a line that shows how the resistance of the thermistor is changed according to the temperature change. Over the years, thermistors with almost linear characteristic line have been made. But still it is not exactly linear. This means that a simple formula solution for a straight line, will produce in some cases wrong results.

The circuit in operation




The theory of operation

A sample screenshot of the LCD while in operation

I will use the thermistor from this experiment. I tried to re-generate the characteristic line of this thermistor. The experiment was not scientific though. For a scientific experiment, i would need a controlled environment with expensive equipment. With the equipment that i can afford, i had some very good results though. For temperatures from -9oC up to 45oC, this thermistor had an almost linear characteristic. Using the least squares method, i found the line slope and offset:



    a = 2.57
    b = 62.07


The above numbers comes from a 1K thermistor connected with a 1K 1% metal film resistor as a voltage divider. I will use the same connection here to have the same results. Using the PIC's built-in analog to digital converter, i will measure the output voltage of the voltage divider. Directly, i can calculate the temperature using the formula for the straight line:



Y = a*X + b

solving for X:

X = Y - b
a



The Circuit

I use the 16F1937 PIC microcontroller for this project. Any other PIC with a built-in ADC module will work the same. There is no special reason why i used this 40-pin PIC for such a small circuit. I just have always one connected to a breadboard and i used is for saving time.

It is important to use a metal film resistor with 1% or better accuracy. A carbon 5% resistor has a very high reading error. I tried it and was disappointing. The LED is blinking every time a new measurement is taken. Here is the schematic diagram of the circuit:





The thermistor is a NTC thermistor. If you use a PTC thermistor, then you need to switch places between the metal film resistor and the thermistor.




Downloads

Here are all the files needed as well as the full assembly listing, to re-compile the program:



 Low Cost PIC Thermometer


For those that do not want to recompile and wants it as-is, here is the compiled hex version to directly upload to the PIC:



 Low Cost PIC Thermometer - hex



Bill Of Materials
Resistors
R1NTC 102 1 KOhm NTC Thermistor
R21 KOhm 1/4 Watt 1% Metal Film resistor
R310 KOhm variable resistor
R4100 Ohm variable resistor
R5330 Ohm 1/4 Watt 5% resistor
ICs
IC1PIC 16F1937 Microcontroller 
Misc
LCD1LCD 20x4 Character LCD w/ HD44780U1 controller  
LED1LED 3mm red 







Relative pages
  • How to calculate the best-fitting line using the least square method
  • The voltage divider theory
  • Peltier coolers (TEC) theory of operation
  • Learn about the most popular PC Cooling methods
  • High accuracy humidity and temperature sensor
  • High accuracy temperature meter
  • Experimenting with a thermistor
  • Learning PICs @ PCB Heaven On-Line Book
  • Dr.Calculus: Metal film resistors color code calculator
  • A calculator for the line equation
  • Dr.Calculus: Voltage divider calculator





  • Comments

      Name

      Email (shall not be published)

      Website

    Notify me of new posts via email


    Write your comments below:
    BEFORE you post a comment:You are welcome to comment for corrections and suggestions on this page. But if you have questions please use the forum instead to post it. Thank you.


          

  • At 22 January 2014, 12:52:24 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @aris You can check microchip MAPS for the best solution for you. The program will definitely change a lot though.


  • At 21 January 2014, 22:41:17 user aris wrote:   [reply @ aris]
    • which pic is the best choice for lower cost?
      how much and where will change the programme?


  • At 28 June 2012, 14:16:18 user Nicholas Cabral. wrote:   [reply @ Nicholas Cabral.]
    • This is very good, but I dont know how to program PIC ic


  • At 26 November 2010, 17:21:51 user mkrc wrote:   [reply @ mkrc]
    • thank you soo mutch


  • At 11 June 2010, 11:27:27 user aydin wrote:   [reply @ aydin]
    • thank you soo mutch


  • At 21 December 2009, 2:35:55 user Cherry.PCB wrote:   [reply @ Cherry.PCB]
    • it is good!

      Cherry



    delicious
    digg
    reddit this Reddit this
    Faves



     HOT in heaven!


    NEW in heaven!



    New Theory: AC electric motor working principle



     Contact     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS   

    Site design: Giorgos Lazaridis
    © Copyright 2008
    Please read the Terms of services and the Privacy policy