Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, an initiative of Stroud Water Research Center designed to help people advance knowledge and stewardship of fresh water.
New to EnviroDIY? Start here

Custom Arduino-based sensor, off-the-shelf SDI-12 datalogger

Home Forums Other Data Loggers Custom Arduino-based sensor, off-the-shelf SDI-12 datalogger

Viewing 8 reply threads
  • Author
    • #1339
      Danny Waz

        I see that much effort has been invested in connecting off-the-shelf SDI-12 sensors to an Arduino-based datalogger, and for good reason. I have the opposite challenge: integrating a custom sensor (a smart sensor with an Arduino brain) with an existing off-the-shelf SDI-12 datalogger already deployed at a field site.

        Before expending the effort to write a SDI-12 “slave” library for Arduino, I thought I would inquire if anyone has already done so or has other relevant experience.

      • #1347
        • #1371
          Danny Waz

            Thanks! It will be a few weeks before I get a chance to try out this library live, but at first glance it appears to be almost exactly what I was planning to make.

          • #1495
            Danny Waz

              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.

            • #1697
              Danny Waz

                Update 2: I have posted the modified library and an example implementation sketch in a fork off of the EnviroDIY Arduino-SDI-12 repository.


              • #2060
                Danny Waz

                  Update 3: Looks like EnviroDIY has merged my backward-compatible slave-side additions into their main library, so you don’t need my fork if you have the latest version. See example “g” for a slave implementation.

                • #2061
                  Anthony Aufdenkampe

                    Danny, thanks for all your work on implementing these slave-side additions to our Arduino SDI-12 library (https://github.com/EnviroDIY/Arduino-SDI-12)! We really appreciate your contributions!

                    As you mentioned, @srgdamiano has been very actively working on all of the Arduino libraries that our Mayfly depends on for communicating with environmental sensors. See https://github.com/EnviroDIY/Libraries.

                    These libraries make it quite easy to use the example and workshop sketches in https://github.com/EnviroDIY/EnviroDIY_Mayfly_Logger.

                    The most exciting stuff, however, is in a new Modular Sensors library that we are developing not just for the EnviroDIY Mayfly but also for other Arduino-compatible boards (but we haven’t tested any of those yet!). See https://github.com/EnviroDIY/ModularSensors.

                  • #2110
                    • #2122
                      Sara Damiano

                        I’d love any feedback you have on the modular sensors library! Feel free to post GitHub issues or post comments in the forums.

                        The Libraries repository doesn’t actually have anything new on its own, it’s just a bunch of links so anyone can download some of the more helpful libraries all at once. Do let me know if you think there are any crucial libraries that are missing!

                    Viewing 8 reply threads
                    • You must be logged in to reply to this topic.