Purpose of this article is to inform readers and developers about smart and useful PC peripheral for temperature measurement (according to my experiences with need of temperature collecting during device development or temperature obtaining in home automation).
Described device allow temperature measurement in 4 places with computer . It is connected to Game port of PC (which is mainly not used) and the sensors distances from computer can be up to 10 meters. Absolute precision of temperature measurement is better than 1°C within temperature range -30÷100°C (given by used sensors). But resolution is (according to practical experiences) 0.01°C (noise of measurement). Every sensor is connected with 3-wire thin cable and because information transfer from sensor is digital, then measurement is not dependent from cable properties. Service program on PC displays sensors temperatures, can chronologically collect and write data to file and can perform calibration of connected sensors.
Equipment uses sensors
SMT160-30. This are integrated circuits for temperature
measurement. They needs for proper operating only supply voltage +5V. Output
from sensors is digital signal with frequency cca 3kHz (1÷4kHz), which duty
cycle of period is proportional to temperature. Their main features are: only
3-wire connection, digital output, long cable length (according to the vendor
datasheet up to 20m). For realization of thermometer we need only temperature
sensors, leading-in cables, connector CANNON15 (male with cover), eventually
protection fuses (100mA). Schematic of thermometer connection is on the next
picture. We see that thermometer is very simple. Advantage of the computer
Gameport connection is presence of supply voltage +5V on Gameport, by this we
remove the need of external powering. Fuses 100mA protect power supply from
short circuit and is located inside of cover of connector CANNON15 (because by
mistake we can damage sound card!).
Schematic of 4-channel thermometer:

and its physical realisation:


Temperature sensors SMT160-30 gives to their output signal, which duty cycle is directly proportional to measured temperature. This signal is then connected to input pins of Game port, which are dedicated for joystick buttons. Service software scan this signal (its duty cycle) and compute it as sensor temperature according to calibration constants (linearity and offset). Because output frequency from sensors is relatively high, there are given higher requirements for mathematic calculations and speed of data collecting - but this all is solved by PC software.
Software intelligence is the heart of whole thermometer. The main program window displays temperature of every sensors and allow setting of measurement parameters. Checking of check boxes we can choose which sensor temperatures we will measure. We can choose interval between two measurements , integration time of one measurement and how many last values will be averaged (floating average). Increasing of integration time we increase precision of measurement. Increasing the number of averages values we also increase measurement precision, but together we adding low-pass filter for measured temperature (suppression of fast temperature changes). If some sensor is not present, program automatically detect this absence.
There is possible to change names
of every sensor (e.g. for better sensor location). Names of sensors
we can change by the next procedure: We move selection by mouse or keyboard
(tabulator or arrows) to given sensor that thin frame is around the sensor name.
Then we press F2 key - name is selected with blue color - and we are in edit
mode. Now we can write sensor name. Edit mode we finish by pressing key F2 (or
Enter, or Esc).

Program allow to perform also calibration
of every sensor. From sensor vendor have SMT160-30-92 devices
guaranteed precision cca 1°C in temperature range -30÷100 °C, but this is
possible to improve with changing slope and offset of transfer function of
sensor. Linearity of sensor is guaranteed from vendor to max. 0.2÷0.4 °C ,
what is the maximum precision of measurement after calibration. In less
temperature range (e.g. room temperatures) is possible to obtain precision
0.1°C, which is very good result. For calibration process is in software
separate window. Here we give the true temperature (measured by very precise
thermometer) and temperature measured by our sensor. We can calibrate separate
offset or linearity (at that time we enter only one pair of temperatures), or we
can do whole calibration from two different temperature points (e.g. by 0°C and
by 100°C). Calibrated constant (linearity and offset) will be saved to "ini"
file.

Program is possible minimize to
system tray (by command "Hide" from context menu, clicking
to icon in system tray or by pressing key "Esc") and again
restoring. In balloon window in system tray is displayed temperature of first
sensor. If we click by middle button to icon in system tray - temperature will
be displayed in system tray (not working if we use driver for mouse wheel).
Context menu is possible to show by right mouse click to icon in system tray.
![]()
Program has sound output too.
It says us the temperature of given sensor if we click on it in context menu. If
you want to customize voice output for your language - record "wav"
files with numerals in "\Sound" directory.

For measurement and research purposes program allow
to record temperatures into file. File has CSV format and there is
possible to open it in Microsoft Excel. In Microsoft Excel you can do graph of
temperatures of sensors. Before graph making is good to set in Excel format of
time to hh:mm:ss.00 (first column) and date to dd:mm:yyyy (second
column). Record process we start from context menu and by the same way we stop
it.

For watching temperature limits
is in software window Alerts , where we can define upper and lower temperature
limits. Overflowing of this limits for given sensor is signalized by software in
two ways. There can by displayed window to foreground, or software
says through sound card given temperature with alert message on given sensor
(voice output has format: "alert" "sensorX"
"has" "<number>" "grades", e.g.
"Attention first sensor reachs 35.41 grades"). This notification is
repeated in 30 seconds interval. If there are alerts from more sensors, then
they are notified cyclically (and priority has upper temperature limit).

Program remembers last settings and
calibration in "ini" file (state when program is
finishing), so when we can use another sensors series we must exchange this
"ini" file because of calibration constants. Main window of program
during moving is catching of screen boundaries (e.g. as WinAmp). If we want to
start program minimized we stop it also minimized (in context menu
"Exit" in system tray). In case of closing program during temperature
recording - program warning us to this (because of temperature stop by our
"bad clicking") - and on the next start program ask us for option of
recording.
If you can see this thermometer in system "Device
manager" (but now only under Windows9x), you must
manually add new hardware and give to file \GamePortTemp\INF\GameTemp.inf :
"ControlPanel"-"Add New
Hardware"-"Next"-"No the device isn't in the
list"-"Next"-"No, I want to select the hardware from a
list"-"Sound, video and game
controllers"-"Next"-"Have
Disk"-"Browse"-"<...\GamePortTemp\INF\GameTemp.inf>"-"OK"-"OK"-"Finish".
Then in window "Device manager" will be displayed device Temperature
Monitor on Game port - as is displayed on the next pictures. This has no
effect to program functionality and this is only for better aesthetics (and for
showing: this is possible to make too ;-) ).

System requirements:
Functions of program was tested on operating systems Windows9x
and Windows XP (therefore program should also works under WindowsNT/2000/XP
- with administer privileges). Program requires processor at least
Pentium/AMD-K6 and upper (not work on processors 486 - write only message
window). It was tested on configurations from Pentium 150MHz without MMX
up to Pentium 1000MHz (therefore all higher than 486). Program
automatically detect presence of Game port in computer and without
Gameport is not running. There is possibility to run program more that only one
in the same time - but program ask you for this option.
On the next pictures is example
of measurement of temperature in my flat. Sensors were on my table
near window in square configuration with distances cca 1cm. Temperature was
sensed from morning to evening (time in on x axis). From graph we can see that
sensitivity of sensors is really good (interval of measurement was 2 seconds
with integration time 30ms and averaging last 10 measured values).
Because sensors distance were near, they show the same temperatures during
morning . On the begin we see the giving the room an airing - fall down of
temperature followed by temperature rising. But about 2 p.m. temperature rapidly
increases and is not the same for all sensors. Temperature difference between
sensors was "in pairs". After temperature decrease the sensors again
come back to the same temperature. This graph was surprise for me too. Therefore
I was researching why was this behavior - and here is the explanation:
Sensors were on my table near window. There were sunny winter
day and about 2 p.m. the sunlight rise from opposite house - increasing of
temperatures. But why the sensors difference? Because they were in square
configuration and the two front sensors shadow the two back sensors. The sharp
temperature decreasing in the middle of graph - this is shadow of decorative
grid on window (thin grid - short duration of decrease). The temperature
decrease after 3 p.m. was not so fast, because my table is black and was hot
from sunlight. At the end of graph we can see our coming back from job -
slightly temperature increase (zoom of this area is on the second graph -
increase by 0.2 °C).


Presented program is for non commercial use as freeware
(but if you like it, you can donate me - I spend
more time to this project - and the main is great idea...). Is
possible to download it from internet : as
packed archive GamePortTemp.zip (or version 0.95 for computer
temperatures monitoring: GamePortTempPC.zip). This archive contains pack of files, which
you only copy to some arbitrary directory. If you can change voice outputs from
software, only exchange files in "Sound" directory with yours (there
is my voice in the files ;-) ).
Presented sensors SMT160-30 is possible to buy in
GM-electronic http://www.gme.sk (or http://www.gme.cz)
- price cca 4,-US$ (or 3,-EUR).
Information about last version:
version: 0.96 (DLL 0.72)
changes in the versions:
v0.8 - basic version for Windows9x/ME
v0.81 - support for WindowsXP/NT/2000
v0.83 - some cosmetic changes and correction of calibration under
WindowsXP/NT/2000
v0.84 - possibility of sensor names change
v0.85 - removed problem calibration reloading from INI file
v0.86 - removed problem of detection non standard location of Creative
SoundBlaster in system, logging interval longer than 1 minute
v0.87 - logging interval longer than 1 minute also under Windows XP, extending
interval to 1milion seconds (999 999 999 milliseconds - cca 11 days)
v0.88 - removed problem of unreliable driver install under Windows XP (sometimes
was necessary program restart)
v0.89 - removed problem of non detection of SoundBlaster Live (change only in
DLL)
v0.90 - possibility to measure after computer hibernation (in previous versions
was necessary program restart)
v0.91 - possibility to continue in recording into file without user intervention
- name of file is as parameter of command line
v0.92 - changed DLL library : build-in HTTP server providing temperature on web
page. Only write on some computer on network into browser http://<IPaddress>
or http://<computername> or (if DLL runs locally) http://localhost
and webpage \DLL\GameTemp.htm is executed by internal webser (parsing
temperatures). For more information (and example) see file \DLL\GameTemp.htm .
You can produce more webpages - html files : then is the request in form http://<IPaddress>/<filename>.
v0.93 - small change about decimal point in HTTP server
v0.93 (DLL 0.72) - added support in DLL library for initialisation from INI file
(calibration data and parameters of HTTP server)
v0.95 - from Vlastimil Jireček impulse added support for computer
shutdown in case of overheating (and writing first three temperatures into
"TempLCD.txt"), designed for temperature measurement of computer
components (link: Luxury,
beautiful and unique wood Case)
v0.96 - according Vlastimil Jireček requirements changed format of
"TempLCD.txt" file - now the temperatures are written as pure numbers
into separate rows (good solution for sending temperatures into external LCD
display with service software)
Due to big users/developers interest (and my busyness to
answering to many users questions) I publish all source
codes of this software: DLL library and application.
DLL Library "GameTemp.dll" is core of
this system and contains basic functions for temperature measurement and
sensors calibration. Application uses functions from this DLL library and
gives to user graphical interface. Developer who want to write own application
with different interface - only use functions from DLL library (only 5
functions). In DLL library is build-in also HTTP server - therefore is only
necessary open this library with another application and HTTP server will be
working properly.
Source codes (together with binaries) you can download as
package GamePortTempSources.zip
[1] datasheet of SMT160-30
[2] http://www.cesko.host.sk - section
Hardware or Software
[3] http://www.gme.sk , http://www.gme.cz
- GM-electronic : sales of sensors SMT160-30
[4] my e-mail : cesko@internet.sk
Introduction
Sensors connection
Principle of operation
Application software
Examples of measured graphs
Download
Source codes
Links
author: Ing. Igor Češko:
homepage: www.cesko.host.sk
e-mail: cesko@internet.sk