ICON 1-wire System
Last updated April 6, 2002
 
Introduction Connection 1-Wire I/O Module Types Configuring ICON 1-Wire I/O
Read 1-wire Inputs and Write 1-Wire Outputs Counting Frequency Measurement

Introduction
The integrated semiconductor manufacturer called "Dallas Semiconductor" manufactures a line of low cost sensors and actuators that are ideal for low cost instrumentation and control for applications such as buildings, homes and greenhouses. These devices include temperature and relative humidity (RH) measurement, 8 bit Analog to Digital (A-D) converter for measuring voltage and on/off status, 10 bit A-D for higher precision, pulse counting (and frequency measurement), digital on/off control (for controlling relays) and potentiometer control (Digital to Analog D-A converter) output. These devices each have a unique 48 bit address and connect to a "1-wire" bus.

A small printed circuit card has been created that can be loaded and configured for the different functions described above (Figure 3). This board contains a four position connector (CON1) for the 1-wire/power bus on one side and a six position connector (CON2) on the other side to connect to the instrumentation or relays. In the case of the temperature and RH sensors this 6 position connector is left off. Also contained on the board is lightning and ESD protection and the Dallas Semiconductor IC.

These printed circuit boards can be fastened to DIN rail fasteners for mounting on a DIN rail. For outdoor use they can be placed inside Carlon (or similar) plastic boxes (available at Home Depot). They also fit in 1.25" PVC pipe. Add PVC end caps, drill small holes for the cabling and seal with silicon rubber to create a very low cost, water proof housing for use in green houses, outdoors or other wet location.

The ICON is the controller for this 1-wire bus (Figure 2). A Cat 5 cable connects the ICON to the first 1-wire device. From here a second Cat 5 cable connects the first 1-wire device to the second 1-wire device. The second connects to the third, etc. This daisy chained Cat 5 cable continues to the last device. Because each bus is daisy chained (and not star wired with a separate cable going from the ICON to each device), the ICON has four separate 1-wire busses that can each go in a different direction. Each bus, however, must be daisy chained. Each bus has a maximum length of 300 cable feet from the ICON to the last device. (However, one bus can go 300 feet in one direction and another bus can go 300 feet in a different direction, thus sensors can be 600 feet from each other as long as the ICON is in the middle. This is something to think about when locating ICON boards and sensors.) The total number of devices can't exceed 64 and the total number of separate input readings and output controls can't exceed 128 for each ICON (this is across all four busses).

The first ICON is part of a two card set that also includes the ICON program processor board (Figure 1). This first ICON is referred to as ICON-LOCAL. ICON-LOCAL connects to the RS232 serial port COM2 on the processor board. ICON-LOCAL converts the RS232 to RS485 and connects to connector CN6. You may use a Cat 5 cable to connect a second ICON to the first by interconnecting their CN6 connectors (Figure 2). All additional ICONS are referred to as ICON-REMOTE. You may daisy chain from the second ICON-REMOTE's CN6 connector to a third ICON-REMOTE. You may continue on and daisy chain to as many as 31 additional ICON-REMOTE boards. The maximum distance from the ICON-LOCAL to the last ICON-REMOTE is 4000 feet.

The ICON "looks" like a Modbus device to your ICON program. Modbus is a serial protocol originally developed by the industrial control manufacturer "Modicon". This company has since been purchased and goes by the name "Group Schneider". This Modbus control protocol has been the defacto open standard for industrial controls for over 20 years. Modbus is popular because the specification is published for anyone to use, its simple and reasonably powerful. Each Modbus node must have a unique unit address in the range of 1 to 255. The first ICON is always given address 255. If you add additional ICON-REMOTE boards you may use the dip switches to assign other addresses. Each separate ICON must have a unique address and it is easiest to assign them in order, 1, 2, 3 etc.

As Modbus is used for ICON there is just one data type called a register which is a 16 bit unsigned integer. Therefore all data values are in the range of 0 to 65535. The ICON further defines the value 65535 as a value indicating that operation of that device has failed (this is not a specification of Modbus). The ICON has three types of registers, the configuration registers, the data input registers and the data output registers.

Connection
Each module must be connected to a 1-wire bus with connector CON1 (Figure 3). This bus actually has two wires, one for the 1-wire signal and a common. Any combination of the above devices can be interconnected along a single bus. The output devices must be powered at all times so a separate pair of wires is used for +5V and common. Category 5 (Cat 5) wire is recommended for this bus. Since there are four pairs in a Cat 5 cable, 1 pair is used for the 1-wire signal and common and a second pair is used for +5V and common. This leaves two spare pairs which can be used to carry a higher voltage, say 12VDC for mechanical relay coils. Or the additional pairs can be used to increase the current capability of the +5V.

Although sensors such as the temperature probes can function with only two wires, adding the power allows all temperature probes to be measured simultaneously. Since it takes almost one second to make a temperature measurement, being able to measure all simultaneously greatly speeds up the scan time if there are many sensors. Connect as follows:
 
Pin Number for
CON1 (Figure 3)
Cat 5 
Wire Color
Description
1 Orange +5V
2 Orange/White +5V common
3 Brown 1-wire common
4 Brown/White 1-wire signal

Since this is a daisy chained bus, you must connect two cat 5 cables to CON1, the cable coming from the ICON or the previous 1-wire module and then another cat 5 from this module to the next (if there is one). You can twist the wires of the same color from the two cables together before inserting into the connector (it is better to solder them). Or use dual insulated ferrules to crimp two wires together and insert into the connector. (For example part number BM-00551 from Automationdirect.com.)

Connect your sensors and actuators to CON2 as follows:
 
OWAD2 CON 2
Pin Number (Figure 3)
Description
1 Common (GND)
2 A-D channel 1 input (Single ended 10 bit 0 to +10V) (RH sensor Honeywell HIH-3610 connects here if used.)
3 A-D channel 2 - input (Differential 10 bit -300mV to +300mV)
4 A-D channel 2 + input (Differential 10 bit -300mV to +300mV)
5 Unused
6 +5V
OWAD4 CON 2 
OWDI4 Pin Number (Figure 3)
Description (Note OWDI4 is same as OWAD4 except 10K ohm pullup resistors are added.)
1 Common (GND)
2 A-D channel 4 input (Single ended 8 bit 0 to +5V)
3 A-D channel 3 input (Single ended 8 bit 0 to +5V)
4 A-D channel 2 input (Single ended 8 bit 0 to +5V)
5 A-D channel 1 input (Single ended 8 bit 0 to +5V)
6 +5V
OWCTR2 CON 2 
Pin Number (Figure 3)
Description
1 Common (GND)
2 Unused
3 Unused
4 Counter channel 2
5 Counter channel 1
6 +5V
OWDO4 CON 2 
Pin Number (Figure 3)
Description
1 Common (GND)
2 Relay control 4
3 Relay control 3
4 Relay control 2
5 Relay control 1
6 +5V
OWPOT1 CON 2 
Pin Number (Figure 3)
Description
1 Common (GND)
2 Unused
3 Pot high (Connect to a voltage (V RH) between +5 and +10 V)
4 Wiper (This is the control voltage that varies from 0 to V RH.)
5 You must connect this pin to Common
6 +5V

1-Wire I/O Module Types
Described below are the different 1-wire modules:
 
Part Number  Type  Register Assignment Conversion Description
OWT 0 Temperature F=0.9*raw-67
C=0.5*raw-55
Measures temperature to +/-0.5 degree C accuracy.
OWAD2
OWTRH
3 Temperature
Power Supply (V1)
A-D Channel 1 (V2)
A-D Channel 2 (V3)
Temperature as above
V1=Raw/100
V2=Raw/100
V3=Raw*0.2441-249.96
RH=161.29*((V2/V1-.16)
  / (1.0546-(.00216*C)))
This module has two, 10 bit A-D channels, a temperature probe and power supply voltage measurement for a total of four channels. The first A-D channel is single ended and has a range from 0 to +10 volts (current such as a 4-20mA signal can be converted to voltage with a 250 ohm resistor). The second channel is differential and has a range of -300mV to +300mV. With the addition of a humidity sensor on the first A-D channel and the appropriate software on the ICON the OWTRH can measure temperature, relative humidity, dew point and vapor pressure deficit.
OWCTR2 2 Counter 1
Counter 2
Use ICON "Counter"
instruction.
Two channel counter. This devices counts pulses or contact closures starting at 0 after power is turned on. The counter counts 65534 (the highest valid count) and then "wraps around" to 0. 65535 is a valid count but because that number indicates a bad sensor, that number will never be returned as a valid reading. Instead the count 65535 will be returned as 65534. Then when the count wraps to 0 two counts will be counted. The ICON "Counter" instruction converts this somewhat convoluted count scheme into the proper counting. Can be used to measure rain fall (with a tipping bucket rain gauge), wind speed (with a contact closure anemometer, flow (with a pulse output turbine flow meter-magnetic type my require signal amplification), light intensity with the TI light to frequency converter sensor, and vibration (glass breakage) (counts when the vibration occurs). 
OWAD4
OWDI4
1 A-D Channel 1
A-D Channel 2
A-D Channel 3
A-D Channel 4
V=Raw*.001221 A-D Four channel A-D. Each channel can measure an input voltage in the range of 0 to +5V. 0 represents 0V and 255 represents +5V. Therefore it is an eight bit A-D converter. Can measure wind direction (with a potentiometer wind vane) and any other sensor that outputs a voltage in the range of 0 to +5V. It can also sense the state of on/off (open/close) sensors such as switches or magnetic contact sensors and can be used for door and window open sensors and the Dallas Semiconductor wind vane with 8 contact closures.
OWDO4 128 Control channel 1
Control channel 2
Control channel 3
Control channel 4
0 for off
1 (or non-zero) for on
Four channel relay controller. Can control the state of four relays. These include solid state relays such as the opto22 OAC5 and ODC5 or true mechanical relays with coil voltages from 5 to 30VDC and current to 40mA.
OWPOT1 129 Channel 1  0 to 255 Can digitally control the wiper of a solid state potentiometer. You may connect the pot to a voltage of 5 to 10 volts. The output wiper will then vary from 0V to the voltage you supply to the pot in 256 (8 bit) steps. Can be used to control proportional valves and similar actuators with the proper signal conditioning (for instance a 0-10V to 4-20mA converter may be required).

Configuring ICON 1-Wire I/O
The first step is to setup the Modbus configuration registers for the 1-wire devices you are connecting. This requires two ICON instructions, the "OWconfig" instruction sets variable values and the "Modbus" instruction sends these values to the proper ICON board configuration registers. Because the ICON can receive a maximum of 16 device's worth of configuration information at one time, it may be necessary to send all the configuration information in up to four separate Modbus instructions.

First configure one OWconfig instruction for each ICON board.

  1. Select an "OWconfig" instruction. Set the size to the number of separate 1-wire devices (include all devices on all four 1-wire busses).
  2. Set the "Config" variable to some name such as "ow_config1". You can use "ow_config2" for the second OW_config instruction if you have more than one ICON board.
  3. Go to table parameter configuration.
  4. Enter a description for each 1-wire device so you don't forget what's what.
  5. On each 1-wire device is a tag which has the "Device type", "ID high" and "ID Low" information. Enter these three values into the next three row table entries.
  6. Use the drop down list to select which 1-wire bus you connected the device to.
  7. Finally use the drop down list under "Mode" to select ""Separate power" or "1-wire powered". If you connected the power bus to your device select "Separate power". For temperature probes only, depending how its wired, you can select either type. RH does not have power so you must select "1-wire powered".
Now insert 1-4  Modbus instructions for each OWconfig instruction. You need 1 modbus instruction if you have 1 to 15 devices, 2 if you have 16 to 31, 3 if you have 32 to 47 and 4 if you have 48 to 64. Configure each Modbus instruction as follows:
 
  1. You may leave the "Enable" and "Status" variables "Null".
  2. Set the "I/O transfer" variable to the name entered for the "Config" variable when you configured the "OWconfig" instruction above. The Modbus instruction will transfer the values set in the "OWconfig" instruction to the Modbus configuration registers on the ICON.
  3. Select "Com type" as "Serial 2"
  4. The "IP address" and "Port number" are not used so you don't need t change them.
  5. Set the "Unit address" to 255 if you are configuring the first ICON (ICON-LOCAL). Otherwise select the address you set in the switches for the ICON-REMOTE. Generally this will be 1 for the first ICON-REMOTE, 2 for the second, etc.
  6. Set the "Register address" to 4097. This is the starting address for the configuration registers.
  7. Select "Set multiple registers (16)" from the "Command" drop down list.
  8. Set "Timeout (10mS steps)" to 50. This sets a 0.5 second timeout.
  9. Set "Retries" to 3.
  10. Do not change any of the table parameters. Leave all the A values at 1 and the B values at 0. Set the length of the table to 4 times the number of entries plus 1. If you have 15 entries set the table length to 4 X 15 + 1 = 61. Each device requires four configuration numbers. The last entry is automatically set by the OWconfig instruction and is set to 65535 which tells the ICON the device configuration list is terminated.


If you have more than 15 1-wire devices, configure as follows. For 16-31 1-wire devices Configure the first Modbus instruction as described above but set the table length to 64. Configure the second Modbus instruction to have the "I/O transfer variable set to ow_config1[64], set the "Register address" to 4161 and set the table length to (Total-16) X 4 + 1.

For 32 to 47 devices, set as described in the previous example but make the table length of the second Modbus instruction also be 64. Configure the third Modbus instruction to have the "I/O transfer variable set to ow_config1[128], set the "Register address" to 4225 and set the table length to (Total-32) X 4 + 1.

For 38 to 63 devices, set as described in the previous example but make the table length of the third Modbus instruction also be 64. Configure the fourth Modbus instruction to have the "I/O transfer variable set to ow_config1[192], set the "Register address" to 4289 and set the table length to (Total-48) X 4 + 1. If you have exactly 64 devices, set all four table lengths to 64. For this case only, a terminator is not needed.

Read 1-wire Inputs and Write 1-Wire Outputs
You may configure your I/O devices in any order. However, all the inputs will be grouped together into consecutive registers. And all the outputs will be grouped together into a different set of consecutive registers. You may use a maximum of 127 registers. The first input register is reserved for a loop pass counter. Every time all the 1-wire sensors have been read and any outputs updated, the value in the first register is incremented (range is 0-255). The following table shows how many input registers are allocated for each device:
 
Part Number 1-wire IC Part Number  Number of Input Registers Number of Output Registers
OWT DS18S20 or DS18B20 or DS1822 1 0
OWAD2 DS2438 4 0
OWCTR2 DS2423P 2 0
OWAD4 DS2450S 4 0
OWDI4 DS2450S 4 0
OWDO4 DS2450S 0 4
OWPOT1 DS2890P-000 0 1

To read your ICON Modbus register values into your ICON program, configure a Modbus instruction as follows:

  1. You may leave the "Enable" variable "Null".
  2. Set the "Status" variable to a name such as mod_stat1". You will need this value as input to the "Enable" variable of the "Counter" instruction. If the value is greater than 1 the Counter instruction interprets this as a Modbus read failure and won't use erroneous data. You can also use the value on this variable to set status indicating the validity of the other readings. If the value is 1 the input readings are valid (the Modbus instruction correctly read the values from the ICON board). Any other values indicate a failure to properly read the ICON board.
  3. Set the "I/O transfer" variable to the name of an input data array. Choose a name such as mod_data_input1. The Modbus instruction will transfer the Modbus register values on the ICON to this ICON program variable array.
  4. Select "Com type" as "Serial 2"
  5. The "IP address" and "Port number" are not used so you don't need t change them.
  6. Set the "Unit address" to 255 if you are configuring the first ICON (ICON-LOCAL). Otherwise select the address you set in the switches for the ICON-REMOTE. Generally this will be 1 for the first ICON-REMOTE, 2 for the second, etc.
  7. Set the "Register address" to 1. This is the starting address for the input registers.
  8. Select "Read input registers (4)" from the "Command" drop down list.
  9. Set "Timeout (10mS steps)" to 50. This sets a 0.5 second timeout.
  10. Set "Retries" to 3.
  11. Set your table length to the number of input registers. The first input register is a loop pass counter. Every time a complete pass is made reading all inputs and setting all outputs, the pass counter increments. This is followed by all the input values. If for example you had 2 OWTs, an OWCTR and an OWAD you could read 1 + (2 X 1) + 2 + 4 = 9 input register values. The first register contains the pass counter value, the second and third registers contain the two temperature readings, the fourth and fifth registers contain the event counts for the two counters and registers six, seven, eight and nine contain the four A-d readings.
  12. You may set your A and B table coefficients to values needed to convert your raw readings to engineering units. It uses the equation converted=Modbus_register_value X A + B.  Leaving A at 1 and B at 0 will pass the raw Modbus register values to the outputs. You must not convert data from the OWCTR counter unit if you will be feeding this data into a "Counter" instruction. (It expects counts from 0 to 65534 with 65535 indicating a sensor failure.)  To convert temperature to degrees F set A=0.9 and B=-67.
  13. Note, you can read the values you set in the output registers by using addresses starting at 257. You can read your configuration parameters by using addresses starting at 4097.
It is possible to have over 64 read registers but the ICON supports a maximum of 64 register reads with one instruction. If you have more than 64 registers you must do this with two Modbus reads. The first is set for a table size of 64 and a starting address of 1. The second Modbus read has a table size of (Total_number_of Regs-64) and a starting address of 65.

To write ICON program values to your ICON Modbus registers for output control, configure a Modbus instruction as follows:

  1. You may leave the "Enable" and "Status" variables "Null".
  2. Set the "I/O transfer" variable to the name of your control value data array. Choose a name such as mod_data_output1. The Modbus instruction will transfer the values from this ICON variable array to the Modbus registers on the ICON. These values will then be sent on to the 1-wire devices to set the relay or pot states. Use values of 0 and 1 to turn the relays off and on with the OWDO device. Use values of 0 to 255 to set the pot value on the OWPOT board.
  3. Select "Com type" as "Serial 2"
  4. The "IP address" and "Port number" are not used so you don't need t change them.
  5. Set the "Unit address" to 255 if you are configuring the first ICON (ICON-LOCAL). Otherwise select the address you set in the switches for the ICON-REMOTE. Generally this will be 1 for the first ICON-REMOTE, 2 for the second, etc.
  6. Set the "Register address" to 1. This is the starting address for the output registers. Don't worry, these are different register from the input registers. The program distinguishes by what you select for "Command".
  7. Select "Set multiple registers (16)" from the "Command" drop down list.
  8. Set "Timeout (10mS steps)" to 50. This sets a 0.5 second timeout.
  9. Set "Retries" to 3.
  10. Set your table length to the number of output registers. For digital outputs keep your A values at 1 and your B values at 0 and make sure your data values are 0 for off and 1 for on. If controlling a pot you may use the A and B coefficients to convert your data range to the range of 0 to 255. The conversion is Output_reg_value=data_var_value X A + B. The result should be in the range of 0 to 255.
It is possible to have over 64 write registers but the ICON supports a maximum of 64 register writes with one instruction. If you have more than 64 registers you must do this with two Modbus writes. The first is set for a table size of 64 and a starting address of 1. The second Modbus write has a table size of (Total_number_of Regs-64) and a starting address of 65.

Counting
Use the Counter instruction with the OWCTR2 modules to count events. Assume you read Modbus data and status into the following variables:
Variable Description
mod_data_input1[2] The 2nd counter on a OWCTR2 which is connected to a tipping bucket rain gauge.
mod_stat1 The Modbus status

Configure an Expression instruction as follows:
counter_enable 0 mod_stat1<2

Configure a Counter instruction as follows:
Input: mod_data_input1[2]
Result: counter1
Enable: Null
Update: counter_enable
Frequency period: 00:00:00:00

Your results will be in the variable "counter1". If the Modbus read fails, mod_stat1 will be 2 or greater causing counter_enable to be 0 thus freezing the count on counter1. Also, if mod_data_input1[2] goes to a value of 65535, indicating a failure of the OWCTR2 module, the count is also frozen. When the count on mod_data_input1[2] wraps from 65534 to 0 the result on counter1 keeps increasing (this is the main reason for the use of the counter instruction.)

You may scale the results with an expression instruction:
rain 0 counter1/100

To reset the count to 0 at the start of every day you may configure an Expression as follows:
counter1 0 0 'if' (!System[1]==1)

Frequency Measurement
Use the Counter instruction with the OWCTR2 modules to measure frequency. Assume you read Modbus data and status into the following variables:
Variable Description
mod_data_input1 Loop pass counter
mod_data_input1[1] The 1st counter on a OWCTR2 which is connected to a a puls annemometer.
mod_stat1 The Modbus status

Configure an Expression instruction as follows:
counter_enable 0 mod_stat1<2

Configure a Counter instruction as follows:
Input: mod_data_input1[1]
Result: freq1
Enable: mod_data_input1 (Loop pass counter is needed to indicate whether new data is available)
Update: counter_enable
Frequency period: 00:00:00:10 (Measure for a 10 second period)

Your results will be in the variable "freq1". If the Modbus read fails, mod_stat1 will be 2 or greater causing counter_enable to be 0 thus freezing the result on freq1.

You may scale the results with an expression instruction. The following converts frequency to MPH for the Wind Speed sensor:
wind_speed 0 freq1*1.25