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

SDI-12 Library

Home Forums Other Data Loggers SDI-12 Library

Tagged: , ,

Viewing 12 reply threads
  • Author
    Posts
    • #13844
      quiqueapolo
      Participant

        Hi:

        I am using this library SDI12. I’m trying to read SRS sensor from Decagon. The code used is the provided in the example codes call “d_simple_logger.ino”. The code works well and I can read all the sensors. However, the time to read all the sensors is too high. Due to the code takes 3-4 seconds for reading each sensors. I have 8 sensors attached. In this sense, the time required to read all sensors is around 25 seconds. Could someone tell me how to solve this problem?

      • #13845
        Shannon Hicks
        Moderator

          That example goes through the list of available address to see if a sensor is attached that has a corresponding address, so it definitely takes awhile to go through the whole list.  You could rewrite it to only go through the addresses of your sensors and not the entire list.  But your sensors have a 600ms sample time (as stated in the datasheet), so you’ll need to add a little delay after that and then you’ll have the poll time, so I’d allow 1 second for each sensor, and with 8 sensors it’ll take 8 seconds total.  Is that acceptable?

        • #13846
          quiqueapolo
          Participant

            Could you tell me the lines I need to rewrite to read only my adress. I have 8 sensors with adress from 0 to 7.

          • #13847
            Shannon Hicks
            Moderator

              That demo sketch is just a sample of how to talk to your sensors, there’s lots of stuff in there that you could trim out if you’re actually trying to collect data at a certain rate.  What type of board are you using?  Are you planning to store the data on a memory card or just print to the computer’s serial monitor?  There’s a 10-second delay on the very last line of the sketch that isn’t needed if you’re trying to cut down on time between samples.  Do you want to take one discrete reading from each sensor each time, or are you interested in taking several readings from each sensor an averaging them to limit the “noise” or variation between readings of each sensor?   Are you sensors going to be powered continuously or do you want to turn them off between readings?  Do you need a timestamp to go along with each data record?

            • #13848
              quiqueapolo
              Participant

                I achieve to reduce the time to 8 seconds (see the code attached). I am storing the data in a Micro SD Card. The sensors will be powered continuously. I am using an Arduino UNO board. I am interesting in take on discrete reading from each sensor. In the code I also include a Melexis infrared thermometers.

                Regards, Enrique

                Attachments:
              • #13868
                Sara Damiano
                Moderator

                  Is your goal to read all of your sensors and write to your SD card as fast as you possibly can?  You could get faster readings by using concurrent sampling on the Decagons like this:  https://github.com/EnviroDIY/Arduino-SDI-12/blob/master/examples/k_concurrent_logger/k_concurrent_logger.ino

                • #13869
                  Sara Damiano
                  Moderator

                    Re-Wrote for you.  I didn’t even test if it compiles, but this should get you going with concurrent measurements:

                     

                  • #13872
                    quiqueapolo
                    Participant

                      Hi Sara:

                      Thank you for your quickly answer. However, when I tried to compile the code several errors were shown (see images attached).

                      Regards, Enrique

                    • #13903
                      Sara Damiano
                      Moderator

                        Delete lines 112-117 of the code I posted.

                      • #13963
                        quiqueapolo
                        Participant

                          Hi again Sara:

                          I deleted the lines that you say in previous comment. However, the problem do not have solution.

                          Thanks in advance

                        • #13967
                          Sara Damiano
                          Moderator

                            My intent was to help you by giving you an example of something you could modify to your needs, not to give you a final working program.

                            This version will compile.  I don’t know if it will actually work for your sensors or log data as expected.  You will need to test that.

                             

                          • #17506
                            Rick Vogel
                            Participant

                              Has anyone looked to see if the SDI-12 library could be ported to the new RP2040 chip. Maybe that already works in its existing state, but I haven’t see it mentioned anywhere. This is the new IC that runs the RPi Pico and can be used via the Arduino language.

                            • #17508
                              neilh20
                              Participant

                                @vogelrnws I had been looking at porting it to another processor and been using it and digging into the code. I’ve looked at some of the RP2040, but I’m cautious about its ability to go into low power – but haven’t looked at it in depth.

                                The SDI-12 lib uses a software based UART – running at 1200Baud, so 1200Baud is pretty slow and it does handle it. It needs to have a timer generated to be able to look for the changes in the data stream.

                                Unfortunately, IMHO, I’ve found it to be quite fragile.   Also the software timing has made debugging fragile.  In 2021 I had also found it worked with some Insitu LT500 sensors and not others. I tried to put a “test station” together, against a traceable SDI-12 test setup using https://www.vegetronix.com/Products/SDI-12 and it failed on the basic physical test.

                                So I’m thinking about how to 1) +5V buffer  possibly this solution https://github.com/EnviroDIY/Arduino-SDI-12/issues/87

                                2) hardware timing. Possibly emulate the UART with with either DMA or Timer/Capture.

                                So maybe the hardware interface could be done with a simple 4 wire Seeed plugin with an off-board buffer and boost to +12V, and software modified.

                                So just IMHO a heads up on some of the possible issues to consider.

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