Home › Forums › Other Data Loggers › Custom Arduino-based sensor, off-the-shelf SDI-12 datalogger › Reply To: Custom Arduino-based sensor, off-the-shelf SDI-12 datalogger
Update: I have succeeded in making an SDI-12 slave device on an Arduino Nano, but I have more work to do before my code can be generalized and distributed.
The project linked by GS is not really a slave-side library but rather an attempt to build a sketch implementing an SDI-12 slave with the SWRC’s SDI-12 master library. This did not work for me right out the box (for two reasons I’ll address shortly), but it did make me change course slightly. Instead of writing a new library, I added necessary functions to the SWRC SDI-12 master library to allow implementing a slave in my .ino.
The two “blocker” issues were:
– A master never has to listen for an unsolicited reply, so the master reverts to HOLDING state (which sets its SDI data pin to OUTPUT/LOW) after an action. A slave must default to LISTENING (data pin INPUT/LOW). There are several ways to accommodate this, but the least invasive is to add a public void “forceListen()” function.
– The linked example attempts to use “sendCommand()” to send a response to a command. While this does transmit the character stream per spec, there are problems: (1) wakeSensors() should not be called in a response and (2) a valid SDI-12 response requires first pulling the data line LOW for 8.33 ms. I added a public void sendResponse() function to accommodate these changes.
When I have time, I will work with SWRC to make a production version of the master/slave library and a generalized example implementation sketch. Since there’s no telling how long that will be, I thought I’d at least make the above info available to the ambitious developer. This, combined with the bones of the example sketch linked by GS, should get you started in the correct direction.