This standalone digital thermometer controls the temperature of a device according to its requirement. It also displays the temperature on four 7-segment displays in the range of –55°C to +125°C. At the heart of the circuit is the microcontroller AT89S8252, which controls all its functions. IC DS1821 is used as temperature sensor.
Dallas Semiconductor’s IC DS1821 is one-degree precision temperature sensor in a 3-pin pack like a transistor with single-wire communication protocol. It can operate as a standalone thermostat with user-programmable trip-points (set-points) or as an 8-bit temperature sensor with a single-wire digital interface. The open-drain DQ pin functions as the output for thermostat operation and as the data input/output (I/O) pin for single-wire communication. The single-wire interface lets user access the non-volatile memory (EEPROM) thermostat trip-point registers (TH and TL), status/ configuration register and temperature register.
When configured as standalone thermostat, temperature conversions start immediately when power is switched on. In this mode, the DQ pin becomes active when the temperature of IC DS1821 exceeds the limit already programmed in the TH register, and remains active until the temperature drops below the limit programmed in the TL register.
The DS1821 uses Dallas’ exclusive single-wire bus protocol that implements bus communication with one control signal.
Temperature sensor functionality
The core functionality of IC DS1821 is its proprietary direct-to-digital temperature sensing, which provides 8-bit (1°C increment) centigrade temperature readings over the range of –55°C to +125°C.
This circuit measures temperature by counting the number of clock cycles generated by an oscillator with a low temperature coefficient during a gate time-period determined by a high temperature- coefficient oscillator.
The low-temperature-coefficient counter is preset with a base count that corresponds to –55°C. If the counter reaches ‘0’ before the gate period is over, the temperature register, which is preset at –55°C, is incremented by one degree, and the counter is again preset with a starting value determined by the internal slope accumulator circuitry of DS1821. The preset counter value is unique for every temperature increment and compensates for the non-linear behaviour of the oscillators over temperature.
At this time, the counter is clocked again until it reaches ‘0.’ If the gate period is not over when the counter reaches ‘0,’ the temperature register is incremented again. This process of presetting the counter, counting down to ‘0,’ and incrementing the temperature register is repeated until the counter takes less time to reach ‘0’ than the duration of the gate period of the high temperature- coefficient oscillator. When this iterative process is complete, the value in the temperature register will indicate the centigrade temperature of the device.
The DS1821 has two operating modes: single-wire mode and thermostat mode. The power- ‘on’ operating mode is determined by the user-programmable bit in the status/ configuration register: if = 0 the device works in single wire mode, and if = 1 the device works in thermostat mode. The bit is stored in the non-volatile memory (EEPROM), so it will retain its value when the device is powered down.