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.
  • 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
      • TheoLT TheoL

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

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

        @TheoL said:

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

        Not correctly, I wrote depending.

        If you send data every 2 hours and ot every time the buck has tiped the rate will not be correct. Lets say you send/report every 2 hour, you report 10 mm, that means you have "collect" 10 mm for 2 hours. Maybe the hour was not raining, then the rate will show you 10mm/h, sorry if I confusing you.

        What I mean is that you should send/report directly when the buck has tiped then the rate in DZ will be correct rate/h.

        my sketch

        #include <SPI.h>
        #include <MySensor.h> 
        
        // Running this in Domoticz stable version 2.5 will not work - upgrade to beta.
        
        #define DIGITAL_INPUT_SENSOR 3 // The reed switch you attached. (Only 2 and 3 generates interrupt!)
        #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
        
        #define CHILD_ID 1 // Id of the sensor child
        #define BATT_CHILD 2
        #define NODE_ID AUTO // or AUTO to let controller assign
        #define SKETCH_NAME "Rain Gauge" // Change to a fancy name you like
        #define SKETCH_VERSION "1.8" // Your version
        
        unsigned long SLEEP_TIME = 180*60000; // Sleep time (in milliseconds).
        //unsigned long SLEEP_TIME = 20000; // use this instead for debug
        
        float hwRainVolume = 0; // Current rainvolume calculated in hardware.
        int hwPulseCounter = 0; // Pulsecount recieved from GW
        float fullCounter = 0; // Counts when to send counter
        float bucketSize = 0.5; // Bucketsize mm, needs to be 1, 0.5, 0.25, 0.2 or 0.1
        boolean pcReceived = false; // If we have recieved the pulscount from GW or not 
        boolean reedState; // Current state the reedswitch is in
        boolean oldReedState; // Old state (last state) of the reedswitch
        unsigned long lastSend =0; // Time we last tried to fetch counter.
        
        MySensor gw;
        MyMessage volumeMsg(CHILD_ID,V_RAIN);
        MyMessage lastCounterMsg(CHILD_ID,V_VAR1);
        MyMessage battMsg(BATT_CHILD, V_VOLTAGE);
        
        //=========================
        // BATTERY VOLTAGE DIVIDER SETUP
        // 1M, 470K divider across battery and using internal ADC ref of 1.1V
        // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
        // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
        // 3.44/1023 = Volts per bit = 0.003363075
        /*
        #define VBAT_PER_BITS 0.003363075 
        #define VMIN 1.9 // Vmin (radio Min Volt)=1.9V (564v)
        #define VMAX 3.0 // Vmax = (2xAA bat)=3.0V (892v)
        int batteryPcnt = 0; // Calc value for battery %
        int batLoop = 0; // Loop to help calc average
        int batArray[3]; // Array to store value for average calc.
        int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point
        //=========================
        */
        
        long result;
        float batteryPcnt;
        float batteryVolt;
        
        void setup() 
        { 
        pinMode(6,OUTPUT);
        digitalWrite(6,HIGH);
        // use the 1.1 V internal reference
        //analogReference(INTERNAL); // For battery sensing
        
        pinMode(DIGITAL_INPUT_SENSOR, INPUT_PULLUP); // sets the reed sensor digital pin as input
        
        reedState = digitalRead(DIGITAL_INPUT_SENSOR); // Read what state the reedswitch is in
        oldReedState = reedState; // Set startup position for reedswitch
        
        delay(500); // Allow time for radio if power used as reset
        
        //Begin (Change if you dont want static node_id! (NODE_ID to AUTO)
        gw.begin(incomingMessage, NODE_ID, false);
        
        // Send the Sketch Version Information to the Gateway
        gw.sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
        
        // Register this device as Rain sensor (will not show in Domoticz until first value arrives)
        gw.present(CHILD_ID, S_RAIN); 
        gw.present(BATT_CHILD, S_MULTIMETER);
        
        Serial.println("Startup completed");
        }
        
        void loop() 
        { 
        
        digitalWrite(6,HIGH);
        delay(100);
        
        gw.process();
        //gw.begin(incomingMessage, NODE_ID, false);
        unsigned long currentTime = millis();
        
        //See if we have the counter/pulse from Domoticz - and ask for it if we dont.
        if (!pcReceived && (currentTime - lastSend > 5000)) { 
        gw.begin(incomingMessage, NODE_ID, false);
        gw.request(CHILD_ID, V_VAR1);
        Serial.println("Request pulsecount");
        lastSend=currentTime;
        gw.process();
        return;
        }
        if (!pcReceived) {
        return;
        }
        
        //Read if the bucket tipped over
        reedState = digitalRead(DIGITAL_INPUT_SENSOR);
        boolean tipped = oldReedState != reedState; 
        
        //BUCKET TIPS!
        if (tipped==true) {
        gw.begin(incomingMessage, NODE_ID, false);
        Serial.println("The bucket has tipped over...");
        oldReedState = reedState;
        hwRainVolume = hwRainVolume + bucketSize;
        gw.send(volumeMsg.set((float)hwRainVolume,1));
        gw.wait(1000);
        fullCounter = fullCounter + bucketSize;
        
        //Count so we send the counter for every 1mm
        if(fullCounter >= 1){
        hwPulseCounter++;
        gw.send(lastCounterMsg.set(hwPulseCounter));
        gw.wait(1000);
        fullCounter = 0;
        }
        readVcc(); 
        }
        
        if (tipped==false) {
        
        //No bucket tipped over last sleep-period, check battery then...
        readVcc(); 
        }
        
        lastSend=currentTime;
        Serial.println("sleep");
        digitalWrite(6,LOW);
        delay(1000);
        gw.sleep(INTERRUPT, CHANGE, SLEEP_TIME); 
        //The interupt can be CHANGE or FALLING depending on how you wired the hardware.
        }
        
        //Read if we have a incoming message.
        void incomingMessage(const MyMessage &message) {
        if (message.type==V_VAR1) {
        hwPulseCounter = message.getULong();
        hwRainVolume = hwPulseCounter;
        pcReceived = true;
        Serial.print("Received last pulse count from gw: ");
        Serial.println(hwPulseCounter); 
        }
        }
        /*
        void batM() //The battery calculations
        {
        delay(500);
        // Battery monitoring reading
        int sensorValue = analogRead(BATTERY_SENSE_PIN); 
        delay(500);
        
        // Calculate the battery in %
        float Vbat = sensorValue * VBAT_PER_BITS;
        int batteryPcnt = static_cast<int>(((Vbat-VMIN)/(VMAX-VMIN))*100.);
        Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %"); 
        
        // Add it to array so we get an average of 3 (3x20min)
        batArray[batLoop] = batteryPcnt;
        
        if (batLoop > 1) { 
        batteryPcnt = (batArray[0] + batArray[1] + batArray[2]);
        batteryPcnt = batteryPcnt / 3;
        
        if (batteryPcnt > 100) {
        batteryPcnt=100;
        }
        
        Serial.print("Battery Average (Send): "); Serial.print(batteryPcnt); Serial.println(" %");
        gw.sendBatteryLevel(batteryPcnt);
        batLoop = 0;
        
        //Sends 1 per hour as a heartbeat.
        gw.send(volumeMsg.set((float)hwRainVolume,1));
        gw.send(lastCounterMsg.set(hwPulseCounter));
        }
        else 
        {
        batLoop++;
        }
        }
        */
        long readVcc() {
        Serial.println("readVcc");
        // Read 1.1V reference against AVcc
        ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
        delay(2); // Wait for Vref to settle
        ADCSRA |= _BV(ADSC); // Convert
        while (bit_is_set(ADCSRA,ADSC));
        result = ADCL;
        result |= ADCH<<8;
        result = 1126400L / result; // Back-calculate AVcc in mV
        //return result;
        gw.begin(incomingMessage, NODE_ID, false);
        batteryPcnt = (result - 3300) * 0.111111;
        batteryVolt = result/1000.000;
        gw.sendBatteryLevel(batteryPcnt);
        gw.send(battMsg.set(batteryVolt, 3));
        /*Serial.print("battery volt:");
        Serial.println(batteryVolt, 3);
        Serial.print("battery percent:");
        Serial.println(batteryPcnt);
        */
        }
        
        TheoLT 1 Reply Last reply
        1
        • F flopp

          @TheoL said:

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

          Not correctly, I wrote depending.

          If you send data every 2 hours and ot every time the buck has tiped the rate will not be correct. Lets say you send/report every 2 hour, you report 10 mm, that means you have "collect" 10 mm for 2 hours. Maybe the hour was not raining, then the rate will show you 10mm/h, sorry if I confusing you.

          What I mean is that you should send/report directly when the buck has tiped then the rate in DZ will be correct rate/h.

          my sketch

          #include <SPI.h>
          #include <MySensor.h> 
          
          // Running this in Domoticz stable version 2.5 will not work - upgrade to beta.
          
          #define DIGITAL_INPUT_SENSOR 3 // The reed switch you attached. (Only 2 and 3 generates interrupt!)
          #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
          
          #define CHILD_ID 1 // Id of the sensor child
          #define BATT_CHILD 2
          #define NODE_ID AUTO // or AUTO to let controller assign
          #define SKETCH_NAME "Rain Gauge" // Change to a fancy name you like
          #define SKETCH_VERSION "1.8" // Your version
          
          unsigned long SLEEP_TIME = 180*60000; // Sleep time (in milliseconds).
          //unsigned long SLEEP_TIME = 20000; // use this instead for debug
          
          float hwRainVolume = 0; // Current rainvolume calculated in hardware.
          int hwPulseCounter = 0; // Pulsecount recieved from GW
          float fullCounter = 0; // Counts when to send counter
          float bucketSize = 0.5; // Bucketsize mm, needs to be 1, 0.5, 0.25, 0.2 or 0.1
          boolean pcReceived = false; // If we have recieved the pulscount from GW or not 
          boolean reedState; // Current state the reedswitch is in
          boolean oldReedState; // Old state (last state) of the reedswitch
          unsigned long lastSend =0; // Time we last tried to fetch counter.
          
          MySensor gw;
          MyMessage volumeMsg(CHILD_ID,V_RAIN);
          MyMessage lastCounterMsg(CHILD_ID,V_VAR1);
          MyMessage battMsg(BATT_CHILD, V_VOLTAGE);
          
          //=========================
          // BATTERY VOLTAGE DIVIDER SETUP
          // 1M, 470K divider across battery and using internal ADC ref of 1.1V
          // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
          // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
          // 3.44/1023 = Volts per bit = 0.003363075
          /*
          #define VBAT_PER_BITS 0.003363075 
          #define VMIN 1.9 // Vmin (radio Min Volt)=1.9V (564v)
          #define VMAX 3.0 // Vmax = (2xAA bat)=3.0V (892v)
          int batteryPcnt = 0; // Calc value for battery %
          int batLoop = 0; // Loop to help calc average
          int batArray[3]; // Array to store value for average calc.
          int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point
          //=========================
          */
          
          long result;
          float batteryPcnt;
          float batteryVolt;
          
          void setup() 
          { 
          pinMode(6,OUTPUT);
          digitalWrite(6,HIGH);
          // use the 1.1 V internal reference
          //analogReference(INTERNAL); // For battery sensing
          
          pinMode(DIGITAL_INPUT_SENSOR, INPUT_PULLUP); // sets the reed sensor digital pin as input
          
          reedState = digitalRead(DIGITAL_INPUT_SENSOR); // Read what state the reedswitch is in
          oldReedState = reedState; // Set startup position for reedswitch
          
          delay(500); // Allow time for radio if power used as reset
          
          //Begin (Change if you dont want static node_id! (NODE_ID to AUTO)
          gw.begin(incomingMessage, NODE_ID, false);
          
          // Send the Sketch Version Information to the Gateway
          gw.sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
          
          // Register this device as Rain sensor (will not show in Domoticz until first value arrives)
          gw.present(CHILD_ID, S_RAIN); 
          gw.present(BATT_CHILD, S_MULTIMETER);
          
          Serial.println("Startup completed");
          }
          
          void loop() 
          { 
          
          digitalWrite(6,HIGH);
          delay(100);
          
          gw.process();
          //gw.begin(incomingMessage, NODE_ID, false);
          unsigned long currentTime = millis();
          
          //See if we have the counter/pulse from Domoticz - and ask for it if we dont.
          if (!pcReceived && (currentTime - lastSend > 5000)) { 
          gw.begin(incomingMessage, NODE_ID, false);
          gw.request(CHILD_ID, V_VAR1);
          Serial.println("Request pulsecount");
          lastSend=currentTime;
          gw.process();
          return;
          }
          if (!pcReceived) {
          return;
          }
          
          //Read if the bucket tipped over
          reedState = digitalRead(DIGITAL_INPUT_SENSOR);
          boolean tipped = oldReedState != reedState; 
          
          //BUCKET TIPS!
          if (tipped==true) {
          gw.begin(incomingMessage, NODE_ID, false);
          Serial.println("The bucket has tipped over...");
          oldReedState = reedState;
          hwRainVolume = hwRainVolume + bucketSize;
          gw.send(volumeMsg.set((float)hwRainVolume,1));
          gw.wait(1000);
          fullCounter = fullCounter + bucketSize;
          
          //Count so we send the counter for every 1mm
          if(fullCounter >= 1){
          hwPulseCounter++;
          gw.send(lastCounterMsg.set(hwPulseCounter));
          gw.wait(1000);
          fullCounter = 0;
          }
          readVcc(); 
          }
          
          if (tipped==false) {
          
          //No bucket tipped over last sleep-period, check battery then...
          readVcc(); 
          }
          
          lastSend=currentTime;
          Serial.println("sleep");
          digitalWrite(6,LOW);
          delay(1000);
          gw.sleep(INTERRUPT, CHANGE, SLEEP_TIME); 
          //The interupt can be CHANGE or FALLING depending on how you wired the hardware.
          }
          
          //Read if we have a incoming message.
          void incomingMessage(const MyMessage &message) {
          if (message.type==V_VAR1) {
          hwPulseCounter = message.getULong();
          hwRainVolume = hwPulseCounter;
          pcReceived = true;
          Serial.print("Received last pulse count from gw: ");
          Serial.println(hwPulseCounter); 
          }
          }
          /*
          void batM() //The battery calculations
          {
          delay(500);
          // Battery monitoring reading
          int sensorValue = analogRead(BATTERY_SENSE_PIN); 
          delay(500);
          
          // Calculate the battery in %
          float Vbat = sensorValue * VBAT_PER_BITS;
          int batteryPcnt = static_cast<int>(((Vbat-VMIN)/(VMAX-VMIN))*100.);
          Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %"); 
          
          // Add it to array so we get an average of 3 (3x20min)
          batArray[batLoop] = batteryPcnt;
          
          if (batLoop > 1) { 
          batteryPcnt = (batArray[0] + batArray[1] + batArray[2]);
          batteryPcnt = batteryPcnt / 3;
          
          if (batteryPcnt > 100) {
          batteryPcnt=100;
          }
          
          Serial.print("Battery Average (Send): "); Serial.print(batteryPcnt); Serial.println(" %");
          gw.sendBatteryLevel(batteryPcnt);
          batLoop = 0;
          
          //Sends 1 per hour as a heartbeat.
          gw.send(volumeMsg.set((float)hwRainVolume,1));
          gw.send(lastCounterMsg.set(hwPulseCounter));
          }
          else 
          {
          batLoop++;
          }
          }
          */
          long readVcc() {
          Serial.println("readVcc");
          // Read 1.1V reference against AVcc
          ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
          delay(2); // Wait for Vref to settle
          ADCSRA |= _BV(ADSC); // Convert
          while (bit_is_set(ADCSRA,ADSC));
          result = ADCL;
          result |= ADCH<<8;
          result = 1126400L / result; // Back-calculate AVcc in mV
          //return result;
          gw.begin(incomingMessage, NODE_ID, false);
          batteryPcnt = (result - 3300) * 0.111111;
          batteryVolt = result/1000.000;
          gw.sendBatteryLevel(batteryPcnt);
          gw.send(battMsg.set(batteryVolt, 3));
          /*Serial.print("battery volt:");
          Serial.println(batteryVolt, 3);
          Serial.print("battery percent:");
          Serial.println(batteryPcnt);
          */
          }
          
          TheoLT Offline
          TheoLT Offline
          TheoL
          Contest Winner
          wrote on last edited by
          #29

          @flopp Thank you for the explanation. I think I've got it.

          I've added a RAINRATE msg like this
          MyMessage rainRateMsg( CHILD_ID_RAIN_LOG, V_RAINRATE );

          But I don't think domoticz uses it.

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

            @sundberg84 Using a real pulse counter instead of a 1mm pulse counter seems to work perfectly. Luckily it makes the sketch a bunch easier to implement and read. And there will also be no loss of 0.2 or 0.5 mm rain fall whenever you reset the node while it didn't have a .0 value.

            BulldogLowellB 1 Reply Last reply
            2
            • TheoLT TheoL

              @flopp Thank you for the explanation. I think I've got it.

              I've added a RAINRATE msg like this
              MyMessage rainRateMsg( CHILD_ID_RAIN_LOG, V_RAINRATE );

              But I don't think domoticz uses it.

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

              @TheoL RAINRATE is implemented according to this page https://github.com/domoticz/domoticz/blob/master/hardware/MySensorsBase.cpp but I don't know how to use it. I know that DZ doesn't work with this example https://www.mysensors.org/build/rain

              1 Reply Last reply
              0
              • F Offline
                F Offline
                flopp
                wrote on last edited by flopp
                #32

                I have adjust my bucked to tip every ~0.25mm and calibrated it ofcourse

                AWIA 1 Reply Last reply
                0
                • F flopp

                  I have adjust my bucked to tip every ~0.25mm and calibrated it ofcourse

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

                  Domoticz just recently changed the method of rain rate calculation. It does not interpret rainrate values sent by sensors but calculates this by the total value coming in.

                  TheoLT 1 Reply Last reply
                  0
                  • AWIA AWI

                    Domoticz just recently changed the method of rain rate calculation. It does not interpret rainrate values sent by sensors but calculates this by the total value coming in.

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

                    @AWI Thank you again. I already had a gut feeling this would be the case. I'll strip out the rain rate code from the sketch.

                    1 Reply Last reply
                    0
                    • TheoLT TheoL

                      @sundberg84 Using a real pulse counter instead of a 1mm pulse counter seems to work perfectly. Luckily it makes the sketch a bunch easier to implement and read. And there will also be no loss of 0.2 or 0.5 mm rain fall whenever you reset the node while it didn't have a .0 value.

                      BulldogLowellB Offline
                      BulldogLowellB Offline
                      BulldogLowell
                      Contest Winner
                      wrote on last edited by
                      #35

                      @TheoL

                      Great to see this project continuing to grow legs!

                      1 Reply Last reply
                      0
                      • HilltanH Offline
                        HilltanH Offline
                        Hilltan
                        wrote on last edited by
                        #36
                        This post is deleted!
                        1 Reply Last reply
                        0
                        • sundberg84S sundberg84

                          This is great!
                          1 year - times fly by, but my rainsensor is going strong!

                          I just wanted to celebrate 1 year for my Rainsensor on batteries, reporting every hour (or less when it rains). Still going strong and 81% battery left! Except for some range issues in the beginning you can see its working as it should:

                          Also It will be my (almost) 1000th post so thank you all for making MySensors such a great community. I just love every minute here!

                          0_1474871808445_1.jpg

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

                          @sundberg84 said:

                          I just wanted to celebrate 1 year for my Rainsensor on batteries, reporting every hour (or less when it rains). Still going strong and 81% battery left! Except for some range issues in the beginning you can see its working as it should:

                          WOW, nice. Would it be possible to see your Battery graph, if you have one?
                          I am send data every 2h or often when it rains but my battery is draining much quicker than yours. Maybe I will get 1 year out of it, so I am happy anyway.
                          But I am interested in your graph if the voltage is going down quicker in the beginning.

                          1 Reply Last reply
                          0
                          • HilltanH Offline
                            HilltanH Offline
                            Hilltan
                            wrote on last edited by
                            #38

                            Maybe a stupid question, but it is possible to replace the SI7021 sensor with a DHT-22 sensor (the code has to be changed offsourse)? And get everything to work with ThresholdUtil? I have all parts, but not the SI7021 sensor to build the rain gauge.

                            TheoLT AWIA 2 Replies Last reply
                            0
                            • HilltanH Hilltan

                              Maybe a stupid question, but it is possible to replace the SI7021 sensor with a DHT-22 sensor (the code has to be changed offsourse)? And get everything to work with ThresholdUtil? I have all parts, but not the SI7021 sensor to build the rain gauge.

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

                              @Hilltan That should really be easy. I've created the threshold util especially for this. You only have to replace the si7021 init part with the DHT22 init part and replace the reading part of the si7021 in the threshold util callback with reading the DHT22 part. Then you're done.

                              Just give it a try yourself. It's really not that hard.

                              There's however a reason why I use the si7021 instead of the DHT's. I've had serious troubles with the DHT sensors. Some of them wouldn't report the values to the gateway for a week. After the that the node spontaneously started reporting again. I have a sense bender running for more than a half year flawlessly. So in my opinion the si7021 is superior to the DHT.

                              HilltanH 1 Reply Last reply
                              0
                              • HilltanH Hilltan

                                Maybe a stupid question, but it is possible to replace the SI7021 sensor with a DHT-22 sensor (the code has to be changed offsourse)? And get everything to work with ThresholdUtil? I have all parts, but not the SI7021 sensor to build the rain gauge.

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

                                @Hilltan Like @TheoL mentioned, try to avoid the DHT22, especially for battery powered operation. The DHT-22 is (apart from other disadvantages) specified for a working voltage from 3.3-6V. And tend to get unstable at low voltages.

                                1 Reply Last reply
                                0
                                • hekH Offline
                                  hekH Offline
                                  hek
                                  Admin
                                  wrote on last edited by
                                  #41

                                  Hmm.. @AWI, @TheoL maybe we should replace DHT example on the main site for something more modern?

                                  TheoLT AWIA 2 Replies Last reply
                                  1
                                  • hekH hek

                                    Hmm.. @AWI, @TheoL maybe we should replace DHT example on the main site for something more modern?

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

                                    @hek That sounds like a good idea. Should we also indicate that the SI7021 is a sensor for more experienced users? Because you need to solder wires or headers to it.

                                    1 Reply Last reply
                                    0
                                    • hekH Offline
                                      hekH Offline
                                      hek
                                      Admin
                                      wrote on last edited by
                                      #43

                                      Yes, But they exist in breakout board variants. So it shouldn't be much more effort than connecting a DHT module.

                                      1 Reply Last reply
                                      0
                                      • hekH hek

                                        Hmm.. @AWI, @TheoL maybe we should replace DHT example on the main site for something more modern?

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

                                        @hek @TheoL let's join forces. Dht21 or si7021 share the same code and both available on a board with level converter. And a sketch wit Bme280 (with pressure)
                                        Making a drawing (kicad) is not my thing. The rest ok

                                        TheoLT 1 Reply Last reply
                                        0
                                        • hekH Offline
                                          hekH Offline
                                          hek
                                          Admin
                                          wrote on last edited by
                                          #45

                                          Yep, note that the BMP180/BMP085 is described in the https://www.mysensors.org/build/pressure example. BME280 might be a better choice nowadays perhaps.

                                          TheoLT 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