Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, a web toolkit designed to help citizens, conservation practitioners, municipal decision-makers, researchers, educators, and students 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 10 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
      Keymaster

      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
      Keymaster

      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:
      1. NPLAT.ino
    • #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.

       

Viewing 10 reply threads

You must be logged in to reply to this topic.