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

Reply To: Minor Glitch Reading Maxbotix MB7389 with Mayfly

Home Forums Mayfly Data Logger Minor Glitch Reading Maxbotix MB7389 with Mayfly Reply To: Minor Glitch Reading Maxbotix MB7389 with Mayfly

#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”));
    }