SDI-12 stands for Serial/Digital Interface at 1200 baud. It is a protocol that covers the communication and power supply aspects between a sensor and a datalogger, such as the Wavelet device.
SDI-12 protocol is an ASCII-based master-slave protocol. The device is the master and the sensor is the slave. One master can read multiple slaves.
For technical details about SDI-12, see the Appendix:
SDI-12 Transaction without CRC
SDI-12 Transaction with Additional Measurements
Specification sheet - download the PDF
To configure the SDI-12 sensor
- Click Devices in the left pane.
- In the Sites Tree pane, select the device with the SDI-12 sensor.
- Click the Configuration tab on the right pane.
- Expand the ADVANCED DEVICE CONFIGURATION tree, and then select Serial.
- Select the Channel, and then configure the following items:
Parameter |
Required value |
Details |
---|---|---|
sample_handler | SH_SDI12 | |
interface_type | IT_SDI12 | |
slave_address | The sensor's SDI-12 slave address | |
read_addr | The zero-based index of the value to read |
Suppose that the sensor is responding with 9 values. To read the first value, specify 0. To read the second value, specify 1 etc.
|
bus_baud, bus_parity, data bits, stop bits |
N/A | These settings are ignored. The SDI-12 handler sets them automatically. |
read_type, read_flag |
N/A | These settings are ignored. |
extra_params |
string format: "<use_crc>, <add_measurement_index>,<delay_ms>" |
Use this configuration item to tweak the SDI-12 handler's default behavior. Be sure to include the quotation marks (") at the beginning and end of the string. Do not include the less than and greater than brackets ("<" and ">"). <delay_ms> - By default, the SDI-12 handler will not use a delay (in milliseconds). Otherwise, this delay will occur before the device transmits the second query to the sensor. If this value did not exist, the device will simply use the default value (wait 0 millisecond). "*,*" - use default values (use CRC + aM! command + no delay) "*,1" - use default value for <use_crc>, issue the "aM1!" command instead of "aM!" command, and have no delay. "0,*" - do not use CRC and use aM! command and have no delay "0,1" - do not use CRC and use aM1! command and have no delay "0,2" - do not use CRC and use aM2! command and have no delay "*,*,100" - use default values (use CRC + aM! command) and 100 milliseconds delay. |
group | Set all channels of a specific sensor to the same group | |
group_priority | Set the priority in a decreasing order across all channels of the same sensor |
This has an impact on the way the SDI-12 handler buffers the responses from the sensor. Important: If the sensor has channels that use both "aM!" command and "aMn!" command, make sure the group_priority of the channels is ordered sequentially.
For example, all channels that use "aM!" must have consecutive values in their group_priority item. Next, all channels that use "aM1!" must follow with consecutive values in their group_priority items as well. Then, all channels that use "aM2!", and so forth. |
All other settings: use as usual |
6. Save the configuration changes, and then validate that the device rebooted by doing the following steps:
-
- Click Devices in the left pane, and then select the device in the Sites Tree pane.
- In the right pane, click the Commands tab. You will see a Reboot command after a few seconds.
- If no Reboot command is displayed, click Actions > Reboot in the Device Information pane to manually reboot the device.
Both the configuration changes and the reboot will take effect after the device contacts the server.
You can swipe the magnetic Activator key over the embossed logo on the face of the device to force a device reset, which can expedite the time for the device to connect to the server.
APPENDIX
SDI-12 Transaction without CRC
The following table shows a typical transaction with no CRC and a just a few parameters:
Who |
Command |
Response |
Comment |
---|---|---|---|
Master | 1! | Check if slave #1 is there. This is SDI-12's "a!" command. | |
Slave | 1 | Slave confirms that it is available. Note: all of the slave's responses start with the salve's address in the first character. | |
Master | 1M! | Master ask slave #1 to take a measurement on all parameters. This is SDI-12's "aM!" command. | |
Slave | 10032 | Slave responds saying it needs 3 seconds ("003") to produce 2 ("2") measurements. Note: the format of this response indicates that the slave can produce up to 9 measurements. | |
Master | ...waits for 3 seconds... | ||
Slave | 1 | The slave indicates that the data is ready. We can ignore this if we wait long enough. | |
Master | 1D0! | Master asks for the first chunk of the results. | |
Slave | 1+1.234+4.567 | Slave responds with 2 values ("1.234" and "4.567"). |
All commands and responses are terminated with <CR><LF>.
<CR> means ASCII value of 13 (which is 0D in hex).
<LF> means ASCII value of 10 (which is 0A in hex). These two bytes are "new line".
SDI-12 Transaction with CRC
SDI-12 is designed to work even when the cable length between the logger and sensor is extremely long. When working on long cables, communication errors might happen. For example, bits might get flipped along the way.
One way to detect this error is by adding a CRC code to the end of every response from the sensor. CRC stands for "cyclic redundancy check". It will not fix communication problems, but it will alert you that you have them.
An SDI-12 master can instruct the slave to add a CRC code to every response. This is done by adding "C" to the "M" command.
Example:
Who |
Command |
Response |
Comment |
---|---|---|---|
Master | 1! | Check if slave #1 is there. This is SDI-12's "a!" command. | |
Slave | 1 |
Slave confirms that it is available. Note: All of the slave's responses start with the salve's address in the first character. |
|
Master | 1MC! | Master ask slave #1 to take a measurement on all parameters and respond with a CRC code as well. This is SDI-12's "aMC!" command. | |
Slave | 10032 |
Slave responds saying it needs 3 seconds ("003") to produce 2 ("2") measurements. Note: the format of this response indicates that the slave can produce up to 9 measurements. |
|
Master | ...waits for 3 seconds... | ||
Slave | 1 | The slave indicates that the data is ready. We can ignore this if we wait long enough. | |
Master | 1D0! | Master asks for the first chunk of the results. | |
Slave | 1+1.234+4.567lpz |
Slave responds with 2 values ("1.234" and "4.567") and a CRC code ("lpz"). The CRC code should match everything before it. If it doesn't, it means we have a problem. Note: This is just an example so it doesn't. |
SDI-12 Transaction with Additional Measurements
The following table shows SDI-12 capabilities per firmware version:
Firmware Version |
Supports CRC |
Supports aM! |
Supports aMn! |
Supports aDn! |
---|---|---|---|---|
< 2.231 | Yes | Yes | No | Yes, but only aD0! |
2.231 and newer | Yes | Yes | Yes | Yes. Wavelet will issue aD0! and then aD1!...aDn! until all values are read |