PocketMagic

March 1, 2009

ATMega8 and DS18B20 (digital temperature sensor)

Filed under: Electronics, Hardware — Tags: , , , , , — radumotisan @ 1:29 pm

“The DS18B20 Digital Thermometer provides 9 to 12–bit centigrade temperature measurements and has an alarm function with nonvolatile user-programmable upper and lower trigger points. The DS18B20 communicates over a 1-Wire bus that by definition requires only one data line (and gound) for communication with a central microprocessor. It has an operating temperature range of –55°C to +125°C and is accurate to +-0.5°C over the range of –10°C to +85°C. In addition, the DS18B20 can derive power directly from the data line (“parasite power”), eliminating the need for an external power supply.” Read more about this sensor, here.

Since I had two DS18B20 sitting among my other electronic components, I’ve decided to hook one up to my ATMega8 test board and see if I manage to get some temperature readings. One wire to a microcontroller’s pin, and two other wires for 5V power.

Now we’re ready to go… well not quite, this is a digital sensor and first we need to understand the way it communicates.

I’ve also found some good resources online here. If the link doesn’t work for you, see the attached PDF.

Here’s my source code, to get you started right away:
atmega8_lcd_temp.zip

Bottom line, this sensor offer some impressive results, and works very well. It is a good addition to any microcontroller board for gathering some extra environment parameters, and all at the expense of a single PIN on the microchip.

Radu Motisan

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Create a free website or blog at WordPress.com.