SDI-12 concurrent measurement

If you have a few SDI-12 sensors and want to quickly read their values, you may need to perform concurrent measurement. In regular measurement, using an M command, your logger issues the M command and expects the sensor to respond with the number of seconds to wait until data are ready and the total number of values. Here is an example. Assume sensor address is 1. Green is logger and blue is sensor:

1M!

10054\r\n

1\r\n

As you see, the sensor 1 needs 005 seconds to perform the measurement, which returns 4 values. Only the sensor needs to send carriage return (\r) and new line (\n). If the sensor finishes measurement before 5 second expires, it issues a service request, i.e.  its address 1 and carriage return and new line. The logger will respond by asking for data once it receives the service request.

Once the service request is received, or the expected 5 seconds elapses, the logger will ask for data using a D0 command, i.e. D and zero. The sensor will respond with data:

1D0!

1+12.34+56.78-90.12+34.56\r\n

If you have multiple sensors, you need to repeat the process multiple times, waiting about 5 seconds for each sensor. That is a lot of time. If your sensor supports concurrent measurement, you can shorten your wait time to only 5 seconds instead of 5*(number of sensor) seconds. Here is the process using concurrent command C, assuming 5 sensors:

1C!

100504\r\n

2C!

200504\r\n

3C!

300504\r\n

4C!

400504\r\n

5C!

500504\r\n

There won’t be any service request issued and the logger can go ahead to talk with the next sensor as soon as the current sensor responds with number of seconds to wait and number of data points 04 it will return. Notice that the last TWO digits now indicate the number of data points it will return, not the single last digit.

Now the logger proceeds to wait for 5 seconds and then start asking for data the same way it does when it used M command:

1D0!

1+12.34+56.78-90.12+34.56\r\n

2D0!

2+12.34+56.78-90.12+34.56\r\n

3D0!

3+12.34+56.78-90.12+34.56\r\n

4D0!

4+12.34+56.78-90.12+34.56\r\n

5D0!

5+12.34+56.78-90.12+34.56\r\n

Since all sensors are taking measurement almost simultaneously, you don’t have to wait for them individually, saving a lot of time.

Don’t stop here. Sometimes concurrent measurement is SLOWER than reading one sensor at a time! This only applies to faster sensors, such as Decagon 5TM soil temperature and volumetric water content sensor. It reports that it needs 1 second but it requires significantly less than 1 second. So if you use concurrent measurement, you will be forced to wait for a whole second. SDI-12 sensors are intended to be low-power but not for speed. The 1200 baud rate translates into about 120 characters per second, shared between the logger and sensor. The time to send the commands and data back and forth between a single sensor and the logger could take half a second to do!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: