Home › Forums › Mayfly Data Logger › Hydros 21 and Serial Comms › Reply To: Hydros 21 and Serial Comms
The power cycling done by modular sensors is based on the power pin you used to set up the Hydros21. If you have your other serial peripheral on the same pin, it’s possible that the power cycling could be throwing it off. Try putting them on different power pins, or re-running the Serial.begin() after the power cycle.
The Hydros21 is an SDI-12 sensor using the SDI-12 library under the hood. That library does make use of and changes the settings for Timer2. Any other library that would use Timer2 (Tone, NeoSWSerial, etc) will conflict with it without showing compiler errors. See this: SDI-12 ReadMe. ModularSensors runs a begin() and end() on the SDI-12 objects whenever it talks to them, which *should* set and unset the timers and prevent conflicts, but it’s possible there’s still a problem with them.
As a side note, instead of using getValueString() and then toFloat() and then converting back to a String, you should just use the string value in your hydros_data String. If you need the float for some reason, use getValue(). The getValueString() is designed to not only give the value as a string, but to also give it in with the appropriate number of significant figures based on the specifications of each sensor. Converting to a float and back to a String completely negates that.