Shopping Cart 0 Items (Empty)

3145 - Temperature Sensor Project Details

3145 - PC Temperature LoggerJust a handful of components builds an 8-pin microcontroller based circuit for temperature logging via a serial port; small, fast, and acceptably accurate.

Contents

Features

  • provides real-time data to your computer via serial port,
  • interfaces up to four DS18S20 temperature sensors (TO92 package)
  • absolute accuracy near 0.5 degrees Celsius (as per DS18S20 specifications),
  • relative accuracy near 0.01 degrees Celsius,
  • speaks in Centigrade or Fahrenheit (selectable by header pins),
  • powered by your computer's serial port, no extra supply to organise,
  • data format easily processed, no special programs required,
  • minimal parts count reduces cost,
  • built-in serial number for circuit identification

Applications

A few ideas of how this circuit can be used (additional equipment/software may be required). We do not have design information on these applications. They are just ideas that you may wish to pursue under your own steam.

  • simple weather reports for web pages
  • computer power supply temperature warnings
  • remote server temperature monitoring
  • redundant critical systems monitoring
  • house temperature monitoring
  • complex home automation tasks (start fan if warmer outside during Summer)
  • refrigerator monitoring and testing
  • brewing temperature regulation
  • fish tank heater verification
  • microclimate logging (ground versus air temperature)
  • daylight sensing (LDR on digital input)
  • primitive locking (using serial number)
  • remote monitoring of freezer lorries

 

Circuit Schematic

3145schematic.gif (10492 bytes)
Click image for full view

 

Theory of Operation

The program in the microcontroller knows two protocols; the one wire bus used by the DS18S20 temperature sensor, and the serial protocol expected by your computer. Once power is applied, the program fetches data from the sensors and sends it to the serial port.

The data from the DS18S20 arrives in a format peculiar to the sensor. The program calculates the temperature from the data and translates it into human readable ASCII digits output in a continuous stream comprising the sensor number followed by temperature reading to 2 decimal places.

You can simply capture the data to a text file and then import it into Excel to produce tables and charts of temperature readings over time. The users can tailor the input data stream to suit their purpose - it may be dumped into an Excel spreadsheet, or they can write BASIC programs using the INPUT command to grab the readings. Please refer to the Usage Instructions and Logging Software sections below for more detailed information.

Full details on the DS18S20 sensor can be found in the Data Sheet

 

Usage Instructions

Plug the circuit into the serial port of a computer. Set the computer to expect serial data at 2400 baud, 8 bits, no parity, one or two stop bits. Ask the computer to raise the DTR signal (see below for software that will do this for you.) The microcontroller will start talking to the connected DS18S20 sensors and the circuit should begin transmitting data to the computer. For example:

R V1.0 1999-12-21 22:05:03 C
   1 0022.50
    2 0022.47
    3 0022.52
    4 0022.53

The first line sent by the microcontroller is a reset notification, which includes the microcode version, a date and time serial number, and either a C or an F, depending on the GP3 pin at the time.

The sensor data is reported in the international standard Centigrade if the GP3 pin is tied low. If it is tied high, then the data is converted to Fahrenheit. This is achieved by simply adding a jumper wire across the appropriate PCB position. A larger range and accuracy is obtained from running in Centigrade mode; users are advised to make their conversions within the attached computer.

Cable suitable for the sensor connections can be our Order Codes CAB859 or CAB588.

Other Optional Extras

  • M-F Serial Port Lead (Order Code LDC441)
  • Extra DS18S20 sensors (Order Code DS18S20)
  • optional PCUSB6 for USB connection
  • Can be used with our optional Serial Input RF Data Link Transmitter (Order Code 3173) and Serial Output RF Data Link Receiver (Order Code 3174) to create a remote wireless link to the PC

Logging Software

A wide range of software is available. If you have any you wish to submit then please let us know.

Temperature Logger for Windows New!

Temperature Logger is an easy to use Windows program suitable for 98,NT, ME, 2000 and XP. This program

  • displays the temperature of each DS18S20 connected
  • graphs the temperature of each DS18S20 connected
  • is able to log the time and date stamp and the temperatures to a CSV format file. You can then easily import the files into Excel for analysis
  • monitors and displays the minimum and maximum temperatures of each sensor
  • Download Temperature Logger
     

Temperature Logger 2 for Windows

This is another Windows Temperature logger written by Kevin Gray. Provides Min - Average - Max readings, High and Low alarms and Archive. Download here.
 

Temperature Sensor Data Logger 1.2

Accepts temperature data from the circuit and periodically logs the values to a disk file. The file is named with the current year and day number, e.g. 2000070.log, and is formatted as a comma separated value (CSV) list. You are expected to use other software to analyse the data collected. Full source code is provided under the GPL license.

  • tsl11win.zip for Microsoft Windows. Tested on Microsoft Windows 95, Microsoft Windows 98 Second Edition, Microsoft Windows 2000 SP1, and Microsoft Windows NT 4.0 SP6. Unpack the ZIP file into a directory and run TSL.EXE.
     
  • tsl11dos.zip for FreeDOS or MS-DOS. Tested on MS-DOS 4.00.950 on a 386/25 using floppy disk only, and on a machine with a hard drive. With floppy disk, do not exceed a logging rate of once every two seconds. Unpack the ZIP file onto a bootable floppy or a hard disk directory, then run TSL.EXE. If you have no hard disk partition, ignore the warning message about "c:\cwsdpmi.swp".
     
  • tsl-1.2.tar.gz source code for all three versions above. Requires CYGWIN to build the Microsoft Windows version. Requires DJGPP to build the FreeDOS/MS-DOS version. Use this version on Linux; just unpack the tar.gz file and type "make". Includes a file ChangeLog that describes the changes made to each released version.
     
  • http://quozl.linux.org.au/darcs/tsl/ is a Darcs repository of tsl, patches are welcome.
     

Graphical Temperature Sensor Data Logger 0.1

Accepts temperature data from the circuit and displays them on four horizontal sliders. Provides an option for resetting the microcontroller by lowering DTR, and has logic to detect lack of data flow. Currently does no logging (use the program above). Full source code is provided under the GPL license.

Graphical Temperature Sensor Data Logger 0.1
 

  • gtsl-0.1.tar.gz for Linux, tested on Red Hat Linux V6.1, with GTK+ V1.2.6. Unpack, ./configure, "make", "make install", attach the circuit to the first serial port and run gtsl.
     

Design Discussion

Some people will have a number of comments about the design.

Why not operate the DS18S20 sensors on a bus instead of per port? There is insufficient memory within the microcontroller to remember the device address for more than one or two sensors. It is simple to remember which pin is being addressed.

This circuit may not work with some serial ports. So far, all six or seven ports tested have worked fine. The reason is that the voltage swing of the transmit data to the computer is not within specification, however the detection band for most serial ports accepts it.

No protection is present for lightning damage. Adding this protection is beyond the design criteria of the kit. Users should disconnect the device before experiencing lightning if the cabling is of significant length.

The 78L05 regulator may not be able to regulate properly if the current and voltage provided by the serial port DTR pin is insufficient. Ideally this should be a more expensive low drop regulator, or a zener diode instead. Symptoms of insufficient voltage are loss of the start of the verbose reset packet.

The 1N4004 diode could be replaced with a diode having a lower voltage drop.

In fact, the DTR line could be just connected to the 12V supply rail within the computer itself in order to get around most of the power problems.

Why isn't there a MAX232 or other chip to change the signal levels from 0V to +15V and 5V to -15V as required by the EIA232 standard used by computer serial ports? Almost all serial ports are offset such that voltages above 4V are recognised as being logic 0, and voltages below 1V as logic 1. This allows external devices the ability to violate the standard by sending an inverted 0V/5V signal.

This means the device is not suitable for long cable runs, and may not work with all serial ports. However the author has tested the device on more than 30 ports with no issues.

 

Trouble Shooting Hints

It doesn't work on some serial ports, what to do?

Q. Will it work with the DS18B20?
A. The code works well for DS18S20 sensors. It works acceptably for DS18S20 sensors, with a slight degradation in reading accuracy. It doesn't work properly with the DS18B20.

The reason it doesn't work is that the data is in a different format inside the sensor. The bits are used for different purposes.

It doesn't work correctly with sensors at a long distance
We believe the sensors may be located more than 200 metres from the PCB. Just check that the remote VDD is above 4.4Volts. The kit designer recommends 10uF tantalum capacitors be placed across the power supply pins (not supplied) to minimise random errors and possibly get increased range.