Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. Rain sensor

Rain sensor

Scheduled Pinned Locked Moved My Project
rainsensor
12 Posts 6 Posters 5.1k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • sundberg84S sundberg84

    @mbj - Great work and thanks for sharing!
    What is the IC beside the atmega? Ftdi?

    M Offline
    M Offline
    mbj
    wrote on last edited by mbj
    #3

    @sundberg84 Thanks. The item is an inverted Schmitt trigger used to get a clean signal. What came from the reed relay was awfully bouncy so readings were not consistent.

    1 Reply Last reply
    0
    • Mark SwiftM Offline
      Mark SwiftM Offline
      Mark Swift
      wrote on last edited by
      #4

      Is there a chance you can post the code? I'd be interested to see the time to midnight function.

      M 1 Reply Last reply
      0
      • CarywinC Offline
        CarywinC Offline
        Carywin
        wrote on last edited by
        #5

        Interesting design, but I'm wondering why you don't just send a message every time the bucket tips, and then do all the tallying and midnight rollover stuff on the controller?

        M 1 Reply Last reply
        0
        • CarywinC Carywin

          Interesting design, but I'm wondering why you don't just send a message every time the bucket tips, and then do all the tallying and midnight rollover stuff on the controller?

          M Offline
          M Offline
          mbj
          wrote on last edited by
          #6

          @Carywin
          That is an alternative way of doing it, and also much simpler to code and also good enough for a rain sensor. It seems I always tend to complicate things :-) so I have tried to design this type of functionality (with counters and alike) to be inside the sensors because if the controller (here OpenHab) is down for any reason the sensor lives its own life and once everything is up again the sensor can report a correct value. I have the same type of functionality for the energy meter sensor which is based on the MySensors Energy Meter.

          If the sensor has been down it can receive last known value from OpenHab with an incoming message but any readings while down are of course lost. Also a manual set value can be received.

          Does it make any sense?

          CarywinC 1 Reply Last reply
          0
          • Mark SwiftM Mark Swift

            Is there a chance you can post the code? I'd be interested to see the time to midnight function.

            M Offline
            M Offline
            mbj
            wrote on last edited by
            #7

            @Mark-Swift
            I have not looked at the code for nearly a year so have no idea if it is usable or not for anybody else. Right now I have no time to take a look at it but will dig it out as soon as I get a chance, hopefully within the coming week.

            1 Reply Last reply
            0
            • M mbj

              @Carywin
              That is an alternative way of doing it, and also much simpler to code and also good enough for a rain sensor. It seems I always tend to complicate things :-) so I have tried to design this type of functionality (with counters and alike) to be inside the sensors because if the controller (here OpenHab) is down for any reason the sensor lives its own life and once everything is up again the sensor can report a correct value. I have the same type of functionality for the energy meter sensor which is based on the MySensors Energy Meter.

              If the sensor has been down it can receive last known value from OpenHab with an incoming message but any readings while down are of course lost. Also a manual set value can be received.

              Does it make any sense?

              CarywinC Offline
              CarywinC Offline
              Carywin
              wrote on last edited by
              #8

              @mbj Yes I see what you're trying to achieve.
              I would keep a 16 or 32 bit counter in the rain sensor, and increment it on each bucket tip and send the new value when it changes. Then in the controller take care of tallys and midnight resets, but with some extra logic to handle when the counter value rolls over (that will take a very long time :D) or the sensor restarts. This would also mean you don't miss any pulses when the controller is down because the sensor is still counting, but a sensor restart won't reset your daily tally.
              Another idea would be to have a reset command sent by the controller around midnight. There would need to be some logic where the controller waited until the sensor was awake again before sending it commands, but that seems simple enough.
              Or just put a RTC on there XD

              Having said all that I will look forward to reading your code and seeing the timing solution!

              1 Reply Last reply
              0
              • jumpingJ Offline
                jumpingJ Offline
                jumping
                wrote on last edited by
                #9

                @mbj I'm also interested about your code, thanks

                Raspberrry PI3 - Domoticz
                ESP8266 GW - MySensors 2.1.1

                M 1 Reply Last reply
                0
                • jumpingJ jumping

                  @mbj I'm also interested about your code, thanks

                  M Offline
                  M Offline
                  mbj
                  wrote on last edited by
                  #10

                  @jumping Unfortunately I had no time to look at anything last week and i will not be able to do it the next cople of weeks because of travelling but I promise it will come. I assume that you also have seen the code for a rain sensor at the Mysensors forum but if not take a look there in the meantime. I know this is a different solution but might be of interest anyhow.

                  jumpingJ 1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    Heizelmann
                    wrote on last edited by
                    #11

                    https://forum.mysensors.org/topic/4821/rain-gauge

                    1 Reply Last reply
                    0
                    • M mbj

                      @jumping Unfortunately I had no time to look at anything last week and i will not be able to do it the next cople of weeks because of travelling but I promise it will come. I assume that you also have seen the code for a rain sensor at the Mysensors forum but if not take a look there in the meantime. I know this is a different solution but might be of interest anyhow.

                      jumpingJ Offline
                      jumpingJ Offline
                      jumping
                      wrote on last edited by
                      #12

                      @mbj said in Rain sensor:

                      @jumping Unfortunately I had no time to look at anything last week and i will not be able to do it the next cople of weeks because of travelling but I promise it will come. I assume that you also have seen the code for a rain sensor at the Mysensors forum but if not take a look there in the meantime. I know this is a different solution but might be of interest anyhow.

                      No problem :-) thanks

                      Raspberrry PI3 - Domoticz
                      ESP8266 GW - MySensors 2.1.1

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      19

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular