D E S I G N A N A L Y S I S A S S O C I A T E S , I N C .
Chapter 1
Operation
1.0 Introduction
The W
to a personal computer or RS-232 terminal the H-4191 can be used to test and monitor SDI-12
sensors and data recorders. The H-4191 allows a programable logic controller (PLC), remote
terminal unit (RTU) or other data collection device with a RS-232 interface to access SDI-12
sensors. The H-4191 provides the RS-232 to SDI-12 electrical interface, generates the critical
bus timing, parity and command retries needed for the SDI-12 bus protocol..
The “SDI-12 Serial-Digital Interface” is ideal for data logging applications with the following
requirements:
Battery powered operation with minimal current drain
Low system cost
Digital sensors output data directly in user units
Sensors are interoperable and available from many different manufacturers
ATER
LOG® H-4191 is a RS-232 to SDI-12 gateway (interface) module. When connected
The H-4191 has the following features:
Provides both electrical and protocol interface functions between RS-232 & SDI-12
Works with any sensor command/response message including vendor specific extended
commands.
Buffers the command so no special timing is required.
Generates proper parity for the SDI-12 bus.
Automatically sends SDI-12 retries.
Passes the sensor service request to the host.
Supports optional CTS/RTS hardware flow control for a slow host device.
Low power mode facilitates use with a RS-232 data radio.
LED shows when the H-4191 is awake.
Built in “sensor” can measure the battery voltage.
The H-4191 is packaged in a rugged plastic enclosure with screw mount ears. Connectors
located on each end provide easy hookup.
H-4191
Operation 1-1
1.1 Applications
Figure 1 shows a monitoring application where a laptop computer is used to monitor the SDI-12
communication between a data recorder and two SDI-12 sensors. Figure 2 shows the connections
when using the H-4191 as a gateway between a PLC and two SDI-12 sensors.
Figure 4 Monitor a data recorder
Figure 3 Interface between a PLC and
two SDI-12 Sensors
1.2 Operation
The H-4191 has a microprocessor with both RS-232 and SDI-12 interface ports. The H-4191
normally operates as a SDI-12 master device: it issues SDI-12 commands and collects responses.
Under certain conditions the H-4191 can respond to host commands itself as a “pseudo” SDI-12
sensor (see Section 1.7).
The RS-232 interface port is connected to a personal computer or other “host” device. The H4191 provides two way communication between the RS-232 host and the SDI-12 bus. During
normal operation, the host device sends an address together with a command to a SDI-12 sensor.
The sensor then replies with a "response".
1-2 Operation
H-4191
1.2.1 Commands
The RS-232 host interface is fixed at 9600 baud. The H-4191 inputs SDI-12 commands (ASCII
characters) from the host and places the character string in a buffer. Up to 60 characters can be
buffered. The command can be sent at any speed, even hand-typed commands will work. The
backspace character (08h) is supported and deletes the previous character in the buffer. Note: the
SDI-12 protocol requires upper case characters. When the H-4191 detects the “!” SDI-12
command terminator character the H-4191 generates a SDI-12 break and transmits the contents
of the buffer to the SDI-12 port in a contiguous burst with the proper parity and bus timing. The
H-4191 also accepts the <CR> character (ENTER Key) as a command terminator and substitutes
the <CR> character with the required “!” SDI-12 command terminator. This makes the H-4191
easier to use for computer users who more commonly complete a message with the ENTER Key.
If you use the ENTER Key to terminate the message, do not type the “!” character.
The H-4191 automatically generates SDI-12 compliant parity and timing. After transmitting the
command, the H-4191 waits for up to 40mS for a sensor response. If the sensor response fails to
arrive, the H-4191 performs a retry sequence specified by the SDI-12 protocol. The H-4191
generates up to four breaks with up to four retries per break (16 retries total).
1.2.2 Sensor Response
The response from a SDI-12 sensor is input by the H-4191 at 1200 baud and output to the RS232 port at 9600 baud. Any sensor service requests or other SDI-12 bus traffic are also forwarded
from the SDI-12 port to the RS-232 port. This feature allows the H-4191 to be used to passively
monitor the activity on a SDI-12 bus between a data recorder and its sensors.
H-4191
Operation 1-3
1.3 Making Connections
Connect the RS-232 port of the H-4191 to the serial port of your personal computer or other host
device with a standard 9-pin RS-232 cable (provided). The H-4191 has a female connector and is
a DCE (modem) device. The cable has 9-pin RS-232 connectors which can be plugged directly
into a PC serial port without the use of gender or null-modem adapters. Program your host device
for 9600 baud, 8-bit, no parity, full-duplex communication The host device must assert either
CTS or DSR to awaken the H-4191 from it’s low power sleep mode.
RS-232 Connector
PinNameDirectionDescriptionFunction
1ncnot used
2TxDOutputTransmit DataTransmit data to host device
3RxDInputReceive DataReceive data from host device
4DSRInputData Set ReadyAwakens the H-4191 when asserted.
5GNDGroundGround
6ncnot used
7CTSInputClear To SendAwakens the H-4191 when asserted.
Controls TxD if RTS/CTS flow
control is on.
8RTSOutputRequest To SendAsserted when awake and output
9ncnot used
The H-4191 has a 4-position
terminal strip for making
connections to the SDI-12
bus. The H-4191 is powered
from the +12V power
terminal.
buffer is not full
1-4 Operation
H-4191
1.4 Testing the Interface
You can test the H-4191 with a simple RS-232 terminal or computer using a terminal program
such as Xtalk or Hyperterminal. The terminal program must assert either the CTS or DSR (or
both) input signals to the H-4191 to awaken it from sleep. The red LED on the H-4191 will be
illuminated when it is awake and ready to communicate. The interface is a full-duplex connection,
depending on the settings of your terminal program you may or may not be able to see what you
are typing on your screen. If you make a mistake while typing the command, use backspace key to
delete the previous keystroke. If you make a mistake and are not sure what is in the H-4191's
buffer, press the “!” or ENTER Keys to flush the buffer and start over.
When the H-4191 is first powered up it transmits a “H-4191 Initialized” debugging message to
the RS-232 port.
1.4.1 H-4191 Initiates the Commands
Try the following commands. The sensor address in these examples is “0" and the sensor is a
Design Analysis H-350 pressure sensor. If your sensor has a different address use the appropriate
address.
1. Check to see if you can communicate with the sensor.
Issue a “0I!” Identify command.
The sensor should respond with: “012 DAA H-350001S#000000V10<CR><LF>”
2. Make a measurement.
Issue a “0M!” command.
The sensor should respond with: “00153<CR><LF>”
After 14 seconds the sensor will send a service request: “0<CR><LF>
Issue a “0D0" command to collect the data.
The sensor should respond with: “0+4.56+0.0000+0.2<CR><LF>”
1.4.2 H-4191 Monitors the SDI-12 Bus
The H-4191 can be used to passively monitor the activity on a SDI-12 bus. You can observe both
the commands from the data recorder and the responses from the sensors. The communications
between a data recorder and a Model H-350 pressure sensor would appear as follows:
0M!00153
0D0!0+4.56+0.0000+50.0
In this example the data recorder issued a “0M!” command, the sensor responded with
“00153<CR><LF> “ (sensor 0, measurement time = 015 sec, 3 parameters will be returned).
Next, the data recorder issued a “0D0!” command and the sensor responded with
“0+4.56+0.0000+50.0<CR><LF> (sensor 0, stage = 4.56, PSI = 0.0, temperature = 50.0).
H-4191
Operation 1-5
When monitoring traffic between a data recorder and its SDI-12 sensors, the display may
sometimes have spurious characters which prefix the command. For example:
p0M!00153
p0D0!0+4.56+0.0000+50.0
The lower case “p” in this example was caused by the break pulse generated by the data recorder.
A “break” is a 12mS or longer pulse on the data line which wakes the sensors from their low
power sleep mode. The serial asynchronous receiver transmitter (UART) in the H-4191
misinterprets the break as a random character.
1.5 Low Power Operation
The H-4191 normally reverts to a low power or “sleep” mode. If either the DSR or CTS RS-232
inputs are active (asserted) the H-4191 awakens, powers up its RS-232 transceiver and is
available for full operation. The red LED on the side of the enclosure is illuminated when the H4191 is awake. Most PC terminal programs automatically assert both DSR and CTS by default.
When the H-4191 is connected to a PC the H-4191 will normally awaken and remain awake as
long as it is connected.
1.6 Operation with a Radio
Applications often arise where a SDI-12 sensor must be physically located hundreds or thousands
of feet from the data logger. Transparent wireless SDI-12 bridges are available for these
applications. Unfortunately, transparent bridges can miss or drop measurements because of
corrupted radio packet transmissions. Wireless bridges are problematic because the SDI-12
protocol provides insufficient time to make retries or other recovery.
When coupled with a data radio, the H-4191 can be used to construct a “non transparent”
wireless SDI-12 link. With this architecture the H-4191 is permanently connected to one or more
sensors at the remote site. A pair of RS-232 data radios are installed between the data logger and
the remote H-4191. The data logger must be setup to initiate and collect SDI-12
commands/responses from a RS-232 port instead of its normal SDI-12 port. SDI-12 commands
from the data logger are forwarded via the radios to the remote H-4191. When the remote data
radio receives an inbound data packet, it pulses the CTS input which awakens the H-4191 in
preparation to receive the inbound message. When the H-4191 detects the “!” character, it
transmits the contents of its buffer to the remote SDI-12 bus in a contiguous frame with proper
parity and bus timing. The H-4191 waits for and collects any sensor response and forwards it to
the radio. The sensor response is sent over the radios to the data logger. If one or more of the
radio transmissions is lost or corrupted, the data logger can retry the entire sequence as needed.
The H-4191 has an internal inactivity timer which keeps the module awake to process the service
request and receive subsequent radio packets. If both the RS-232 and SDI-12 ports become
inactive (and both CTS and RTS are not asserted) for longer than 10-seconds, the timer expires
and the H-4191 enters its low power sleep mode. The H-4191 examines the
“aTTTN<CR><LF>” sensor response initiated by an “aM!” measure command and initializes a
second “keep-awake” timer to TTT + 3-seconds. This ensures the H-4191 will remain awake to
1-6 Operation
H-4191
process the service request. When the service request actually arrives, the keep-awake timer is
zeroed. While the keep-awake timer is running the H-4191 sends a null (00h) to the radio
once/second to keep the radio link awake while waiting for the service request.
The radios used in this architecture are normally programmed for “sleep & sniff” low power
operation. When properly configured, the data logger, radios and H-4191 module can provide a
low-power wireless SDI-12 bridge capable of performing retries.
1.7 Sensor “Z”
When implementing a wireless SDI-12 bridge as described in the previous section it is useful for
the data logger to be capable of monitoring the battery voltage in the remote station. In addition
to functioning as a RS-232 to SDI-12 gateway, the H-4191 has a built-in “sensor” which responds
to SDI-12 address “Z”. The “Z” sensor can measure the H-4191's +12V input voltage, is used to
facilitate turning flow control On or Off and is useful for testing and maintenance. The “Z” sensor
responds to all SDI-12 compliant commands, however, it is only accessible via the RS-232 port.
The built-in sensor will not respond to a data logger connected to the SDI-12 port. The sensor
address can be changed from “Z” to another value if needed with the extended
Change_Address_Command. See Section-2 for further details.
1.8 RS-232 Hardware Flow Control
The RS-232 port of the H-4191 supports optional RTS/CTS hardware flow control for slow
PLC’s or RTU’s which cannot input or receive the entire SDI–12 response message. The H-4191
monitors its CTS input and transmits RS-232 characters only if CTS is asserted. The H-4191 can
buffer up to 60 SDI-12 response characters, any additional input characters will be lost.
While the H-4191 is busy sending a SDI-12 command or doing retries, it can buffer up to 32
command characters from the RS-232 port. The H-4191 de-asserts the RTS output when more
than 28 characters are queued in its host input buffer.
The H-4191 comes from the factory with the RTS/CTS hardware flow control set to Off. An
extended SDI-12 command allows the hardware flow control feature to be turned On or Off.
The On/Off setting is stored in EEPROM internal to the H-4191 and remains in effect even if the
power is lost. See Chapter 2 for details.
H-4191
Operation 1-7
1-8 Operation
H-4191
Chapter 2
SDI-12 Command and Response Protocol
2.0 SDI-12 Command and Response Protocol
This is a brief description of the Serial Digital Interface (SDI-12) Command and Response
Protocol used by the W
commands and data format supported by the H-4191.
Refer to the document "A SERIAL DIGITAL INTERFACE STANDARD FOR HYDROLOGIC
AND ENVIRONMENTAL SENSORS.” Version 1.2 April 12, 1996 Coordinated by the SDI-12
Support Group, 135 East Center, Logan, Utah.
During normal communication, the data recorder sends an address together with a command to
the H-4191 SDI-12 sensor. The H-4191 then replies with a "response." In the following
descriptions, SDI-12 commands and responses are enclosed in quotes. The SDI-12 address and
the command/response terminators are defined as follows:
"a"Is the sensor address. The following ASCII Characters are valid addresses:
ATER
LOG® Series Model H-4191 sensor. Included is a description of the
"0-9", "A-Z", "a-z", "*", "?". Sensors will be initially programmed at the
factory with the address of "0" for use in single sensor systems. Addresses
"1 to 9" and "A to Z" or "a to z" can be used for additional sensors
connected to the same SDI-12 bus. Address "*" and "?" are "wild card"
addresses which select any sensor, regardless of its actual address.
Notes:
"!"Is the last character of a command block.
"<cr><lf>" Are carriage return (0D) hex and line feed (0A) hex characters. They are
the last two characters of a response block.
•All commands/responses are upper-case printable ASCII characters.
•Commands must be terminated with a "!" character.
•Responses are terminated with <cr><lf> characters.
•The command string must be transmitted in a contiguous block with no gaps of more
than 1.66 milliseconds between characters.
H-4191
SDI-12 Command and Response Protocol 2-1
2.1 Measure Command
The Measure Command causes a measurement sequence to be performed. Data values generated
in response to this command are stored in the sensor's buffer for subsequent collection using "D"
commands. The data will be retained in the sensor until another "M", " C", or "V" command is
executed.
ais the sensor address ("0-9", "A-Z", "a-z", "*", "?").
Mis an upper-case ASCII character
tttis a three digit integer (000-999) specifying the maximum time, in seconds, the
sensor will take to complete the command and have measurement data available in
its buffer.
nis a single digit integer (0-9) specifying the number of values that will be
placed in the data buffer. If "n" is zero (0), no data will be available using
subsequent "D" commands.
Upon completion of the measurement, a service request "a<cr><lf>" is sent to the data recorder
indicating the sensor data is ready. The data recorder may wake the sensor with a break and
collect the data any time after the service request is received or the specified processing time has
elapsed.
Example of a H-4191 "aM!" command:
CommandResponseTimeValuesDescription
"ZM!""Z0021<cr><lf>"
Subsequent CommandResponse
"ZD0"Z+AA.AA<cr><lf>
Where:
AA.AA= Battery Voltage (@ SDI-12 +12V power pin)
2 sec 1Make measurement
2-2 SDI-12 Command and Response Protocol
H-4191
2.2 Concurrent Measurement Command
This is a new command for the Version 1.2 SDI-12 Specification. A concurrent measurement is
one which occurs while other SDI-12 sensors on the bus are also taking measurements. This
command is similar to the “aM!” command, however, the nn field has an extra digit and the sensor
does not issue a service request when it has completed the measurement. Communicating with
other sensors will NOT abort a concurrent measurement. Data values generated in response to
this command are stored in the sensor's buffer for subsequent collection using "D" commands.
The data will be retained in the sensor until another "M", "C", or "V" command is executed.
ais the sensor address ("0-9", "A-Z", "a-z", "*", "?").
Cis an upper-case ASCII character
tttis a three digit integer (000-999) specifying the maximum time, in seconds, the
sensor will take to complete the command and have measurement data available in
its buffer.
nnis a two digit integer (00-99) specifying the number of values that will be
placed in the data buffer. If "n" is zero (0), no data will be available using
subsequent "D" commands.
The data recorder may wake the sensor with a break and collect the data anytime after the
specified processing time has elapsed.
H-4191
SDI-12 Command and Response Protocol 2-3
2.3 Send Data Command
The Send Data command returns sensor data generated as the result of previous "aM!", "aC!", or
"aV!" commands. Values returned will be sent in 33 characters or less. The sensor's data buffer
will not be altered by this command.
CommandResponse
"aD0!" through "aD9!""apd.d ... pd.d<cr><lf>"
Where:
ais the sensor address ("0-9", "A-Z", "a-z", "*", "?").
D0..D9are upper-case ASCII characters.
p Is a polarity sign (+ or -)
d.drepresents numeric digits before and/or after the decimal. A decimal may
be used in any position in the value after the polarity sign. If a decimal is
not used, it will be assumed to be after the last digit.
For example: +3.29 +23.5 -25.45 +300
If one or more values were specified and a "aD0!" returns no data (<CR><LF> only), it means
that the measurement was aborted and a new "M" command must be sent.
Example of a H-4191 "aD0!" command:
Previous CommandResponse
"ZM!""Z0021<cr><lf>"
Subsequent CommandResponse
"ZD0"Z+AA.AA<cr><lf>
Where:
AA.AA= Battery Voltage
2-4 SDI-12 Command and Response Protocol
H-4191
2.4 Continuous Measurements
This is a new command for the Version 1.2 SDI-12 Specification. Sensors that are able to
continuously monitor the phenomena to be measured, such as a cable position, do not require a
start measurement command. They can be read directly with the R commands (R0!...R9!). The R
commands work exactly like the D (D0!...D9!) commands. The only difference is that the R
commands do not need to be preceded with an M command.
The H-4191 does not support the aR0! continuous measurement commands because the
measurement and math operations require several seconds to complete..
2.5 Send Acknowledge Command
The Send Acknowledge Command returns a simple status response which includes the address of
the sensor. Any measurement data in the sensor's buffer is not disturbed.
CommandResponse
"a!""a<cr><lf>"
Where:aIs the sensor address ("0-9", "A-Z", "a-z", "*", "?").
H-4191
SDI-12 Command and Response Protocol 2-5
2.6 Initiate Verify Command
The Verify Command causes a verify sequence to be performed. The result of this command is
similar to the "aM!" command except that the values generated are fixed test data and the results
of diagnostic checksum tests. The data generated in response to this command is placed in the
sensor's buffer for subsequent collection using "D" commands. The data will be retained in the
sensor until another "M", "C", or "V" command is executed.
ais the sensor address ("0-9", "A-Z", "a-z", "*", "?").
Vis an upper-case ASCII character.
tttis a three digit integer (000-999) specifying the maximum time, in seconds, the
sensor will take to complete the command and have data available in its buffer.
nis a single digit integer (0-9) specifying the number of values that will be
placed in the data buffer. If "n" is zero (0), no data will be available using
subsequent "D" commands
Example of a "aV!" command:
CommandResponseTimeValues Description
"ZV!""a0013<cr><lf>"
Subsequent CommandResponse
"ZD0"Z+123.456+78.9+y<cr><lf>
KeyDescriptionUnits
+123.456Fixed test data
+78.9Fixed test data
yROM checksum test0 = Failed, 1 = Passed
1 sec3Return fixed data and diagnostic data
for testing purposes.
2-6 SDI-12 Command and Response Protocol
H-4191
2.7 Send Identification Command
The Send Identification Command responds with sensor vendor, model, and version data. Any
measurement data in the sensor's buffer is not disturbed.
CommandResponse
"aI!""allccccccccmmmmmmvvvxx...xx<cr><lf>"
Where:
ais the sensor address ("0-9", "A-Z", "a-z", "*", "?").
I is an upper-case ASCII character.
llis the SDI-12 version compatibility level, e.g. version 1.2 is represented as
"12".
cccccccc is an 8 character vendor identification to be specified by the vendor and
usually in the form of a company name or its abbreviation.
mmmmmm is a 6 character field specifying the sensor model number.
vvv is a 3 character field specifying the sensor version number.
xx...xx is an optional field of up to a maximum of 13 characters to be used for serial
number or other specific sensor information not relevant to operation of the
data recorder.
Example of a "aI!" command:
"a12 DAA H-4191vvvS#nnnnnnVkkk<cr><lf>"
H-4191 implementation of the optional 13 character field:
S#nnnnnnVkkk
Where:
"nnnnnn"is a six character sensor serial number
"kkk"is a three digit sensor firmware revision level
(12 bytes total)
H-4191
SDI-12 Command and Response Protocol 2-7
2.8 Change Sensor Address Command
The Change Sensor Address Command allows the sensor address to be changed. The address is
stored in non-volatile EEPROM within the sensor. The H-4191 will not respond if the command
was invalid, the address was out of range, or the EEPROM programming operation failed.
ais the current (old) sensor address ("0-9", "A-Z", "a-z", "*", "?"). An
ASCII "*" may be used as a "wild card" address if the current address is
unknown and only one sensor is connected to the bus.
Ais an upper-case ASCII character.
nis the new sensor address to be programmed ("0-9", "A-Z").
NOTE: To verify the new address use the "Identify Command."
Example of a "Change Sensor Address" command:
CommandResponseDescription
"ZA9!""9<cr><lf>"
Change sensor address to "9"
2-8 SDI-12 Command and Response Protocol
H-4191
2.9 Extended Read Flow_Mode and Write Flow_Mode
The RS-232 port of the H-4191 supports optional RTS/CTS hardware flow control for slow host
devices which cannot input or receive the entire SDI-12 response message. The H-419 monitors
it’s CTS input signal and transmits RS-232 characters only if CTS is asserted.
The H-4191 comes from the factory with the RTS/CTS hardware flow control set to OFF. These
two commands allow the hardware flow control feature to be checked or turned ON or OFF. The
On/Off setting is stored in EEPROM internal to the H-4191 and remains in effect even if the
power is lost.
Once a new Flow_Mode value is written, a copy is sent to the sensor data buffer for verification.
This data can be viewed by using a subsequent "D" command. To read or verify the value any
other time, use the "XRFM" command.
CommandResponseDescription
"aXRFM!"“a0011<cr><lf>"
"aXWFMn!"“a0011<cr><lf>"
Where:ais the sensor address ("0-9", "A-Z", "a-z", "*", "?").
XRFMare upper case characters.
XWFMare upper case characters.
n0 = flow control OFF, 1 = flow control ON
Read Flow_Mode
Write Flow_Mode
This command takes 001 seconds to complete and places 1 value in the data buffer. Use the
“aD0" command to collect and view the current value.
Example of a H-4191 Extended "Read Flow_Control_Mode" command:
CommandResponseTimeValuesDescription
"ZXRFM!""Z0011<cr><lf>"
CommandResponseDescription
"ZD0!""Z+0<cr><lf>"
Example of a H-4191 Extended "Write Flow_Control_Mode" command: