Tagged: Tipping Bucket Rain Counter
2022-01-10 at 1:31 AM #16249James BParticipant
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 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 = ReadTips & 0xFF;
SerialBuffer = (ReadTips >> 8) & 0xFF;
SerialBuffer = (ReadTips >> 16) & 0xFF;
SerialBuffer = (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.
2022-03-31 at 7:09 PM #16892Anthony AufdenkampeParticipant
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
developbranch 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!
2022-04-19 at 9:19 PM #16922James BParticipant
- You must be logged in to reply to this topic.