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

Reply To: Problems with a combined MH21 Gen1 and Gen2 station

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

#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.