💬 Battery operated rain-gauge

  • Mod

    why are you using a 555 timer? the sleep function can handle both hw interrupt and a timed sleep time

  • Hardware Contributor

    timed sleep time

    @gohan how does the node keep track of time when sleeping? Is this the "new" smartsleep function?

  • Mod

    don't you normally use sleep(30000) to sleep sleep a node for 5 minutes?

  • Well, maybe I missed something. So, if the node sleeps for say 30000 mS and it receives an interrupt from the bucket: After handling the interrupt, does it sleep for the remaining time until 30000 mS have passed or does it start over, sleeping for another 30000mS? Not fully clear from the API. What I wanted to achieve is to have a rain report every 5 minutes regardless if there is rain or not.

  • Mod

    it starts over whichever way you interrupt the sleep

  • So this is why i implemented a timer. I want rain reports every five minutes, no more, no less. Since it is battery operated I need the node to sleep if there is no bucket tip. But if the bucket tips, and generates an interrupt, then the node will sleep for another five minutes. And I don't want the node to report rain as soon as the bucket tips either. I started messing around with an RTC but that got much too complicated and I don't need real-time. The controller OpenHAB handles that together with Influxdb and Grafana.

  • Mod

    well... it is better to have the node reporting something at least every hour or so, otherwise the controller will most likely consider it offline. About reporting every bucket tip, unless you are living in a very rainy area, I don't think it will drain much battery anyway (there are nodes sending temperature and humidity every 10 minutes and battery lasts 1 or 2 years). I'd suggest to start simple and add more complicated things afterwards. Btw, in case you need it, the sleep function should return a value about what interrupted it.

  • My selfmade rain gauge uses the following algorithm:

    It collects amount of rain per day and stores it in eeprom ( with other values) every hour.
    If it is not raining, every hour it reports battery voltage and amount of rain per day (mm/day).
    If it is raining, it collects bucket tips and reports rain rate (l/h) every 5 minutes. It doesn't matter that the one hour sleep timer is resetted in this case and amount of rain and battery voltage is sent too.
    If it stops raining the bucket tip collector is reset to zero after a configurable amount of time, e.g. 1 minute.

    Using Arduino pro mini with 2 AA Batteries. Still have 2.9V after 9 month of operation.

  • Mod

    @heizelmann how do you keep track of time in your case?

  • @gohan As far as I can remember I used requestTime() on every wakeup which gets time from gateway. Basic implementation based on https://www.mysensors.org/build/rain.

  • @heizelmann Hi. Sorry if I wake an old thread.
    Do you still have your code?
    I am about to build a rain gauge and want it to run on battery.
    Your way to handle things is what I am looking for.
    Would you like to share your code?

Log in to reply

Suggested Topics