Read analog sensors on SDI-12 USB + Analog adapter
November 18, 2016 2 Comments
Reading analog sensors are easy. The adapter has SDI-12 address of ‘z’, lower case. So reading the analog sensor just involves querying the SDI-12 address ‘z’. There are two sensing modes: single-ended, and differential. If you have mixed single-ended and differential channels, read single-ended, then differential. Discard channels you don’t need. It won’t hurt the sensors or the adapter if you wire them in differential mode but read in single-ended mode. The reverse is also true.
The sensing commands are ‘zM!’ for single-ended readings, and ‘zM1!’ for differential readings.
In both modes, you use ‘zD01!’ zee-Dee-zero-!, to get data. Essentially, the adapter itself is an SDI-12 sensor that reports 2 or 4 values, depending on sensing mode. This makes it very easy to integrate analog sensors into your existing data logger that is based on the original SDI-12 USB adapter. It is still advantageous to keep the original SDI-12 USB adapter so it can split SDI-12 sensors with the SDI-12 + Analog adapter. In case one SDI-12 sensor gets broken and interferes with the rest of the sensors on that adapter, the SDI-12 sensors on the other adapter will be unaffected.
To make this complete, the SDI-12 USB + Analog adapter also responds to the following commands:
Command:’z!’
Response: ‘z\r\n’ This means that the adapter is responding to queries.
Command: ‘z!’
Response: ‘z13Liudr SDITRD130\r\n’ This indicates that the firmware is in version 1.3.0.
Command: ‘zM!’
Response: ‘z0014\r\nz\r\n’ This means that the adapter needs 1 second to acquire 4 single-ended auto-scale analog values. The second ‘z’ indicates it completed the acquisition.
Command: ‘zM1!’
Response: ‘z0012\r\nz\r\n’ This means that the adapter needs 1 second to acquire 2 differential auto-scale analog values. The second ‘z’ indicates it completed the acquisition.
C0mmand: ‘zD0!’
Response: ‘z+1.23456+2.34567+3.45678+4.56789\r\n’ or ‘z+1.23456+2.34567\r\n’ These are single-ended or differential channel readings, depending on whether M or M1 was issued before D0.
Hi Liudr,
Thanks for pointing this out. I accidentally assigned ‘z’ to one of my sensors. Do you have any idea how I could change my sensor back to ‘a’ for example? Or do i simply have to look for another datalogger to do this?
That’s unfortunate!
I updated my firmware to have this firmware with address y instead of z. Please go to the USB adapter page and scroll to the end. There’s instructions and files for updating firmware. File name is 159Y.HEX. Let me know how it works. Since we have a chip shortage, I’ve used 328 and 328pb to substitute for 328p in production. If your firmware update doesn’t work, it’s most likely your adapter has 328 or 328pb. In this case, change the python script accordingly. Where you see -patmega328p, change to -patmega328 or -patmega328pb.