Go Down

Topic: [SOLVED] Analog or Digital Temperature measurement (Read 708 times) previous topic - next topic


Jan 21, 2012, 10:04 am Last Edit: Jan 21, 2012, 11:31 pm by torusJKL Reason: 1
I have a project where I want to measure the temperature of several (12 for the beginning) heat sinks so that I can monitor the mikrochips below them and take action when they get to hot.

I'm not sure though what kind of Thermometer I should use.
I found the following solutions

- DS18B20 (digital and thus I can identify them using the serial)
- LM35 (a bit cheaper but analog and needs Multiplexer)

What about Thermistors? Can they be used with Arduino as well?

I think it is ok to have +-1 degree Celsius accuracy thus the analog LM35 is precise enough.

I'm rather new to this and thus need advice what would be the best approach for the project.



I would choose DS18B20 due to the hardware simplicity that will payback.


What about Thermistors? Can they be used with Arduino as well?

I've used my arduino with a TMP36. Oomlout included one with their ARDX experimentation kit.



/*     --------------------------------------
*     |  Arduino Experimentation Kit Example Code             |
*     |  CIRC-10 .: Temperature :. (TMP36 Temperature Sensor) |
*     --------------------------------------
*  A simple program to output the current temperature to the IDE's debug window
*  For more details on this circuit: http://tinyurl.com/c89tvd

//TMP36 Pin Variables
int temperaturePin = 0; //the analog pin the TMP36?s Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade
                        //(500 mV offset) to make negative temperatures an option

* getVoltage() - returns the voltage on the analog input defined by
* pin
float getVoltage(int pin){
return (analogRead(pin) * .004882814); //converting from a 0 to 1023 digital range
                                        // to 0 to 5 volts (each 1 reading equals ~ 5 millivolts

* setup() - this function runs once when you turn your Arduino on
* We initialize the serial connection with the computer
void setup()
  Serial.begin(9600);  //Start the serial connection with the copmuter
                       //to view the result open the serial monitor
                       //last button beneath the file bar (looks like a box with an antenae)

void loop()                     // run over and over again
float temperature = getVoltage(temperaturePin);  //getting the voltage reading from the temperature sensor

temperature = (temperature - 0.5) * 100;

//converting from 10 mv per degree wit 500 mV offset
                                                  //to degrees ((volatge - 500mV) times 100)
Serial.println(temperature);                     //printing the result
delay(1000);                                     //waiting a second


For your specific project, the temperature sensor should be attached to the heat sink(s). For this reason I would think it should be in a metal package. Looking at the datasheet, I see that DS18B20 only comes in a plastic package. LM35 is offered in 2 metal packages: TO-46 and TO-220. I would definitely chose LM35.


[...]For this reason I would think it should be in a metal package.[...]

Thanks for your reply.
I also thought about this problem.

What if I attached the DS18B20 using Thermal Glue?


I would say just attach a ds18b20 to the device, and use maybe epoxy to hold it in place, being that most heat transfer happens from the leads they should be epoxied too
I would say ds18b20 is definetly the easiest route


I don't know how epoxy behaves with temperatures in the range of 60-80 Celsius (as I assume the temp of the heat sink will be).
Also, I don't know how good of a temperature conductor the epoxy is.
It also depends on how exact you want your measurement to be.
In the end, it's a trade-off between exactness and ease-of-use. If this is just a hobby project, go for the easy solution.


Thanks to all who have replied!

I will go for the LM35 TO-220 so that I can screw it directly to the heat sink.


How much approximate power is dissipated on these heatsinks?

Unless it's very small, the DS18B20's epoxied (with a good sized blob, clean/abrade the surface first) should be fine.

I would suggest running the leads and the first 1-2 cm of the attached leads in the epoxy too, so the small amount of heat conducted away by the leads would be insignificant.

You also COULD use pre-packaged DS18B20's like these: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=151

You could even attach those with a metal U-shaped strap and some heatsink grease, and be able to more/remove them.

DISCLAIMER: Mentioned stuff from my own shop...

Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

Go Up