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. Controllers
  3. Domoticz
  4. Domotiocz + Rain gauge

Domotiocz + Rain gauge

Scheduled Pinned Locked Moved Domoticz
61 Posts 12 Posters 31.2k Views 12 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.
  • sinczeS Offline
    sinczeS Offline
    sincze
    MySensors Evangelist
    wrote on last edited by
    #8

    @sundberg84 , very nice. I would say.. I want that as well ;-)
    any suggestions for a shopping and modification list?
    As I don't have a 3D printer to print the thing myself.

    sundberg84S TheoLT 2 Replies Last reply
    0
    • sinczeS sincze

      @sundberg84 , very nice. I would say.. I want that as well ;-)
      any suggestions for a shopping and modification list?
      As I don't have a 3D printer to print the thing myself.

      sundberg84S Offline
      sundberg84S Offline
      sundberg84
      Hardware Contributor
      wrote on last edited by
      #9

      @sincze - its not a 3d printed box, its an old 433mhz tip sensor.
      There is something similar on mysensors shop :http://www.ebay.com/itm/misol-Spare-part-for-weather-station-to-measure-the-rain-volume-for-rain-meter-/271862662076?hash=item3f4c4703bc:g:IGsAAOSwq7JT8vJY&rmvSB=true

      Controller: Proxmox VM - Home Assistant
      MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
      MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
      RFLink GW - Arduino Mega + RFLink Shield, 433mhz

      TheoLT 1 Reply Last reply
      1
      • sundberg84S sundberg84

        @sincze - its not a 3d printed box, its an old 433mhz tip sensor.
        There is something similar on mysensors shop :http://www.ebay.com/itm/misol-Spare-part-for-weather-station-to-measure-the-rain-volume-for-rain-meter-/271862662076?hash=item3f4c4703bc:g:IGsAAOSwq7JT8vJY&rmvSB=true

        TheoLT Offline
        TheoLT Offline
        TheoL
        Contest Winner
        wrote on last edited by
        #10

        @sundberg84 Just playing with your sketch, because it's easier for my to understand than the one one the build page. I'm curious about how domoticz handles these values. I don't see you reset the hwRainVolume variable. So does this mean that this is an ever increasing value that must be send to Domoticz?

        sundberg84S 1 Reply Last reply
        0
        • TheoLT TheoL

          @sundberg84 Just playing with your sketch, because it's easier for my to understand than the one one the build page. I'm curious about how domoticz handles these values. I don't see you reset the hwRainVolume variable. So does this mean that this is an ever increasing value that must be send to Domoticz?

          sundberg84S Offline
          sundberg84S Offline
          sundberg84
          Hardware Contributor
          wrote on last edited by
          #11

          @TheoL - Correct.
          There is a countervalue and Domoticz calculates the value from midnight each night.

          Controller: Proxmox VM - Home Assistant
          MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
          MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
          RFLink GW - Arduino Mega + RFLink Shield, 433mhz

          TheoLT 1 Reply Last reply
          0
          • sundberg84S sundberg84

            @TheoL - Correct.
            There is a countervalue and Domoticz calculates the value from midnight each night.

            TheoLT Offline
            TheoLT Offline
            TheoL
            Contest Winner
            wrote on last edited by
            #12

            @sundberg84 Thanx for your fast reply. So what happens when the float resets to 0?

            sundberg84S 1 Reply Last reply
            0
            • sinczeS sincze

              @sundberg84 , very nice. I would say.. I want that as well ;-)
              any suggestions for a shopping and modification list?
              As I don't have a 3D printer to print the thing myself.

              TheoLT Offline
              TheoLT Offline
              TheoL
              Contest Winner
              wrote on last edited by
              #13

              @sincze Hello my friend, just curious how many sensors you've got hooked up at the moment?

              1 Reply Last reply
              0
              • TheoLT TheoL

                @sundberg84 Thanx for your fast reply. So what happens when the float resets to 0?

                sundberg84S Offline
                sundberg84S Offline
                sundberg84
                Hardware Contributor
                wrote on last edited by
                #14

                @TheoL - Just to add what we discussed in chat for future questions - If float would hit the maximum value (which is hugh so lets hope its not a problem) im not sure what will happen...

                Controller: Proxmox VM - Home Assistant
                MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
                MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
                RFLink GW - Arduino Mega + RFLink Shield, 433mhz

                TheoLT 1 Reply Last reply
                0
                • sundberg84S sundberg84

                  @TheoL - Just to add what we discussed in chat for future questions - If float would hit the maximum value (which is hugh so lets hope its not a problem) im not sure what will happen...

                  TheoLT Offline
                  TheoLT Offline
                  TheoL
                  Contest Winner
                  wrote on last edited by
                  #15

                  @sundberg84 It's also not a concern of the MySensors node. This should be handled by Domoticz. I really like your sketch, it works like a charm. I modified it to my needs so that I can run the node without the sleep. Still need to think of an hourly heart beat. But almost there.

                  sundberg84S 1 Reply Last reply
                  0
                  • TheoLT TheoL

                    @sundberg84 It's also not a concern of the MySensors node. This should be handled by Domoticz. I really like your sketch, it works like a charm. I modified it to my needs so that I can run the node without the sleep. Still need to think of an hourly heart beat. But almost there.

                    sundberg84S Offline
                    sundberg84S Offline
                    sundberg84
                    Hardware Contributor
                    wrote on last edited by
                    #16

                    @TheoL - If you modify the sketch with a heartbeat() please post it :) Im interested as well!

                    Controller: Proxmox VM - Home Assistant
                    MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
                    MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
                    RFLink GW - Arduino Mega + RFLink Shield, 433mhz

                    TheoLT 1 Reply Last reply
                    0
                    • TheoLT Offline
                      TheoLT Offline
                      TheoL
                      Contest Winner
                      wrote on last edited by
                      #17

                      @AWI do you happen to know if the pulse counter in Domoticz is a 1mm pulse counter? Or is it a real tip pulse counter? Right know where checking whenever the rain fall exceeds 1mm and send a pulse ++ in that case. Meaning we miss some pulse counts when we reset the node.

                      AWIA 1 Reply Last reply
                      0
                      • TheoLT TheoL

                        @AWI do you happen to know if the pulse counter in Domoticz is a 1mm pulse counter? Or is it a real tip pulse counter? Right know where checking whenever the rain fall exceeds 1mm and send a pulse ++ in that case. Meaning we miss some pulse counts when we reset the node.

                        AWIA Offline
                        AWIA Offline
                        AWI
                        Hero Member
                        wrote on last edited by
                        #18

                        @TheoL My rain meter counts in 1 mm resolution but I am sending actual total (in mm) from the start of sensor and keep totals in EEPROM.

                        TheoLT 1 Reply Last reply
                        0
                        • AWIA AWI

                          @TheoL My rain meter counts in 1 mm resolution but I am sending actual total (in mm) from the start of sensor and keep totals in EEPROM.

                          TheoLT Offline
                          TheoLT Offline
                          TheoL
                          Contest Winner
                          wrote on last edited by
                          #19

                          @AWI (Glad that your back, hope you're doing allright) So, if I understand your setup correctly you don't send the pulse count to Domoticz? I kind of like it, because that way I can reset the rain sensor many times and still keep the rain fall log in sync, without using the EPROM.

                          And my rain sensor did reset a couple of times. I had to put a diode (Dutch name is blus diode) between the two wires coming out from the rain gauge to prevent this.

                          AWIA 1 Reply Last reply
                          0
                          • TheoLT TheoL

                            @AWI (Glad that your back, hope you're doing allright) So, if I understand your setup correctly you don't send the pulse count to Domoticz? I kind of like it, because that way I can reset the rain sensor many times and still keep the rain fall log in sync, without using the EPROM.

                            And my rain sensor did reset a couple of times. I had to put a diode (Dutch name is blus diode) between the two wires coming out from the rain gauge to prevent this.

                            AWIA Offline
                            AWIA Offline
                            AWI
                            Hero Member
                            wrote on last edited by
                            #20

                            @TheoL (i'm fine, thank you) That is what i'm doing. The only thing what I need to do after a reset is delete the miscalculation in Domoticz (easy). My sensor (oregon) uses a 'reed' switch (no induction). I MySensoriz'ed it without losing the original circuitry and function. (so in parallel).

                            0_1475422212074_upload-82d166bf-a999-4d76-b3e3-8c010fa5f427

                            TheoLT 1 Reply Last reply
                            0
                            • AWIA AWI

                              @TheoL (i'm fine, thank you) That is what i'm doing. The only thing what I need to do after a reset is delete the miscalculation in Domoticz (easy). My sensor (oregon) uses a 'reed' switch (no induction). I MySensoriz'ed it without losing the original circuitry and function. (so in parallel).

                              0_1475422212074_upload-82d166bf-a999-4d76-b3e3-8c010fa5f427

                              TheoLT Offline
                              TheoLT Offline
                              TheoL
                              Contest Winner
                              wrote on last edited by TheoL
                              #21

                              @AWI A lesson learned a couple of month ago. When using an induction reed switch (some of them have a coil around the glass) always add a reversed diode. Otherwise the polarity of the reed switch is being turned for just a millisecond which is enough to cause the arduino to reset ;-). I'm still learning a lot about electronics.

                              At the moment the diode seems to work. No Arduino resetting for the last couple of hours.

                              Regarding to the pulse counter is seems to work perfectly. That way I don't need to store any values on the EPROM, which is something I prefer not to do. I just query the current pulse count from Domoticz when the sensors boots. Sending the total amount of rain is as easy as pulse count * bucket size. Not real rocket science.

                              1 Reply Last reply
                              0
                              • sundberg84S sundberg84

                                @TheoL - If you modify the sketch with a heartbeat() please post it :) Im interested as well!

                                TheoLT Offline
                                TheoLT Offline
                                TheoL
                                Contest Winner
                                wrote on last edited by TheoL
                                #22

                                @sundberg84 Here's the first version of the sketch. Note that I don't use the sleep. My main goal for creating my own outside weather station is to get rid of the batteries. Because they always same to stop working whenever I'm not at home.

                                /*
                                 Arduino Tipping Bucket Rain Gauge, SI7021 Temperature + Humidity sensor
                                
                                 Created October 2nd 2016
                                 Author by Theo
                                
                                 This node uses a tipping bucket rain gauge for measuring rain fall. And a si7021 Temperature and Humidity sensor. The logic in
                                 this sketch might be specific for Domoticz, because of the Pulse counter.
                                
                                 Based upon sketches created by @BulldogLowell / @PeteWill, @sundber84
                                 for free public use
                                
                                 Hardware used:
                                 Arduino Pro Mini 3.3V
                                 buck converter
                                 nrf24L01+ radio
                                 100 uf capacitor
                                 2 10K resistors (for i2c)
                                 1N007 diode
                                 MI-SOL Rain Guage 
                                 SI7021 sensor
                                
                                 Version history:
                                 02-10-2016 Initial version
                                */
                                
                                /**
                                   Configure MySensors
                                */
                                // Enable debug prints
                                // #define MY_DEBUG
                                
                                // Enable and select radio type attached
                                #define MY_RADIO_NRF24
                                
                                /*
                                  Include libraries used by the sketch
                                */
                                #include "ThresholdUtil.h"
                                #include <math.h>
                                #include <Time.h>
                                #include <SI7021.h>
                                #include <MySensors.h>
                                
                                /**
                                   Define constants used by sketch
                                */
                                #define BUCKET_PIN 3                  // The Arduino pin to which the bucket is attached. We need an interrupt pin (2 or 3 on the Uno and the Pro Mini) 
                                #define SKETCH_INFO "Outside weather" // The name of the sketch as presented to the gateway
                                #define SKETCH_VERSION "1.0"          // The version of the sketch as presented to the gateway
                                #define CHILD_ID_HUM  2               // The child id of the humidity sensor
                                #define CHILD_ID_TEMP 1               // The child id of the temperature sensor
                                #define CHILD_ID_RAIN_LOG 4           // The child id of the rain gauge
                                #define MS_WAIT 100                   // short delay used to give the NRF24L01+ antenna some time to recover from the last data sending
                                #define bucketSize 0.3                // I've used a MI-SOL Rain Guage which has a bucket size of 0.3 mm
                                
                                /**
                                   Declare MySensors messages used by the node
                                */
                                MyMessage msgHum( CHILD_ID_HUM, V_HUM );
                                MyMessage msgTemp( CHILD_ID_TEMP, V_TEMP );
                                MyMessage msgRain( CHILD_ID_RAIN_LOG, V_RAIN );
                                MyMessage lastCounterMsg( CHILD_ID_RAIN_LOG, V_VAR1 );
                                
                                /**
                                   Declare variables used by the Sketch
                                */
                                SI7021 humiditySensor; // Declare a SI7021 Temp humidity sensor object
                                float hwRainVolume = 0;           // Current rainvolume calculated in hardware.
                                unsigned long hwPulseCounter = 0; // Pulsecount recieved from GW
                                boolean pcReceived = false;       // If we have recieved the pulscount from GW or not
                                unsigned long lastTipTime = millis(); // TS of when the bucket tip has been detected for the last time
                                volatile unsigned long wasTippedCounter; // Queue for storing the tipped counter as been set by the interrupt handler.
                                byte lastHour;                    // Stores the hour used for checking if time needs to be synchronized
                                
                                /**
                                  Present all child's to the gateway and query for the pulse count known by the HA controller.
                                */
                                void presentation() {
                                  // Send the sketch version information to the gateway
                                  sendSketchInfo( SKETCH_INFO, SKETCH_VERSION );
                                
                                  wait( MS_WAIT );
                                  // Register all sensors to gw (they will be created as child devices)
                                  present( CHILD_ID_HUM, S_HUM, "Outside temperature" );
                                  wait( MS_WAIT );
                                  present( CHILD_ID_TEMP, S_TEMP, "Outside humidity" );
                                  wait( MS_WAIT );
                                  present( CHILD_ID_RAIN_LOG, S_RAIN, "Rain fall" );
                                  wait( MS_WAIT );
                                
                                  unsigned long functionTimeout = millis();
                                  while ( pcReceived == false && millis() - functionTimeout < 30000UL ) {
                                    request( CHILD_ID_RAIN_LOG, V_VAR1);
                                    Serial.println(F("Getting pulse count"));
                                    Serial.println(F("."));
                                    wait( 1000 );
                                  }
                                  attachInterrupt( digitalPinToInterrupt( BUCKET_PIN ), sensorTipped, LOW ); //FALLING );  // depending on location of the hall effect sensor may need CHANGE
                                }
                                
                                /**
                                   Setup of the sketch. It initializes all sensors and queries the gateway for the current time.
                                */
                                void setup() {
                                  Serial.begin( 115200 );
                                  pinMode( BUCKET_PIN, INPUT_PULLUP );
                                
                                  humiditySensor.begin();
                                
                                  registerThresholdedSensor( CHILD_ID_TEMP, 1, TEMPERATURE_SENSOR, 0.5, 30, 20 );
                                  registerThresholdedSensor( CHILD_ID_HUM, 2, HUMIDTY_SENSOR, 2.0, 30, 20 );
                                
                                  unsigned long functionTimeout = millis();
                                  while ( timeStatus() == timeNotSet && millis() - functionTimeout < 30000UL ) {
                                    requestTime();
                                    Serial.println(F("Getting Time"));
                                    Serial.println(F("."));
                                    wait( 1000 );
                                  }
                                
                                  lastHour = hour();
                                }
                                
                                /**
                                  Sends the value of the rain gauge to the Gateway.
                                */
                                void sendRainVolumeData() {
                                  float hwRainVolume = hwPulseCounter * bucketSize;
                                  Serial.print( "Tipped " );
                                  Serial.print( hwPulseCounter );
                                  Serial.println( " times." );
                                  Serial.print( "Rain fall is " );
                                  Serial.print( hwRainVolume, 1 );
                                  Serial.println( " mm." );
                                  send( msgRain.set( (float)hwRainVolume, 1 ) );
                                  wait( MS_WAIT );
                                  send( lastCounterMsg.set( hwPulseCounter ) );
                                  wait( MS_WAIT );
                                }
                                
                                /**
                                  Main loop of the node. It checks:
                                  - whether the rain gauge bucket has been tipped.
                                  - whether the hourly heartbeat needs to be send.
                                  - checks all thresholded sensors
                                */
                                void loop() {
                                  if ( wasTippedCounter != hwPulseCounter ) {
                                    hwPulseCounter = wasTippedCounter;
                                    sendRainVolumeData();
                                  }
                                
                                  byte currentHour = hour();
                                  if (currentHour != lastHour) {
                                    Serial.println( "Resyncing hour" );
                                    requestTime(); // sync the time every hour
                                    wait( MS_WAIT );
                                    lastHour = currentHour;
                                    sendRainVolumeData(); // Send heart beat
                                  }
                                
                                  checkThresholdedSensors( readTHSensor, updatedTHSensorValue );
                                }
                                
                                /**
                                  Interrupt handler for handling bucket tips.
                                */
                                void sensorTipped() {
                                  unsigned long thisTipTime = millis();
                                  if (thisTipTime - lastTipTime > 100UL) {
                                    wasTippedCounter++;
                                  }
                                  lastTipTime = thisTipTime;
                                }
                                
                                /**
                                  Threshold util wants to know the current value of a specific sensor.
                                */
                                void readTHSensor( uint8_t aSensorId, ThreshHoldedSensorType aType, float *value ) {
                                  si7021_env data = humiditySensor.getHumidityAndTemperature();
                                  switch ( aSensorId ) {
                                    case CHILD_ID_TEMP:
                                      *value = data.celsiusHundredths / 100.0;
                                      break;
                                    case CHILD_ID_HUM:
                                      *value = data.humidityPercent;
                                      break;
                                  }
                                }
                                
                                /**
                                  Threshhold util detects that the value of a specific sensor needs to be send to the gateway.
                                */
                                void updatedTHSensorValue( uint8_t child_id, uint8_t sensor_id, ThreshHoldedSensorType sensor_type, float value ) {
                                  switch ( child_id ) {
                                    case CHILD_ID_TEMP:
                                      Serial.print( "Sending temp " );
                                      Serial.println( value, 1 );
                                      send( msgTemp.set( value, 1 ) );
                                      wait( MS_WAIT );
                                      break;
                                    case CHILD_ID_HUM:
                                      Serial.print( "Sending Humidity " );
                                      Serial.println( value, 1 );
                                      send( msgHum.set( value, 1 ) );
                                      wait( MS_WAIT );
                                      break;
                                  }
                                }
                                
                                /**
                                  Call back handler for handling time send by the gateway.
                                */
                                void receiveTime(unsigned long time) {
                                  Serial.println( F("Time received..."));
                                  setTime(time);
                                  char theTime[6];
                                  sprintf(theTime, "%d:%2d", hour(), minute());
                                  Serial.println(theTime);
                                }
                                
                                /**
                                  Callback handler for handling incomming MySensors message.
                                */
                                void receive(const MyMessage &message) {
                                  if ( message.sensor == CHILD_ID_RAIN_LOG && message.type == V_VAR1) { // We only expect pulse count values from the gateway
                                    hwPulseCounter = message.getULong();
                                    wasTippedCounter = hwPulseCounter;
                                    pcReceived = true;
                                
                                    Serial.print("Received last pulse count from gw: ");
                                    Serial.println(hwPulseCounter);
                                  }
                                }
                                

                                ps. Because the old MySensors API's where removed from the main page, I had to move over to MySensors 2.0. I just uploaded the MySensors 2.0 to my serial gateway and everything seems to work fine. With this I mean all MySensors 1.5 node's are still doing their work. Love it!

                                EDITED: Added rain rate. But still testing.

                                1 Reply Last reply
                                0
                                • TheoLT Offline
                                  TheoLT Offline
                                  TheoL
                                  Contest Winner
                                  wrote on last edited by
                                  #23

                                  @AWI last question for today. Do you send the rain rate to domoticz as well? Still figuring out how to do this.

                                  sundberg84S F 2 Replies Last reply
                                  0
                                  • TheoLT TheoL

                                    @AWI last question for today. Do you send the rain rate to domoticz as well? Still figuring out how to do this.

                                    sundberg84S Offline
                                    sundberg84S Offline
                                    sundberg84
                                    Hardware Contributor
                                    wrote on last edited by
                                    #24

                                    @TheoL - No I dont, and if i remember right its because i sleep the node I cant do the calculations.

                                    Controller: Proxmox VM - Home Assistant
                                    MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
                                    MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
                                    RFLink GW - Arduino Mega + RFLink Shield, 433mhz

                                    TheoLT 1 Reply Last reply
                                    0
                                    • sundberg84S sundberg84

                                      @TheoL - No I dont, and if i remember right its because i sleep the node I cant do the calculations.

                                      TheoLT Offline
                                      TheoLT Offline
                                      TheoL
                                      Contest Winner
                                      wrote on last edited by
                                      #25

                                      @sundberg84 I've added it. But so far Domoticz doesn't return a value whenever I query a JSON for the sensor. Maybe it does when the clock switches to the next hour.

                                      1 Reply Last reply
                                      0
                                      • TheoLT TheoL

                                        @AWI last question for today. Do you send the rain rate to domoticz as well? Still figuring out how to do this.

                                        F Offline
                                        F Offline
                                        flopp
                                        wrote on last edited by
                                        #26

                                        @TheoL said:

                                        @AWI last question for today. Do you send the rain rate to domoticz as well? Still figuring out how to do this.

                                        Domoticz have some sort of rain rate, not like mm/12h, mm/6h but it will give mm/h depending how you send data to Domoticz it will be more or less correct.
                                        0_1475427368240_IMG_2992.PNG

                                        TheoLT 1 Reply Last reply
                                        0
                                        • F flopp

                                          @TheoL said:

                                          @AWI last question for today. Do you send the rain rate to domoticz as well? Still figuring out how to do this.

                                          Domoticz have some sort of rain rate, not like mm/12h, mm/6h but it will give mm/h depending how you send data to Domoticz it will be more or less correct.
                                          0_1475427368240_IMG_2992.PNG

                                          TheoLT Offline
                                          TheoLT Offline
                                          TheoL
                                          Contest Winner
                                          wrote on last edited by
                                          #27

                                          @flopp Thank you. What do you mean by sending data correctly? Do you have an example sketch?

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


                                          20

                                          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