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.
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:
To write ICON program values to your ICON Modbus registers for output control, configure a Modbus instruction as follows:
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 |