Serial Relay Output / Optoisolator Input

with a Single Run to Multiple DS18S20 Temperature Sensors

IOM #140

Peter H. Anderson
915 Holland Road, Bel Air, MD 21014,

Note. This unit has been replaced with the IOM #142 There is no change in price.

The IOM #140 unit provided a single twisted pair run which could accommodate up to 16 DS18S20 temperature sensors over a total of 200 feet of cable. The resolution of the temperature was 0.5 degrees C.

The IOM #142 provides two twisted pairs, each of which may accommodate up to 16 Dallas devices over 200 feet of cable. Each twisted pair run may accommodate any mix of DS18S20, DS18B20 and DS18B20 temperature sensors and DS2438 temperature and A/D converter sensors. The resolution of the temperature is 0.03 for the DS18S20 and DS2438 and 0.06 for the DS18B20 and DS1822.

Note that the format of the returned data differs slightly from the IOM #140.

For those who wish to upgrade to the IOM #142, I provide an upgrade kit consisting of an 18-pin programmed PIC, a new Molex connector to interface with the main module and a 4.7K resistor. The only soldering involved is the installation of the 4.7K resistor on the underside of the PCB. If you do not wish to add this, you can operate the module using only the single run. This upgrade package is $10.00.

I will continue to support the IOM #140 and will continue to sell them. However, the new IOM #142 is a much better value.


This is a fully assembled unit that is controlled by a PC COM port or similar (9600 baud, 8 data bit, no parity, no flow control).

It provides four form C relays (15A / 120 VAC, 10A / 240 VAC, 15 A / 24 VDC) with a three position screw type connector for each relay. An LED is provided for each relay such that one can visually observe the state of the relay.

Further, it provides four optoisolators, each with a two position screw type connector and LED.

In addition, it provides the capability of measuring the temperatures on each DS18S20 on a single twisted pair. In theory, up to 256 DS18S20 temperature sensors may be accommodated on the single twisted pair. However, the limiting factor is the capacitance and my suggestion is up to sixteen DS18S20 devices on a maximum of 200 feet of twisted pair cable.

The PCB is professionally fabricated.

The module includes a female DB9 connector, RS232 level shift circuitry, an on-board 5 VDC supply, a Microchip PIC processor, four relays and associated transistors and LEDs and terminal blocks, four 4N37 optoisolators and associated LEDs and terminal blocks.

A connector is provided for the twisted pair run to the multiple DS18S20s operating in the parasitic power mode and also a reset lead. Momentarily ground to reset the processor.

A separate LED is provided which blips one time nominally every ten seconds when idle to indicate the unit is alive and blips multiple times when a command is received from the PC.

The unit is mounted on 0.5 inch nylon standoffs.

One DS18S20 is provided. Additional DS18S20s may be purchased separately.

The unit includes a coaxial power connector which will accommodate a 9 - 12VDC (2.5mm ID x 5.5mm OD female center positive) wall power unit and compatible 120 VAC wall power unit.

A DB9M to DB9F through serial cable is also included.



The intent is designing modules such as this is to involve my undergraduate students in meaningful design experiences, while at the same time providing useful low cost products for hobbyists and tinkerers.

In the spirit of this activity, I don't want people buying items that do not work for them or do not meat their expectations. Thus, this unit may be returned at any time for a full credit.

Detailed Description.

The relays are identified as 1, 2, 3 and 4. Each may be independently operated by issuing either an "N" (oN) or "F" (oFf) command. Note that a 0 operates or releases all four relays.

For example;

N1		' operate relay 1
N3		' operate relay 2
F1		' turn off relay 1
N4		' turn on relay 4
F0		' turn off all relays
N0		' turn on all relays
The processor echoes the command and provides the state of the addressed relay (or relays).

For example;

N1 1
N0 f	' note that all four relays are operated
F1 0

In addition, the state of a relay or all relays may be determined by issuing the "S" (status) command.

The processor echoes the command followed by the state or states of the addressed relay(s).
S1 0	' relay 1 is off
S4 1	' relay 1 is on
S0 e	' relays 4, 3 and 2 are on.
The state of the input optoisolators may similarly be determined using the "I" (input) command.
I1	' read input 1
I4	' read input 4
I0	' read all 4 inputs.
The processor echoes the command followed by the state of the input or inputs.
I1 0	' input 1 is at a 0
I4 1	' input 4 is at 1
I0 c	' inputs 4 and 3 are at logic one.
A temperature measurement differs from the above in that a specific sensor is not addressed.

The PC issues a simple 'T' command which causes the PIC to initiate a complete measurement sequence. The PIC determines the address of a DS18S20 on the twisted pair, performs a temperature measurement and returns both the temperature in degrees C and the 64-bit serial number in hexadecimal format at 9600 baud. It then continues to determine the second address on the twisted pair, performs a temperature measurement, sends the result and this process continues until no additional devices are found.

Each temperature measurement requires nominally one second.

The format of the returned data is;

where DD a sequential hexadecimal number in the range of 00 - FF.

TTT.T is the temperature result in degrees C.

SSSSSSSS SSSSSSSSS is the unique 64-bit serial number of the DS18S20 expressed on hexadecimal

For example;

00 27.5 10D6F33A 00000036
01 26.5 10773B3B 000000CE
02 -5.0  etc
03 105.0 etc
Note that in this example, four devices were found on the single twisted pair. Note that fields are delimited by single spaces and the line is terminated by a new line consisting a CR and LF.

The range of the temperature is -55.00 to 125.00 degrees C. The unit provides a resolution of 0.5 degrees C. Please refer to the DS18S20 data sheet at Dallas Semiconductor for absolute accuracy over the full temperature range.

The serial numbers of the devices are provided to permit the user to ascertain which sensor is which. Note that the two digit device number DD is simply a running number beginning at 00 which is assigned as each device is found using a binary search on each of the twisted pair runs.

Thus, 00 might correspond to a DS18S20 in your PC, 01 to the living room, 02 to the freezer. Assume you then add one on a cold water pipe in the basement. You may well find 00 is still your PC, but 01 is now the water pipe, 02 is the living room and 03 in the freezer.

However, note that once a system is in place, 00 will always be the PC, 01 the water pipe, etc. But if your cat pulls off the sensor in the living room, 02 will then be the freezer.

If you don't wish to use the serial number information, you might consider initially connecting the sensors on a breadboard and use your finger to determine which device is 00, which is 01, etc and then label each of the sensors and then install them with 00 in the PC, 01 in the living room, etc.

Note that all DS1820 devices are operated in the parasitic power mode (the DS1820s use the signal lead for power) and thus a single twisted pair may be multipled from one device to the next.

The PIC is theoretically capable of finding and measuring the temperature of each of 281,000,000,000,000 devices on each of the twisted pair runs. However, the limiting factor is the capacitance of the cable and the capacitance of each DS1820. My guesstimate is that 16 devices on a total of 200 feet of twisted pair is realistic. Note that the use of the parasitic power mode does not limit the amount of cabling nor the number of devices.