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

Minor Glitch Reading Maxbotix MB7389 with Mayfly

Home Forums Mayfly Data Logger Minor Glitch Reading Maxbotix MB7389 with Mayfly

This topic contains 4 replies, has 3 voices, and was last updated by  Anthony Aufdenkampe 1 month, 3 weeks ago.

  • Author
    Posts
  • #12309

    Kevin Stokes
    Participant

    We have deployed a water depth station using a Maxbotix MB 7389 ultrasonic sensor with a Mayfly datalogger. It is dutifully reading the sensors every 11 minutes and uploading the data to data.enviroDIY.org. We are using “Logging_to_EnviroDIY,” modified for our sensors. The data site is Paulding County High School Retention Pond (PCHS_POND), in northwest Georgia. Every few data points the reading from the MB7389 is 7389 or 738. Looking at the code in MaxBotixSonar.cpp, it appears that this might be part of the sensor model number which is one of the six header lines reported by the sensor when it is powered up. Any ideas about whether or not my guess is correct and how to fix it, would be appreciated. I am thinking about simply adding a condition to the existing bad data trapping “if” statement to ignore 7389 or 738 and retake the data point.

  • #12321

    David Petry
    Participant

    I am also having a similar issue with the MB7989 with MB7955 and EnviroDIY Mayfly. My sensor was deployed for four days, and when I went back to check on it and swap out an SD card, when it turned back on, it would only read a distance of 7389, regardless of the actual distance. I am also interested in any ideas as to how to fix this issue.

    For reference, my sensor is mounted in an Agri Drain water level control structure with a v-notch weir to ultimately record flow in gallons per minute discharging from a pond.

  • #12329

    Kevin Stokes
    Participant

    I have an update. I think the problem comes from the reading the sensor with SoftwareSerial_ExInts. There is data left in the read buffer after the read. I’m not sure if this is a real fix, but it seems to work. There is a section of code in MaxBotixSonar.cpp that reads the six header lines from the sensor, after the power is turned on. I changed it to read 20 lines. This means that it reads everything left in the buffer and you are getting new data.

    MS_DBG(F(“Parsing Header Lines from MaxBotix on “), getSensorLocation(), ‘\n’);
    for(int i = 0; i < 20; i++)
    {
    String headerLine = _stream->readStringUntil(‘\r’);
    delay(20)
    MS_DBG(i, F(” – “), headerLine, F(“\n”));
    }

  • #12346

    Kevin and David, thanks for posting these issues with the MaxSonar. David, thanks also for the photos!

    I’ve also had funkiness with my Maxbotix deployments this summer when using the EnviroDIY ModularSensors library. For me it just seemed like it was repeating the last values.

    David, thanks for showing everyone that quick fix and for helping me make the connection that the issue was likely with with SoftwareSerial_ExInts. I think that has been the trouble, but in an indirect way.

    Anyways, I think it’s been fixed on one of our development branches, which I’ll point you two to for testing.

    The history is that Sara Damiano did a ton of work this spring to stabilize code, especially with anything related to SoftwareSerial including Arduino-SDI-12 (see ModularSensors/releases and also Arduino-SDI-12/releases. However, she didn’t quite finish pulling all of that work back into an official release before heading out on maternity leave. See https://github.com/EnviroDIY/ModularSensors/pull/153. Anyways, one of her commits (e1e3ecc) added a buffer cleaning step to the MaxBotixSonar.cpp. The code in her pull request also points to an updated version of the Arduino-SDI-12_ExtInts library.

    Anyways, I’ve successfully gotten stable data from a MaxSonar with the new code with at:

    ;ModularSensors *calcVar* branch as of June 4, 2018: head, 52 commits ahead of 0.11.6 https://github.com/EnviroDIY/ModularSensors.git#4a10279e1031513391ce03d1914684ce5db812ff

    If either of you use PlatformIO IDE, you can easily reconfigure your libraries to point to this code by adding the line above to your .ini file.

    Otherwise, download the repo at that point in the commit tree by going here:
    https://github.com/EnviroDIY/ModularSensors/tree/4a10279e1031513391ce03d1914684ce5db812ff

    Let us know how that works. Meanwhile, I’ll be working toward moving that into a new release.

  • #12394

    Kevin and David,
    Here’s a heads up that the after some testing, we pushed those development branches to the master branch of https://github.com/EnviroDIY/ModularSensors. The Maxbotix should work well now, and it should be much easier to find the right version of the code. We’ll give it an official release soon.

You must be logged in to reply to this topic.