PDA

View Full Version : Measuring temperature with a PIC



Christopher4187
- 14th June 2012, 21:16
I've read many posts on measuring temperature. The problem is, it seems like there are so many choices. I need to measure temperature from 50F to 150F. It doesn't have to be that accurate, maybe within two degrees but not more than that.

Can I use a PIC with the ADCIN command and a NTC thermistor? Is there something more accurate that is just as cheap? I can use any kind of PIC to do this.

Megahertz
- 14th June 2012, 22:11
Any PIC with an ADC should do the job. Just configure any 1 analog PIN to accept the reading, this PIN should be configured as an input pin and also as an analog pin by setting the correct TRIS / ANSEL register. You can also use readily available components like MCP3202 which has a good 12 bit resolution and then use Shiftin/shiftout commands to get data in/out of them.

LGabrielson
- 16th June 2012, 21:22
I would recommend the DS1820. There are many variations of this part, and any difference in the part number requires slightly different software, so watch that, but it's quick and fairly easy.

Heckler
- 16th June 2012, 21:57
http://www.picbasic.co.uk/forum/content.php?r=374-How-to-read-a-one-wire-DS18B20-temperature-sensor-or-nine-of-them

Here is an article on using the DS18B20 sensor... you can find them on Ebay for around 10/$10 or so.

Aussie Barry
- 17th June 2012, 01:47
I find the LM35DZ an excellent temperature sensor (Celcius) and only cost a couple of dollars here in Australia.

http://au.element14.com/national-semiconductor/lm35dz/ic-precision-temp-sensor-to-92/dp/9488200

I have not interfaced one with a PIC but have played with them on an analogue system with no problems.

Cheers
Barry
VK2XBP

spcw1234
- 17th June 2012, 14:06
I like the LM34DZ (same as above but calibrated in Fahrenheit. Cost $2.00-$2.50 available from mouser. Easy to use with a PIC and there is plenty of code floating around the forums to use.

http://www.mouser.com/ProductDetail/National-Semiconductor-TI/LM34DZ-NOPB/?qs=QbsRYf82W3HZm9dbFM2PjPWXqM2YR39heSEq67kjn80%3d

languer
- 18th June 2012, 01:54
LM35 or LM34 - nice and easy; minimal math on PIC to translate voltage to temperature.

DS18B20 - simple digital interface; almost no math at all on the PIC

Either choice should suffice: LM3x if you want to use analog input into PIC's ADC, DS18xx if you want to use digital interface.