|
|
|
|
|
|
Serial Port Temperature Sensors - Hardware Interface
This page describes the electronic circuitry required to interface
to the temperature sensors via a PC's serial port.
Schematic
The serial port interface circuit was taken from page 21 of the
Maxim Application Note 74: Reading and Writing iButtons via Serial Interfaces,
and redrawn by Martin using
Circad'98 for Windows.
This circuit is a generic circuit for communicating to any 1-wire device via
a serial port, and works reliably with the DS18S20 temperature sensors.

1-wire serial port interface circuit
The circuit consists of four connections to the PC's serial port, two connections to the
temperature sensor, two zener diodes, two Schottky diodes and a resistor.
Due to the small number of components, it is possible to build a circuit that is small
enough to fit inside a plastic DB9 serial port shell.
Note that commercial versions of this circuit are readily available -
Maxim and
various
other vendors sell serial port and USB versions.
Sensor Pinout
For the DS18S20 sensor in a TO-92 package, the pins are, from left to right:
- GND - ground
- DQ - data in/out
- VDD - power supply voltage (unused)

temperature sensor pinout
The VDD terminal is not used (but needs to be grounded),
as the circuit allows the sensor to operate in parasitic mode,
sourcing required power from the data terminal.
Note that running the sensor in parasitic mode reduces the maximum temperature it can
report is decresed from 125 degrees Celcius to approximately 70-75 degrees Celcius, but this
should be ample for most applications.
Note that real-world testing indicates the maximum temperature in parasitic mode may be lower
than 70-75 degrees.
A sensor (in parasitic mode) was installed to monitor the air temperature inside a metal cabinet housing
a PC, UPS, various power supplies for one of the WAFreeNet access points.
The cabinet is exposed to full sun each afternoon,
and in the heat of a Western Australian summer, the contents of the cabinet get very hot.
On Friday 26 January 2007, the DS18S20 stopped responding, with the last reported
temperature inside the cabinet being 63.4 degrees
(the maximum temperature reported by the Bureau of Meteorology for that day was just over 41 degrees).
Several hours later, when the temperature had cooled to
approx 59 degrees, the sensor started responding again.
A graph of the cabinet temperature for that day is available here.
Component List
The following components are required for the serial port interface circuit:
- DS18S20 1-Wire Parasite-Power Digital Thermometer
- D1 1N5228 3.9v zener diode
- D2 1N5234 6.2v zener diode
- D3,D4 1N5818 Schottky diode
- R1 1.5kohm
- female DB9 serial cable
Note that D1 can be substituted with a 3.6v zener diode if necessary.
Construction Details
The serial port interface circuit can be prototyped on breadboard,
allowing you to confirm correct operation of the temperature sensor
and circuit before constructing a more permanent version.
| |
| |
interface circuit assembled on breadboard
|
Once the operation of the circuit has been confirmed, it can be constructed on some
vero board, as shown in the photo below.
Vero board is ideal for this simple circuit, and allows for a relatively compact layout.

completed circuit on vero board
Circuit Inside A D9 Plastic Backshell
With some careful trimming of the vero board, it can be made small enough to fit
inside a D9 plastic backshell, thus providing a very compact temperature sensor circuit.
A cable tie on the sensor wiring is used to provide strain relief, to prevent
the sensor wiring connections to the vero board being pulled off the board.

circuit installed in a D9 plastic backshell
Note that a small piece of tape was added to the end of the vero board, to prevent
it from shorting out on the exposed pins on the serial port connector.
The sensor was soldered to the other end of the length of wire, with pins 1 and 3 of
the sensor being connected together. A short length of heatshrink is used to
insulate pin 2 from the other pins on the temperature sensor.

heatshrink over the sensor's centre lead
Another length of heatshrink is used to cover the wiring to the temperature sensor,
leaving the sensor protruding from the end of the heatshrink to ensure adequate
exposure to ambient air for temperature monitoring.

heatshrink over the sensor and wiring
Installing the circuit inside the D9 plastic backshell provides for a very compact
and robust serial port temperature sensor.

completed serial port sensor
If desired, additional temperature sensors can be added in parallel, using longer lengths
of wire to attach them to the interface circuit.
This will allow multiple temperatures to be monitored at varying locations, with a single
serial port interface circuit.
Circuit Inside A Mouse
When looking through my junk box for a serial cable to use for the interface circuit,
I found several serial mice.
Not only could a serial mouse provide a serial cable, but the mouse itself could also
be used to house the interface circuit, thus providing a robust "case" for the circuit.

donor serial mouse
After opening the mouse, and discarding the ball and mouse circuitry, a
3/16" hole was drilled in the upper half of the mouse case, and provided
a snug fit for the temperature sensor.
The interface circuit was installed in the mouse case, and the case was closed.

circuit and sensor installed inside the mouse
With the sensor protruding through the top of the mouse case, the sensor will be exposed
to ambient air, and will thus provide an accurate temperature reading wherever it is located.

temperature sensor protruding from the mouse
If desired, the sensor and the circuit can be fixed in place using some hot melt glue,
to prevent any movement.
The mouse provides a robust "case" for the circuit, and allows the temperature sensor to be
placed a distance away from the PC it is connected to, due to the
reasonably long serial cable.
last updated 28 Jan 2007
|
|
|
|
|
|
|
|
|