IOM #142A Serial Relay Output / Optoisolator Input

with Dual Runs to Multiple DS18S20/DS18B20/DS1822 Temperature Sensors.

DS2438 Temperature and A/D Sensors,

DS2450 Quad 12-bit A/D and DS2423 Dual Counter

Peter H. Anderson
915 Holland Road, Bel Air, MD 21014
http://www.phanderson.com, pha@phanderson.com


Ordering Inforation.


(Mar 13, '05). Control of a Relay using Liberty Basic - For a PC running Windows.


Note. Prior to Nov 1, '03, all units were shipped identified as IOM #142. All subsequent units are identified as IOM #142A.

The IOM #142 was capable of interfacing with Dallas devices DS18S20, DS18B20, DS1822 and DS2438. The "T" command caused the module to search for all devices and report the temperatures and in the case of the DS2438, the voltages at V_ad and V_dd. Unlike other commands, the IOM #142 did not provide a qualifier to specify on which run the measurements were to be performed.

The IOM #142A expands on the IOM #142 to also include the DS2450 Quad A/D and the DS2423 Dual Counter. The new "D" command causes the unit to display all data associated with all devices which are found. In the case of the DS18S20, DS18B20 and DS1822 this is simply the temperature. For the DS2438, this is the temperature and the two voltages, at V_ad and V_dd. For the DS2450, all four voltages are displayed and for the DS2423, the values of the two 32-bit counters are displayed.

The command "T" is now used to display the temperature for only those devices which have temperature measurement capability (DS18S20, DS18B20, DS1822, DS2438). The "V" command causes the unit to display the voltages for those devices which have an A/D capability (DS2438 and DS2450). The "C" command displays the vaues of the 32-bit counters for all DS2423 devices found.

In addition, commands "D", "T", "V" and "C" now require a specifier 0, 1 or 2. For example

C0	' search and report DS2423 counter values on both Runs 1 and 2
T1	' search and report temperatures on Run 1
D2	' search and report all data on Run 2

If you purchased the older IOM #142, and desire to upgrade to the IOM #142A, it is merely a matter of swapping PIC processors. The upgrade processor for the IOM #142A is $5.00 plus shipping.


Overview.

The IOM #142A 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). The serial interface consists of simply TX, RX and GRD and virtually any USB - RS232 convertor may be used for communication if you do not have a conventional COM Port.

The unit 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.

The IOM #142A may also be used to perform measurements on any mix of Dallas DS18S20, DS18B20 and DS1822 temperature sensors, DS2438 temperature and 10-bit A/D converters, DS2450 Quad A/D converters and DS2423 dual counters on each of two twisted pair runs. Up to sixteen devices with a maximum of 200 feet of twisted pair cable may be accommodated on each of the two runs.

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 two twisted pair runs to the multiple Dallas 1-W devices. A reset lead is also provided. Momentarily ground to reset the processor. A source of +5 VDC is provided for powering external circuitry such as remotely located DS2438 temperature and A/D sensors, DS2450 quad A/Ds and DS2423 dual counter and such sensors as an MPX4115 pressure sensor and an HIH-3610 relative humidity sensor.

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 temperature sensor is provided with the package. Additional DS18S20, DS18B20s,DS2438Z and DS2450 sensors may be purchased separately. I do not currently stock the DS2423 Dual Counter, but will do so if there is a demand.

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 for use in the US and Canada.

A DB9M to DB9F through serial cable is also included.

Pricing.

Guarantee.

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.

S1
S2
S0
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.

Measurements may be performed on the two Dallas 1_wire runs using the "D", "V", "T' or "C" commands followed by a digit 0, 1 or 2 to indicate the desired run. "0" specifies the measurements are to be performed on both runs 1 and 2, a "1" specified run 1 and a "2" specifies run 2.

On receipt of the "D" command, the IOM #142A performs a measurement sequence, finding each Dallas 1-W device on the specified 1-wire run and performs the appropriate measurements. For example, in resopnse to the command "D1";

D1
10 20 29AE 3.781 0.065 0.066 0.066
11 10 6A0B 35.56
12 10 9DD7 35.00
13 28 DB9C 34.50
14 22 5BFC 35.75
15 26 09CE 33.93 0.11 4.95
16 1D C827 00000003 00000010

On Run 1 (first digit) the processor found a DS2450 (code 20), two DS18S20s (code 10) and one DS18B20 (code 28) and one DS1822 (code 22), one DS2438 (code 26) and one DS2423 (code 1D). For the DS2450, note the four voltages, for the DS18S20, DS18B20 and DS1822, note the temperatures in degrees C, for the DS2438, note the temperature followed by the two voltages and for the DS2423, note the values of the two 32-bit counters.

(The order in which devices are found is a bit like an telephone directory arranged with the last names spelled in reverse. Thus, 0x20 is 0010_0000, 0x10 is 0001_0000 and 0x28 is 0010_1000. Reversed, these are 0000_0100, 0000_0010 and 0001_0100. Thus, 0x20 is found before 0x10.)

Voltage measurements on all devices on the specified run having A/D capability be performed using the "V" command.

A sample response;

V1
10 20 29AE 3.781 0.065 0.066 0.0663
17 26 09CE 0.11 4.95
As each device is found, the IOM #142A determines if the device is a DS2450 or DS2438 and if so, performs the A/D measurements and displays the voltages. Note that there is a gap in the sequential numbering as a number of devices not having A/D converters were found. Note that the temperature associated with the DS2438 (Code 26) is not displayed in response to the "V command..

Temperature measurements on all devices having temperature measurement capabilities may be performed using the "T" command.

T1
11 10 6A0B 26.81
12 10 9DD7 26.75
13 28 DB9C 26.81
14 22 5BFC 27.25
15 26 09CE 26.50
As each device is found, the IOM #142A determines if the device is a DS18S20, DS18B20, DS1822 or DS2438, and if so, performs the temperature measurement. Note that the sequential numbers 10 and 16 are not reported as a DS2450 was found first and this does not have temperature measurement capability nor does the DS2423 which was found last. Note that the voltage measurements associated with the DS2438 (Code 26) are not displayed.

Counter measurements on all DS2423 dual counters on the specified run may be perfromed using the "C" command.

C1
16 1D C827 00000003 00000010

The measurement time associated with performing a temperature measurment is nominally one second. Other measurments are performed within 100 ms.

Note as each device is found, it is assigned an identity consisting of the run (0 or 1) and a sequential number in the range of 0 - F. This sequential number is simply a running number which is assigned as each device is found.

The second field identifies the type of device; DS2450 - Code 20, DS18S20 - Code 10, DS1822 - Code 22, DS18B20 - Code 28, DS2438 - Code 26 and DS2423 - Code 1D. Field three is a unique 16-bit identifier for the device. Note that the actual Dallas ID consists of 48-bits and in the above, only 16 are being used. However, the sixteen bits provides for 65,535 combinations and I seriously doubt anyone will find a duplication in their system.

Note that if you modify your system, the sequential number in the first field associated with a particular sensor will probably change. The order in which each device is found is in no way related to its physical location on the twisted pair rail. Modifying your system may be inadvertent. If you rely on this sequential number and the beagle eats the sensor in the living room, you might actually be measuring the temperature in the freezer and believe it to be that in the living room. This is, of course, an extreme case, but hopefully it drives home the idea of using the serial number in field three to specifically identify which temperature is associated with each physical sensor.

If no devices are found on a run, no data is returned to the PC or similar for that run. Indeed, there may be no devices on the run. But, other possibilities are there is a "stuck at ground" fault on the run or there is a break in the cable.

If there is a communications error performing a measurement, the value -88.88 is displayed. If this occurs frequently, it is a red flag that there is too much cable on the run. Too much cable (actually, the capacitance associated with the cable) will cause intermittent communication problems with all devices on the run, and not simply those sensors which are most distant from the IOM #142A unit.

The range of the temperatures at which operation is assured for the DS18S20, DS18B20, DS1822 and DS2438 is -40 to 85 degrees C. The unit provides a resolution of 0.03125 degrees C for the DS18S20 and DS2438 and 0.0625 resolution for the DS18B20 and DS1822. Please refer to the data sheets at Dallas Semiconductor for absolute accuracy over the full temperature range. (Note that the DS1822 is functionally the same as the DS18B20. In fact, the DS1822 was designed as an economy version of the DS18B20 at some sacrifice in accuracy. However, I have found the inferior DS1822 costs just about the same as the DS18B20).

The DS2438 A/D converter is a ten bit A/D and the device uses an internal band gap reference such that the readings are reported in VDC over the range of 0.0 to 10.23 VDC. The resolution is 10 mV.

The DS2450 Quad A/D is operated in a 12 bit mode using an internal badgap reference which quantizes the input voltage on each of the four channels over the range of 0.0 to 5.12 VDC. The resolution is 1.25 mV.

The DS18S20, DS18B20 and DS1822 operate in the parasitic power mode. That is, the power required to operate the sensor is obtained from the signal line. Thus, only the DQ and GRD leads are connected to these devices.

However, with DS2438, a power source in the range of 2.5 to 10.0 VDC capable of providing 100 uA is required at Vdd. This may be locally supplied, or a source of +5 VDC may be run from the IOM #142A unit. In some situations, you may have a voltage source having a low internal impedance and in the range of 2.5 to 10.0 VDC that you wish to measure and this may be used to supply Vdd. In this case, the DS2438 is actually performing two useful 10-bit A/D conversions, one on Vad and the other on Vdd.

Similarly, a power source in the range of 4.0 to 6.0 VDC is required for the DS2450 quad A/D coverter. It is suggested that +5 VDC be run from the IOM #142A unit.

Note that as both the DS2438 and the DS2450 use internal bandgap references, the accuracy of the voltage used as power does not affect the accuracy of the measurement.

A power source in the range of 2.8 to 6.0 VDC is required for the DS2423 dual counter. It is suggested that +5 VDC be run from the IOM #142A unit.

I have seen arrangements which use Schotkey diodes and filter capacitors to derive the Vdd from the DQ signal line. I hesitate to suggest this is good design as even the 0.1 mA required for the DS2438 drops the voltage on the DQ lead by a full 0.5 VDC. What is worse is using this technique to also power a remote MPX4115 pressure sensor or an HIH-3605 relative humidity sensor. Dallas used this technique with a humidity module which I see is still available from a firm in Mexico. Terrible design. Add one of these units on a run and there is a good chance of being unable to communicate with any of the other devices on the run.

In today's world, we have inexpensive CAT 5 low capacitance cable with four twisted pairs. Use one pair for DQ and GRD for all devices on the run. Use another pair to provide power for the DS2438, the DS2450 and DS2423 devices. Add a 0.01 to 0.1 ceramic capacitor between Vdd and GRD at the each of these devices.

Notes.

1. This module is distributed with a programmed PIC which is code protected. The source code written in PIC C from CCS Info is available for $2500.00.

2. Use the +5 VDC output output lead judiciously. The current should not exceed 20 mA. This may be used to power the remotely located DS2438, DS2450 and DS2423 devices and a a small amount of peripheral circuitry.

3. Several years ago, Dallas marketed a DS1820 in a PR35 package (an elongated TO-92 transistor package). They then replaced this with the DS18S20 in a TO-92 package. However, for whatever reason, Dallas marks these parts as DS1820. The IOM #142A design is compatible with both. They are both code 10 devices.

4. Note that my 200 foot recommendation is 200 feet total for each run. Thus you might have a single 200 foot twisted pair or two 100 foot pairs or five 40 foot pairs in a star configuration. I may be very conservative with this 200 feet. Using low capacitance CAT 5 cable, you may well find you can go much further. But, once you begin to receive communication errors (-88.88), you have probably stretched the cable too far.

Ordering Information. Please order as IO Module IOM #142A.