The SDI-12 interface is a low data rate protocol designed for agricultural and scientific sensors (SDI-12 Website).
A soil moisture probe will often have multiple sensors along its length. Each sensor can have an address between 0 and 9 (inclusive), and allows for up to 10 different 'measurements'. Each of these measurements can actually return a number of different values (up to 15). For example, a soil moisture probe may have a soil moisture and soil temperature measurements, and each of these will return a number of values, each being taken at a certain point along the probe.
What SDI-12 probes are compatible?
The SDI-12 specification is a generic specification. Any probe that follows the spec will in theory work with the Eagle. What this means in practice is that most probes work - but occasionally, some will send data slightly differently (i.e. not 100% in accordance with the specification) - or there can be issues with timing. This can lead to the probe incorrectly functioning. These issues are hard to predict ahead of time without simply testing the probe with the device. In general though the majority of SDI-12 probes are compatible.
The caveat to this is discussed below, the Eagle uses the M! command, so we may not be able to return the values we are after from the probe (which may be obtained via other commands) - without customising the firmware.
- Up to 5 probes can be connected
- Up to 10 measurements can be configured to be taken from each probe (using the M! command)
- Each measurement can return up to 15 values.
What SDI-12 commands does the Eagle use?
The Eagle (and SensorData LoRaWAN) use the M! command. It is mainly designed around the use-case of monitoring soil moisture probes. Implementing multiple arbitrary commands in a specific sequence generically is more complicated - but contact us if you have specific requirements to discuss the options.
The full control flow of the SDI-12 measurement, for an address a, and measurement type t, is:
Tx: aI! (identify device)
Rx: axxxxx…. The response gets sent as part of the SDI12 data. If no response, then we give up this measurement.
For each measurement parameter, the following goes through each set bit in the mask
Tx: aM! (or aMt! if the type is not 0)
Rx: aXXXn. XXX is how long we need to wait before the samples are ready, and n are how many it will return (both can be 0).
After waiting XXX seconds, the following goes through each value of n, from 0 to 9, until either 0 data is returned (but still a response), or we reach 15 individual values returned. Each aDn command can return more than one value
If at any time no response is heard, the measurement is aborted.
What if my probe has more than 10 sensors along it's length?
Some sensors may have over 10 sensors along the length. Given each measurement can return up to 15 values - we would think 15 sensor probes should be supported. However this isn't always the case.
For such probes, the way we poll each sensor is sequentially sending M! commands.
M0 - read sensor 0
M1 - read sensor 1
M9 - read sensor 9.
Each of these readings would have 1 value, the sensor's reading. So only the first 10 probes would return their values (as we're only getting the Eagle to poll the first 10 via M0->M9
Sometimes for such sensors, the manufacturer will recommend using another command (i.e. C!) to instruct the sensor to simply return all measurements. In this case 15 values could be returned in the one measurement (which is allowed). Speak to us if you have a longer probe to discuss your options - C! is not a currently supported command.
Vout on the Eagle is simply the supply voltage. Different sensors need different warm-up times before readings can be taken, so set the power up delay here.
SDI-12 Measurements 1-5
Up to 10 measurements types can be taken on each probe and there are 5 different addresses represented by the tabs in system parameters. Set the address (0-4) in the Address field
- The measurement mask is a hex bit mask. For example; for address 0, and measurements 1, 4 and 7, we would set the Address parameter to 0.
- Then the measurement mask is created as follows: From right to left, set the nth 0 to 1 for the type number you want to measure.
- e.g. To measure types 1, 4 and 7, set the 1st, 4th and 7th bit from the right to 1, creating 1001 0010.
- Convert this binary octet to hexadecimal: 1001 0010 = 0x92.
- So the Measurement Mask parameter needs to be set to 0x92
SDI-12 Measurement example
SDI12Sensordata. //Device Type
DeviceAddress: 0, // SDI-12 Measurement address
DeviceId: 13EP100GL-08 01180808155625 // (Probe ID)
Measurements: Type:0, Count:8, Values: 59030 64930 67100 68450 70570 69170 68750 65450. //Measurement type 0 with 8 samples
Measurements: Type:2, Count:8, Values: 20020 19570 19250 18940 18920 18780 18550 18210. //Measurement type 2 with 8 samples