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   

8 December 2009
Author: Giorgos Lazaridis
PIC Precision Thermometer using the DS1621

The DS1621 is a very accurate and easy to interface chip. It has a built in temperature sensor and using I2C protocol, can send very accurate temperature readings. The interface of I2C is just 2 wires, one Data and one Clock. What makes this chip even more handful is that it comes with a 3-bit address. This means that with those 2 wires, up to 8 chips can be interfaced and accessed by it's address!

The circuit in operation

The DS1621

The DS1621 chip is very accurate

The DS1621 is a very simple-to-use chip for measuring temperatures. One great advantage is the high accuracy that it has and the wide measuring range. It can measure form -25oC to +110oC with maximum error 0.5oC near the edges. For room temperatures, the error is almost zero.

Furthermore, each chip is hardware addressable. Using just 2 communication lines from the microcontroller, up to 8 chips can be cascaded and separately controlled by it's pre-selected address. The communication is done using standard 2-wire I2C protocol.

The temperature is returned from the chip with 2 8-bit bytes. The first one is the temperature in degrees (no conversion needed). The second one is the half-degrees. Using only those registers, you can have a 0.5oC step. But there are 2 more registers in the chip that can be used, and using a formula, this step can be significantly decreases, increasing with this way the accuracy. This circuit will not use those registers and thus, a step of 0.5oC will be used, which for room temperature monitoring is already enough.

Finally, this chip can be a stand-alone pre-programmed thermostat. It has an output that becomes high when the temperature exceeds a pre-programmed value, and turns back low when the temperatures goes bellow another pre-programmed value.

The Circuit

What i have design here is a dual temperature meter. I use two DS1621 chips. The first one has the address 000 (0) and the other one the address 001 (1). The address can be hardware selected from the package pins A0 A1 and A2. The same circuit with very slight modifications in the PIC program can be used to interface up to 8 chips. For addressing, i use one 4-dip switch on each chip. I use of course only the 3 first dip switched. On the real PCB, this switch can be replaced with permanent wiring to reduce cost and size. Here is the schematic diagram:

As already has been told, the DS1621 uses only two wires for interface. The Data bus comes from the RC6 I/O of the PIC, and the Clock bus comes from the RC7 I/O. Furthermore, the Data bus needs a pull-up resistor. An 1K resistor is enough. Higher values may cause problems as the rise and fall times will be higher. Finally, the LED is blinking every time a new measurement is taken.


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

 DS1621 PIC temperature meter

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:

 DS1621 PIC temperature meter - hex

Bill Of Materials
R110 KOhm variable resistor
R2100 Ohm variable resistor
R31 KOhm 1/4Watt 5% resistor
IC1PIC 16F631 Microcontroller 
IC2DS1621 Digital Thermometer and Thermostat  
IC3DS1621 Digital Thermometer and Thermostat  
LCD1LCD 20x4 Character LCD w/ HD44780U1 controller  
LED1LED 3mm red 

Relative pages
  • Learn about the most popular PC Cooling methods
  • High accuracy humidity and temperature sensor
  • Low cost medium accuracy PIC temperature meter
  • Learning PICs @ PCB Heaven On-Line Book
  • Peltier coolers (TEC) theory of operation

  • Comments


      Email (shall not be published)


    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 29 October 2012, 4:02:11 user mecs wrote:   [reply @ mecs]
    • @Giorgos Lazaridis

      Thank you for the quick response. I did the tutorial you gave and tried to simulate using protues.. and its working fine, although I still have a lot of time just learning a basic of this..

  • At 28 October 2012, 9:11:16 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]
    • @mecs I use MPLAB. Go ahead and read my tutorial pages here:

  • At 28 October 2012, 1:57:29 user mecs wrote:   [reply @ mecs]
    • hello sir

      just wanna ask what programmed did you use to recompile this code,
      i'm bit new to this pic project.


  • At 14 July 2012, 8:28:10 user nithya wrote:   [reply @ nithya]
    • the content of the above is not understandable....please make it clear

  • At 30 October 2011, 6:09:23 user Kammenos wrote:   [reply @ Kammenos]
    • @John Doe "1SHOT = One Shot Mode. If 1SHOT is "1", the DS1621 will perform one temperature conversion upon receipt of the Start Convert T protocol. If 1SHOT is "0", the DS1621 will continuously perform temperature conversions. This bit is nonvolatile."
      The I2C is of course essential to initialize the chip and set the temperature and hysteresis. Afterwards it can run as a stand-alone thermostat.

  • At 29 October 2011, 14:02:55 user John Doe wrote:   [reply @ John Doe]
    • From the specs:
      The DS1621 always powers up in a low power idle state, and the Start Convert T command must be used
      to initiate conversions. "

      So, NO, it can not be used a stand-alone. I tried, it need to be started via the I2C bus. The DS 1620 can be used stand-alone.

      Use the graphic card I2C adapter for a free interface.

  • At 17 February 2011, 14:50:31 user Kammenos wrote:   [reply @ Kammenos]
    • If a +-2 degrees typical accuracy is ok, you can use some very cheap NTC (or PTC) thermistors. Look these:
      Any PIC with A/D module will do the work.

      Higher accuracy can be achieved with LM35 for example, again you need a PIC with A/D module.

      You can use a DS1621 digital thermometer with I2C interface protocol. For this, you can use whichever PIC you like, because you can implement I2C in software. DS1621 is very accurate but somewhat expensive.

  • At 17 February 2011, 14:42:33 user Elvis K. wrote:   [reply @ Elvis K.]
    • I was hoping that you would tell me that. They don't need to be very accurate.

  • At 16 February 2011, 18:00:08 user Kammenos wrote:   [reply @ Kammenos]
    • what types of sensors? digital? analog? resistance?

  • At 16 February 2011, 15:05:48 user Elvis K. wrote:   [reply @ Elvis K.]
    • OK thanks for the reply
      but could you help me and tell me what would be the right PIC for the job and temperature sensors ?

  • At 15 February 2011, 21:51:14 user Kammenos wrote:   [reply @ Kammenos]
    • I'm sorry Elvis, i do not circuits on request. I do circuits either because i develop a project, or because i need it for an experiment or research.

  • At 15 February 2011, 16:31:39 user Elvis K. wrote:   [reply @ Elvis K.]
    • Hi

      I have quite a big request. I was wondering if you could make a project similar to this one but that it had 2 relay outputs and three buttons to navigate on the LCD.
      It would be great to turn the relays manually ON/OFF and automatic if the temperature on one of the sensors rises over a specific temperature lets say 50°C.

      would that be possible because i am making a room thermostat and i am not so good at code writing.

      Thanks in advance

  • At 1 September 2010, 16:59:25 user Kammenos wrote:   [reply @ Kammenos]
    • Hi Van Luu. First of all, click on the schematic diagram to enlarge it to full size... That will solve your "bluring" problem. The image is 2000x1000 pixels which is rather big... As for the components, i can answer your future questions. R4 is limiting resistor for the LED, R3 is pull up resistor for the data line of the I2C lines, R1 adjusts the contrast and R2 the backlit brightness. I have all the datasheet needed for the display and the DS1621. If you have more questions, i wait for them.

  • At 1 September 2010, 14:36:22 user Van Luu wrote:   [reply @ Van Luu]
    • Hi

      My name is Van and studying in the Royal School of Technology in Stockholm. I was looking around the net for some help and found your interesting project. We're a couple of students studying an electronic project where we have a similiar task.

      I saw the diagram but do you have something more detailed because it's hard to see every component that is used?

      Also, could you tell more about what every component does? There is a couple of more questions I would like to ask if it's okay with you later on.

      Thank you

      Luu, Van

    reddit this Reddit this

     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