SDI-12 Communication Protocol


The Serial Digital Interface at 1200 baud Protocol (SDI-12) is a data communications protocol developed specifically for environmental monitoring applications. The motivation to create SDI-12 began in the 1980s when a group of environmental monitoring specialists became frustrated with the complexity of interfacing analog sensors with the data loggers of the time. In addition, these low-power analog sensors were highly unreliable. A goal was to develop a protocol to address and solve these frustrations.

SDI-12 was the solution to the environmental monitoring specialists’ needs. SDI-12 governs exactly how a sensor must communicate with a data logger. Any sensor claiming to be SDI-12 compatible must accept a standard set of commands and conform to specific electrical and power standards. SDI-12 sensors are smart sensors. They contain specialized circuitry and programming to enable users to configure and calibrate the sensor independently of a data logger.

There are several advantages to using SDI-12 sensors over classic analog monitoring devices:

  • The SDI-12 digital signal is low-power and resistant to data errors.
  • The sensor’s analog signal is converted to digital in the sensor, not the data logger.
  • The use of digital signals greatly reduces the effects of noise interference.
  • The sensors can be instantly plugged-in or unplugged from the system.

 

SDI-12 Electrical Interface

The SDI-12 electrical interface transmits serial data between data loggers and sensors. A connection between an SDI-12 sensor and a data logger only requires three conductors:

  • A serial data line
  • A ground line
  • A 12VDC line

The SDI-12 bus can have at least 10 sensors connected, each with 200 feet of cable; however, with few sensors, longer cable lengths are possible. The SDI-12 format has the following baud rate and frame format:

  • 1200 baud rate
  • 1 start bit
  • 7 data bits, the least significant bit transmitted first
  • 1 parity bit
  • Even parity
  • 1 stop bit

 

SDI-12 Command Grammar

Sensors that adhere to the SDI-12 protocol have a subset of commands consistent with every other SDI-12 sensor. These commands can identify the instrument, start a measurement, get data, etc. The data logger sends the measurement command to the instrument at a user-specified interval (the log or sample interval). The SDI-12 sensor will then start taking a measurement and let the data logger know when it is complete. When the sensor has finished measuring, the data logger will ask the sensor for the data. The sensor will return its data in a data string such as:

0+79.5+0.008+0.988+0.92

SDI-12 protocol does not tell the user what parameter and unit of measurement each returned value is. This information is stored in the data logger and specified in the software.

 

Sensor Address

The first character of every command is the controller address. Likewise, the first character of every response is the address as well. The default controller address is ASCII 0. Only addresses ASCII 0 through ASCII 9 are allowed.

“?” Wildcard Address

The wildcard address ASCII “?” may be used instead of a sensor address. However, if a system has more than one SDI-12 sensor connected, all of them will respond to the wildcard address, which may cause confusion. It is recommended that the wildcard address be only used when using the address query command.

Typical SDI-12 Commands

SDI-12 has many commands for different applications; however, most are unnecessary for establishing communication with an external controller. A few of the commonly used commands are summarized below. For each command, the initial “a” value is a stand-in for the sensor address:

Identification

Command: aI!

Response: allcccccccmmmmmmvvvxx

  • ll, the 2-digit supported SDI-12 version, i.e., “13”
  • cccccc, the 7-digit manufacturer name, i.e., “YSIWQSG”
  • mmmmmm, the 6-digit model number, i.e., “EXOSND”
  • vvv, the 3-digit major and minor firmware version number, i.e., “100”
  • xx, the 2-digit build firmware version number, i.e., “01”

 

Measurement

Command: aM! or aMC!

Response: atttn

  • ttt, the 3-digit number of seconds until the requested measurement is ready.
  • n, the single-digit number of parameters returned by the measurement.

This single-digit number is an ASCII (American Standard Code for Information Interchange) character that is NOT limited to ‘0’ to ‘9’ as in the SDI-12 specification. It can be from ‘0’ on through the ASCII list (the limit will differ from version to version). The “N” character displayed is an ASCII character corresponding to the number of parameters only after subtracting the ASCII value “0” from it.
i.e., <# of parameters> = N – <decimal value of ASCII 0>

Example: 20 parameters

The N value displayed will be “D”
So that N = “D”-“0” = 68 – 48 = 20
For information on ASCII characters, visit www.asciitable.com

 

Concurrent Measurement

Command: aC! or aCC!

Response: atttnn

  • ttt, the 3-digit number of seconds until the requested measurement is ready.
  • nn, the number of measurement values returned from a Request Data command.

 

Request Data

Command: aD0 … aD9!

Response: 0-<value 1>+<value 2>-<value 3>+<value 4>

Negative or positive responses are indicated by the symbol (i.e., + or -) before the displayed value. This command responds with the maximum number of decimal places (5) and truncates measurements to meet the 7-character limit defined in the specification. This command should not be sent until after the measurement command has been sent and the time specified by the measurement command has passed, otherwise, the measurement will be aborted.

 

Change SDI-12 Address

Command: aAb!

Response: b

Changes the sensor address from a to b. b must be from 0 to 9, and it should be an address not used by any other SDI-12 sensor connected to the particular system.

 

The list of standard SDI-12 commands is available in the SDI-12 protocol specification from the SDI-12 Support Group at www.sdi-12.org.