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

Problems with a combined MH21 Gen1 and Gen2 station

Home Forums Mayfly Data Logger Problems with a combined MH21 Gen1 and Gen2 station

Viewing 4 reply threads
  • Author
    Posts
    • #17340
      John
      Participant

      Hey all.

      I have a station that started out with two Gen1 METER Hydros 21s and has transitioned to having one  Gen1 and one Gen2.  Unfortunately, I can’t seem to get the sketch to work now even though it was before.  It compiles and uploads to the card, and the Gen1 sensor does just fine but I get -9999 from the Gen2 now that it’s installed.  When I was calibrating the Gen2 with this same sketch, it worked just fine on its own.

      From other comments in the forums, I knew that I needed to update to Modular Sensors 0.33.3 and I did that.  Are there other changes to the code that I should have made to the sketch to make this work?  I’m attaching my code and I’d appreciate any ideas or feedback folks have to offer.

      Thanks!

    • #17342
      Shannon Hicks
      Moderator

      From the sketch, it looks like you’re trying to operate both sensors on the same logger by using a separate data pins for each sensors?  That’s not the correct way to do it because of how the underlying EnviroDIY SDI12 library functions. You should instead put both sensors on the same data line (usually D7).  Each sensor will need its own unique address, and it looks like you’re using 1 and 7 for your addresses, so once the sensors have different addresses, they can share the same data pin with up to 62 total devices, as long as each device has a unique address.  There are 2 identical grove jacks on the latest Mayfly boards for SDI-12 ( D4-7) for people who want to easily connect 2 SDI12 sensors at the same time.  Otherwise you’ll need a grove branch cablelike this one:  https://www.seeedstudio.com/Grove-Branch-Cable-5PCs-pack.html

      Once you’ve got the 2 sensors connected, then just simply the code by combining the constants named “hydros21Data_x” on lines 149 and 150 of your sketch to just one constant on pin 7 and then make sure the objects on lines 155 and 157 point to that one constant.

    • #17343
      John
      Participant

      Thanks, Shannon.  I think I get it.  🙂

      Just out of curiosity, is this new?  Or is it something that just became an issue because of trying to run the two different generations of sensor that way?  It was working fine with the two Gen1 sensors written as it is.  I suppose I’m trying to figure out if I just got lucky originally.

    • #17344
      Shannon Hicks
      Moderator

      The only difference between the Gen 1 and 2 Hydros21 sensors is that the Gen 2 sensors need a little more time to respond to the SDI12 measurement command, which is hardcoded into one line in the MeterHydros21.h file within the ModularSensors library.  If you’re using the most recent version of ModularSensors, then your code will support both generations of sensors.  But the SDI12 library is a separate library from ModularSensors and is very complex and handles things like interrupts and timing that can break if not used correctly, or it could also conflict with other libraries or functions if they’re not compatible.  I didn’t check the rest of your code, but I’ve successfully used over a dozen Hydros21 sensors simultaneously with one Mayfly board before with all the sensors connected to D7, but the most important thing is to verify that each sensor has had its SDI12 address changed individually to a unique number prior to connecting them all to a logger with a sketch that is communicating with all of them at once.

    • #17345
      John
      Participant

      Ah!  Some pieces are coming into clearer focus.

      Thanks!

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