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

Progress with Hydreon RG-15 Rain Sensor and TippingBucketRainCounter

Home Forums Mayfly Data Logger Progress with Hydreon RG-15 Rain Sensor and TippingBucketRainCounter

Viewing 2 reply threads
  • Author
    • #16249
      James B

        I have been testing out the solid-state rain gauge manufactured by Hydreon, model RG-15.   The sensor works successfully as a drop in replacement for a standard tipping bucket style rain gauge both as a stand alone device using the TippingBucketRainCounter Master/Slave code and also with the ModularSensors code as Master, in both  cases using the Mayfly as the master device and a Inland brand 5V Arduino Uno R3 clone as the slave device.  I have encountered two problems and after many days I have solved the first problem which other people might possibly encounter if they attempt to set up a rain gauge:

        1)When using Modular sensors on the Mayfly as the Master and the TippingBucketRainCounter Slave code on the slave device, the Mayfly always reports tips and rain values as “0.0” even if the slave device is recording tips, no matter how many tips have actually occurred, and even if the message is transmitted from master to slave and back to master.

        I confirmed that all connections were correct and that the slave was being recognized on the i2C bus by using the i2C scan tool code and it was. At some point I was suspicious of the difference in logic level voltage between the 5V Arduino and the Mayfly and I added a 4 channel bidirectional level converter from Adafruit. I further confirmed the setup was correct when the bare TippingBucketRainCounter code worked with the RG-15 sensor and also with a commercial tipping bucket the TR-525M from Texas Electronics. I noticed that in this code the tip value was always “stored” in SerialBuffer[3] and that the correct values were being sent over i2C. With the ModularSensors code as Master and the same RainCounter code as slave, only 0.0 values are reported using both the commercial tipping bucket and the RG-15.  The final solution I found was when using the ModularSensors code as the master, in the TippingBucketRainCounter slave code, reverse the order of the byte array.  Change to

        SerialBuffer[0] = ReadTips & 0xFF;
        SerialBuffer[1] = (ReadTips >> 8) & 0xFF;
        SerialBuffer[2] = (ReadTips >> 16) & 0xFF;
        SerialBuffer[3] = (ReadTips >> 24) & 0xFF;

        This solution works with the ModularSensors code on the Mayfly master and the correct tip and rain values are reported.

        2)The second problem, which I encountered first and can’t solve, is that SoftwareWire is not working.  Despite having #define MS_RAIN_SOFTWAREWIRE uncommented, Softwarewire and it’s pins are ignored and the only pins that work for i2C are the Mayfly SDA/SCL pins. Using any Softwarewire pins result in -9999 values.  I have not been able to figure out the cause of this. I am working with the newest ModularSensors Master and using a Mayfly version 0.5b. I am using the Arduino IDE and not Platform I/O so I don’t know if this behavior is due to a discrepancy related to that or if I am doing something wrong. @srgdamiano I would appreciate any thoughts.

        Eventually I would like to try the RG-15 and an Arduino i2C Slave with pins 10/11 over SoftwareWire using the grove plug and 5V unswitched power, as the RG-15 needs continuous power, and too does the slave device that is hooked to it.


      • #16892
        Anthony Aufdenkampe

          @jamesbailey, I just noticed this post and have a quick answer to your first problem regarding the EnviroDIY/TippingBucketRainCounter library.

          In April 2021, I issued the v0.2.0: Add Anemometer Counting and Bug Fix release, which not only fixed a byte-order bug in the original release, but also expanded event counter from 2-bytes to 4-bytes.

          Shortly afterwards I updated the EnviroDIY/ModularSensors library, in a feature branch, to work with the RainCounter release, and these updates were merged into the develop branch in October 2021 with the Update RainCounterIC2 to support reed-switch anemometer #384 pull request.

          Unfortunately, that code is only now working its way into a new official release of ModularSensors, see https://github.com/EnviroDIY/ModularSensors/pull/407. When that release happens, you will no longer need to “hack” the libraries to get things to work.

          Sorry for that delay in getting these two libraries synced up, and for the extra troubles that it caused you!

        • #16922
          James B

            Thanks Anthony

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