Fads to Obsessions and Beyond...




Free domain for life, exceptional technical support, website transfer

Digital Thermometer

A PIC16F876A microcontroller based digital thermometer using DS18S20 1-wire probes is constructed. The thermometer is capable of simultaneously recording from up to three attached probes, and can log data to a PC via RS232/serial port. The device can be powered from battery or via a 'wall wart' from a wall socket.

Many situations require the determination and recording of temperature. There are many methods for electronically determining temperature which range from simply using the change in resistance with temperature of particular components (e.g. thermistor, or even just a resistor if only low resolution required) through to specific IC's such as the LM35 temperature sensor.

The LM35 temperature sensor provides a 10mV/oC linear output in the range of -55o to +150o and does not require any external calibration or trimming. This makes the LM35 much more convenient than say a thermistor (which would need to be calibrated if a scaled temperature read-out was desired). However, components such as the DS18S20 provide simplified solutions in particular situations by providing the following capabilities onboard the chip:

  • Multidrop capability is included allowing simplified distributed temperature sensing with multiple probes
  • User-defineable nonvolatile alarm settings, with progammable upper and lower trigger points
  • Each DS18S20 has an unique serial code, allowing multiple DS18S20 on the same communication bus
  • Ability to operate without an external power supply. Power is instead supplied through the 1-Wire pullup resistor via the DQ pin when the bus is high
  • Output data is calibrated in degrees centigrade without the need for further calculation/conversion

Utilising the capabilities of the D18S20, a PIC based digital thermometer (using a PIC16F876A) is constructed to enable the following functionality:

  • Measure temperatures from –55oC to +125oC
  • Measure temperatures from up to three (3) DS18S20 probes simultaneously
  • Log recorded temperatures to PC using RS232/Serial Port
  • Display temperature data on LCD (do not need to be connected to PC)
  • Operate both from battery and wall-socket (via 'wall-wart' power supply)
  • Communicate/interface with Windows/PC VB application for data logging, DS18S20 probe setup

Specific information about developing the necessary firmware/C code library for the DS18S20 temperature sensor with PIC microcontroller is documented seperately. This page documents the incorporation of DS18S20 digital thermometers into a practical functioning device.


The schematic for the project is given in the Schematics Section below.

Power Supply

A typical "wall-wart" power-supply is used (a surplus laptop charger in this case) in conjunction with a voltage regulator (LM7805) to provide the regulated 5V required by the PIC microcontroller and the other circuit components. The D18S20 sensors are on the same supply as for the PIC microcontroller in this case.

Circuit Operation

The schematic shows the basic minimum circuit to demonstrate the operation of the D18S20 sensors, in this case, controlled/interfaced to a PIC16F876A microcontroller which also provides data output to PC via RS232 connection.

The LM7805 provides the 5V circuit voltage (stepping down from the 12V input from a "wall-wart" power-supply). The crystal X1 and associated capacitors C1 and C2 provide the oscillator for the PIC16F876A microcontroller. Incircuit serial programming (ICSP) of the PIC16F876A microcontroller is provided via connector J1 with switch SW1, resistor R1 and diode D2 providing voltage protecting during loading code into the PIC microcontroller.

Control signals to/from the PIC16F876A microcontroller are sent from a suitable port on the microcontroller (port B in this case) in order to control the D18S20 sensors and retrieve data.

Calibration

The D18S20 sensor provides the temperature data digitally and notionally does not require calibration (datasheet stated accuracy ±0.5oC).

Calibration checking of temperature data from the D18S20 however can be performed using water baths (or similar) at known temperature (e.g. via mercury glass-bulb thermometer).

Firmware/Software

The D18S20 provides simple digital control and a serial interface for retrieval of data using a "one-wire" protocol. The "one-wire" refers to the single data line, however, the sensor still obviously requires V+ and ground, so three wires are required to connect the sensor.

Specific information about developing the necessary firmware/C code library for the DS18S20 temperature sensor with PIC microcontroller is documented seperately. This page documents the incorporation of DS18S20 digital thermometers into a practical functioning device.


Note: Image loading can be slow depending on server load.

  • Digital Thermometer SchematicDigital Thermometer Schematic

    Silver Membership registration gives access to full resolution schematic diagrams.

    Digital Thermometer Schematic - Probe Connections

    Digital Thermometer Schematic - Probe Connections

  • Digital Thermometer SchematicDigital Thermometer Schematic

    Silver Membership registration gives access to full resolution schematic diagrams.

    Digital Thermometer Schematic - I/O Devices

    Digital Thermometer Schematic - I/O Devices

  • Digital Thermometer SchematicDigital Thermometer Schematic

    Silver Membership registration gives access to full resolution schematic diagrams.

    Digital Thermometer Schematic - Power Supply

    Digital Thermometer Schematic - Power Supply

Note: Image loading can be slow depending on server load.

  • Digital Thermometer PCB - Bottom CopperDigital Thermometer PCB - Bottom Copper

    Silver Membership registration gives access to full resolution diagrams.

    Digital Thermometer PCB - Bottom Copper

  • Digital Thermometer PCB - Bottom Copper

  • Digital Thermometer PCB - Top CopperDigital Thermometer PCB - Top Copper

    Silver Membership registration gives access to full resolution diagrams.

    Digital Thermometer PCB - Top Copper

  • Digital Thermometer PCB - Top Copper

  • Digital Thermometer PCB - All LayersDigital Thermometer PCB - All Layers

    Silver Membership registration gives access to full resolution diagrams.

    Digital Thermometer PCB - All Layers

  • Digital Thermometer PCB - All Layers

  • Digital Thermometer PCB - SilkDigital Thermometer PCB - Silk

    Silver Membership registration gives access to full resolution diagrams.

    Digital Thermometer PCB - Silk

  • Digital Thermometer PCB - Silk


Qty Schematic Part-Reference Value Notes/Datasheet
Resistors
1R12701/4W, 10% 
4R2,R3,R5,R810K1/4W, 10% 
2R6,R7100K1/4W, 10% 
Capacitors
2C1,C222pFCeramic 
6C3,C6-C101uF 
1C40.1uF 
3C5,C11,C12100nF 
Integrated Circuits
31U1,U2,U5DS18B20Temperature Sensor datasheet
1U37805Linear Voltage Regulator  datasheet
1U4PIC16F876APIC microcontroller datasheet
1U6MAX232ERS232 Driver/Receiver datasheet
Diodes
1D1LED red 3mm 
Miscellaeous
1J1CONN-H55-pin connector for ICSP
1P1CONN9-pin connector for RS232
1SW1SW-SPDT 
1X110MHzCrystal Oscillator
1LCD1LCDLiquid Crystal Display

Description Downloads
Digital Thermometer - Bill of Materials Text File Download

Testing of the digital thermometer (i.e., DS18S20 sensor) simply involves measuring temperatures of substances/objects for which the temperature is independently known. A water bath was constructed from a convenient container, into which hot water was added, approximately 60oC (the datasheet specifies the following measurement range and accuracy ±0.5oC for -10oC to 85oC).

The temperature of the water bath as it cooled to ambient room temperature, was measured with the DS18S20/digital thermometer circuit (every minute) and approximately every five minutes with a mercury glass bulb thermometer.

The comparison between the water temperature measured with the mercury glass bulb thermometer and that of the DS18S20 is presented in the following graph 1. There is excellent agreement between the measurements of water temperature.

  • Graph 1: DS18S20 Calibration

    DS18S20 CalibrationDS18S20 Calibration

    Silver Membership registration gives access to full resolution diagrams.

    Graph 1: DS18S20 Calibration


The usual precautions apply when soldering components onto the circuit board (check polarity of electrolytic capacitors, orientation of IC's etc).

It is recommended to solder the power-supply components initially, and then test that the board powers-up correctly before proceeding with the other components.

IC sockets are inexpensive, and it is recommended that appropriate IC sockets be used rather than soldering IC's directly on the PCB. This avoids possible heat damage to IC's during soldering, and facilitates removal of IC's at a later stage if necessary.

Sensor Mounting

The mounting of the sensors will depend upon the circumstances and environment into which the sensors are desired to be employed.

In this case, individual sensors had ~50cm of wire attached, and then the sensor was sealed using heat shrink tubing (see photographs section). This was found to give a water proof connection, suitable enough for measuring temperature of liquids in containers. The material used to water proof (or otherwise protect the sensor from the measuring environment) should avoid overly insulating the sensor from the ambient temperature, as this will slow down the response of the sensor in regard to ambient conditions.

PCB and component enclosure

A DIY enclosure was made from pieces of perspex (3mm) cut to shape and glued (see photographs section).

Comments/Questions

No comments yet.

Add Comment/Question

Only Logged-In Members can add comments

"If we could sell our experiences for what they cost us, we'd all be millionaires".

Please donate any amount to help with hosting this web site.

If you subscribe (only $2/annum) you can view the site without advertisements and get emails abouts updates etc.

X

Sorry!

Only logged-in users with Silver Membership and above can download.


Silver Membership is only $2, so join now!