Design Idea

Parallel port provides high-resolution temperature sensing

Edited by Bill Travis

Martin Connors and Mike Foote, Athabasca University, AB, Canada -- EDN, 10/3/2002

High-resolution temperature sensing at low cost is possible using only one chip attached to the PC's parallel port (Figure 1). The Dallas Semiconductor (www.dalsemi.com) DS1722 digital thermometer allows measurement resolution as fine as 0.0625°C in digital form and with linear response. The accuracy specification is only 2°C, but you can improve this figure by careful calibration. Moreover, the accuracy spec is unimportant in applications in which you measure only changes in temperature or in which you must closely maintain a noncritical temperature. The measurement range is –55 to +120°C, the part can use either three-wire or SPI interface, and the cost is approximately $1. The eight-pin part is available in SO or µSOP packaging and in large quantities as a flip-chip measuring only about 1 mm sq.

In this application, the chip attaches directly to the PC's parallel port through a male DB-25 connector. Because the device draws a maximum of 0.5 mA, the port can supply the power, and its supply range tolerates variations in voltage levels that may exist on varying ports. The chip is in SPI mode with the SCK clock signal supplied by the PC; in this way, data-transfer timing is noncritical. A simple Turbo C program (Listing 1) running in DOS mode effects the data-transfer cycle in the PC, whereas the transfer is automatic in the chip upon reception of SCK. The routine reads a low byte and a signed high byte and creates a floating-point value by simply adding the low byte, divided by 256, to the high byte. In the highest resolution mode, which this design uses, a data read can occur only every 1.2 sec, and you should adjust the timing loops accordingly. You may also need to adjust the settling time, DELTIME, depending on the speed of the PC you use. The sample program prints the bytes transferred as well as the temperature, and you can easily modify it. The data sheet explains the use of the configuration register and changes to make if you need a higher data rate with lower resolution. Click here to download Listing 1.

The data transfer takes place beginning with the write of an address byte to the chip's SDI in the order A7 to A0 (high bit to low bit). If A7 is high, a write takes place; otherwise, a read occurs. For a write, D7 to D0 route to the chip's SDI. For a read, D7 to D0 are available on the chip's SDO. The program always uses both SDI and SDO and ignores whichever it doesn't need. For example, data goes to the chip's SDI even during a read, but the chip ignores this data. Each byte transfers as 8 bits, and each transfer involves the following steps:

  1. The PC raises D1/SCK and places 0 or 1 on D2 for the chip's SDI.
  2. The PC then reads PAPER.
  3. Finally, the PC drops D1/SCK.

This action repeats for each bit of the pair of bytes being transferred (one in, one out). By using the other parallel port's output pins as chip selects, you could string together several devices. You can also use these pins to control a heater by use of a switching transistor or an SCR. With this scheme, you can achieve high-resolution temperature control with minimal parts and a simple program. Alternatively, if you need only low accuracy, you can implement a very-low-cost thermostat with this part.

Is this the best Design Idea in this issue? Select at www.edn.com.



ADVERTISEMENT

ADVERTISEMENT

Feedback Loop


Post a CommentPost a Comment

There are no comments posted for this article.

Related Content

 

By This Author

There are no additional articles written by this author.


ADVERTISEMENT

Knowledge Center



Technology Quick Links

EDN Marketplace


©1997-2008 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy

Please visit these other Reed Business sites