SDI-12 concurrent measurement
January 20, 2017 Leave a comment
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:
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:
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:
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:
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!