Serial Port Temperature Sensors + Windows
Copy-pasted from here: http://martybugs.net/electronics/tempsensor/software2.cgi
Overview
On linux, the digitemp application is required to query the temperature sensor.
There are various software applications that allow DS18S20 temperature sensors to be queried in Windows, but the easiest is the Windows port of digitemp.
Installing digitemp
Download digitemp for Windows, and extract digitemp.exe from the zip file.
Note that you’ll need the version suitable for the DS9097 serial port adapter (ie, digitemp 1.x), as the serial port interface circuit described previously is equivalent to the DS9097U 1-wire serial port adapter.
Configuring digitemp
Initialise digitemp
First we need to configure the interface by telling digitemp the serial port that the interface is connected to.
By default, digitemp will look for a configuration file (digitemp.cfg) in the current working directory, so we’ll explicitly specify the location of the configuration file.
Assuming the interface is connected to COM1:
digitemp -i -s1 -q -cc:\temp\digitemp.cfg
You should see output similar to this:
Turning off all DS2409 Couplers . Searching the 1-Wire LAN 100486B60008009E : DS1820/DS18S20/DS1920 Temperature Sensor ROM #0 : 100486B60008009E
This will create a file c:\temp\digitemp.cfg containing the configuration information for digitemp.
Adjust Read Delay
Note that the DS18S20 temperature sensor has a slightly slower response time (to convert its reading to a temperature) than the original DS1820 sensor The DS18S20 sensor takes approx 750ms to do the temperature conversion, and digitemp defaults to a 1000ms read delay.
If you are occasionally getting temperature readings of 85 degrees Celsius (which is the sensor’s error code), you’ll need to slow down the read delay performed by digitemp from the default 1000ms.
To set the read delay to 2000ms and store this configuration in c:\temp\digitemp.cfg, run the following:
digitemp -i -q -r2000 -cc:\temp\digitemp.cfg
With relatively short wire runs between the sensor and the serial interface circuit, I’ve found that the default read delay of 1000ms provides reliable temperature readings.
Reading Temperatures
Query Temperature
The sensor can now be queried for the current temperature (the “-a” tells digitemp to read all connected sensors):
digitemp -a -q -cc:\temp\digitemp.cfg
and output similar to this should be displayed:
Apr 17 23:09:56 Sensor 0 C: 26.69 F: 80.04
Handling Errors
Note that occasionally the DS18S20 temperature sensor will return an error code, returning a value of 85 degrees Celsius, instead of a valid temperature reading. If this occurs, re-reading the temperature will normally return the correct value.
MySQLTuner tool Reading Arduino serial ports in Windows 7 with Python + Pyserial
Comments are currently closed.