SDi-12 + GPS USB adapter test
March 19, 2017 10 Comments
I was able to perform some tests on the new SDI-12 + GPS USB adapter. I don’t have the GPS module but do have an arduino shield that features the same GolbalTol GPS module so I used some jumper wires to connect the GPS to the adapter. I did tests last night and overnight. Things are looking good. Here are some results:
Commands:
To get longitude and latitude, you will issue “zM!”. The return values are z(long)(lat)\r\n. The longitude and latitude are both in standard NMEA format of 100*(degree.minute). For instance, a longitude of -9412.3411 means -(94 degrees 12.3411 minutes).
To get day, month, and year, you will issue “zM1!”. The return value is again in standard NMEA format of +DDMMYY. For example, a date of +190317 means the 19th of March, 2017.
To get hour, minute, and second, you will issue “zM2!”. The return value is also in standard NMEA format of +hhmmss. For example, a time of +123507 means 12:35:07 in 24hr style so it is 12:35:07 PM for those that use 12hr style.
Sample commands (in red) and returns (in green):
Single-sensor measurement:
zM!
z0012
z
zD0!
z-09456.1234+4578.9012
zM1!
z0011
z
zD0!
z+190317
zM2!
z0011
z
zD0!
z+065402
Concurrent measurement:
zC!
z00102
zD0!
z-09456.1234+4578.9012
zC1!
z00101
zD0!
z+190317
zC2!
z00101
zD0!
z+065713
How can I change the logger_v1_xx_.py script such that I get all the location, date and time at the same time?. With my limited python knowledge I can only get one of those at a time by modifying the ” +b’M!’ ” line. Thanks. Sebastian
Sebastian,
That was a good question! Let’s assume that you will be using version 1.6.0 of my script. When using this logger script, it will first ask which serial port, what sensor address, what sensing command for each sensor address. You will answer sensor address including both your actual SDI-12 sensor addresses and the adapter’s own SDI-12 address.
For example, you have two SDI-12 sensors with addresses 1 and 2. Your answer would be 12z, with the lower-case z representing the adapter’s GPS sensor address. Then when the script is asking what sensing commands to issue for each sensor address, when it comes to address z, you will respond with 012. 0 being GPS coordinates, 1 being date, 2 being time.
The reason that I didn’t put them all together in one sensing command is that the SDI-12 standard has limitation of how many characters may be returned per sensing command and having all information returned with one sensing command is too many characters.
Here is a screen grab showing my responses:
https://liudr.files.wordpress.com/2019/06/logging-script-1_6_0-multiple-sensors-and-multiple-sensing-commands-per-sensor.png
Thanks for your quick answer, I am using version 1.5.0., but I’ll switch to 1.6.0 and try this configuration. Thanks! Sebastian
Version 1.6.0 is significantly more complex because some users want to collect from multiple sensors and use multiple sensing commands such as D!, D1!, D2! etc. So please read the script carefully and follow the on-screen instruction.
I switched to v 1.6.0. and now I can get all location, date and time from the GPS, however, when I try to also get data from my other SDI-12 sensor (address ‘I’) I get an error on the code.
“File ski_12_logger_v1_6_0BP.py, line 267, in
for a_command in paras[‘ski_12_command’][cmd_ptr]
Index error: list index out of range”
Which I thing has to do with the way I provide the instructions.
I am using the configuration file Liudrlogger.conf to run the script, and this what I have for the addresses and instructions:
{“sdi_12_address”:”Iz”,”sdi_command”:”0012″}
How can I differentiate the instructions between different sensors or addresses? Thanks,
Sebastian
The relevant part of the config file should be {“sdi_12_address”: “1z”,”sdi_12_command”: [“0”, “012”]}. Once you enter lz, the script will ask you what command for l and then what command for z. For l, enter just 0, for z, enter 012. I don’t know how you did it. Please review the screen shot I provided here:
https://liudr.files.wordpress.com/2019/06/logging-script-1_6_0-multiple-sensors-and-multiple-sensing-commands-per-sensor.png
The problem was that I created the config file only to read the GPS and then manually modified it to read both. But now it is working, thanks!
Always great to know when things start to work. Could you please leave me a positive review where you made the purchase? I can’t confirm where you purchased the adapter from your email address. Probably a colleague purchased it in their name.
If you move the config file to a different folder and run the script 1.6.0 again, it will enter interactive mode to ask for everything to make a new config file. You can follow this routine to make several config files say with different sensors and logging intervals. Then if you want to run a certain config file, you can include its name in the command line such as python3 logger_1_6_0.py configA.conf
This version was significantly more complete besides handling multiple sensors and sensing commands it loads configs according to a json format file. I hope the adapter and the free logging script gets you started with your project.
Yes, my colleague bought the unit. I’ll try to get that positive review for you. Thanks,
Sebastian
Thanks Sebastian! I know that many buyers are actually not who are using the adapters. They are administrators or maybe colleagues so it’s hard to get a hold of the actual buyers to leave a positive comment on the sales site, tindie.com or inmojo.com. I appreciate your effort to get this review done!