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. Leaf Wetness

Leaf Wetness

Scheduled Pinned Locked Moved My Project
45 Posts 9 Posters 37.0k Views 3 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.
  • E Offline
    E Offline
    epierre
    Hero Member
    wrote on last edited by
    #41

    @AWI your sketch has 3 sensors ? do you use a special wiring or you just get through high and low ?

    The sketch on soil humidity does this but with two pins to make kind of AC current, but it needs also some gypsum to protect the electrodes.

    . Leaf wetness is not immersed by nature hopefully ;-)

    z-wave - Vera -> Domoticz
    rfx - Domoticz <- MyDomoAtHome <- Imperihome
    mysensors -> mysensors-gw -> Domoticz

    A 1 Reply Last reply
    0
    • E epierre

      @AWI your sketch has 3 sensors ? do you use a special wiring or you just get through high and low ?

      The sketch on soil humidity does this but with two pins to make kind of AC current, but it needs also some gypsum to protect the electrodes.

      . Leaf wetness is not immersed by nature hopefully ;-)

      A Offline
      A Offline
      AWI
      Hero Member
      wrote on last edited by AWI
      #42

      @epierre It has 3 sensors with copper wiring. It switches the polarity of the voltage divider (1 Mohm in series with the "sensor") and measures the voltage over the sensor. Actualy it is a moisture alarm for a sensitive wooden floor.

      and I learned something today :smirk:
      "Gypsum is a soft sulfate mineral composed of calcium sulfate dihydrate, with the chemical formula CaSO4·2H2O"

      1 Reply Last reply
      0
      • E Offline
        E Offline
        epierre
        Hero Member
        wrote on last edited by
        #43

        @AWI You can call it also "Plaster of Paris" ;-)

        When immersed you need to protect it whatever you do : http://vanderleevineyard.com/1/category/vinduino/1.html

        z-wave - Vera -> Domoticz
        rfx - Domoticz <- MyDomoAtHome <- Imperihome
        mysensors -> mysensors-gw -> Domoticz

        1 Reply Last reply
        0
        • E Offline
          E Offline
          epierre
          Hero Member
          wrote on last edited by
          #44

          @awi going back to you above sketch, what is your wiring ?

          #define MoistureHighPin 3
          #define MoistureLowPin 4
          #define Moisture1ReadPin A1
          #define Moisture2ReadPin A2
          #define Moisture3ReadPin A3
          

          z-wave - Vera -> Domoticz
          rfx - Domoticz <- MyDomoAtHome <- Imperihome
          mysensors -> mysensors-gw -> Domoticz

          1 Reply Last reply
          0
          • E Offline
            E Offline
            epierre
            Hero Member
            wrote on last edited by epierre
            #45

            Hello,

            I guess it is the same as Vinduino :

            4533105.jpg

            with their test code:

            // This program tests 3 soil sensor inputs and prints bias caused by galvanic effects
            // Copyright (C) 2015, Reinier van der Lee
            // www.vanderleevineyard.com
            
            
            // This program is free software: you can redistribute it and/or modify
            // it under the terms of the GNU General Public License as published by
            // the Free Software Foundation, either version 3 of the License, or
            // any later version.
            
            // This program is distributed in the hope that it will be useful,
            // but WITHOUT ANY WARRANTY; without even the implied warranty of
            // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
            // GNU General Public License for more details.
            
            #include <math.h>       // Conversion equation from resistance to %
            
            
            // Setting up format for reading 3 soil sensors
            #define NUM_READS 10    // Number of sensor reads for filtering
            long buffer[NUM_READS];
            int index;
            
            typedef struct {        // Structure to be used in percentage and resistance values matrix to be filtered (have to be in pairs)
              int moisture;
              long resistance;
            } values;
            
            
            const long knownResistor = 1500;  // Constant value of known resistor in Ohms
            
            int supplyVoltage;                // Measured supply voltage
            int sensorVoltage;                // Measured sensor voltage
            
            values valueOf[NUM_READS];        // Calculated moisture percentages and resistances to be sorted and filtered
            
            
            int i;                            // Simple index variable
            
            
            void setup() {
              // initialize serial communications at 9600 bps:
              Serial.begin(115200); 
                
            
              // initialize the digital pins as an output.
              // Pin 6,7 is for sensor 1
              pinMode(6, OUTPUT);    
              pinMode(7, OUTPUT); 
             
              
            }
            
            void loop() {
              
             
            
            measure(1,6,7,1);
            Serial.print ("\t");
            Serial.println (average());
            long read1 = average();
            
            measure(1,7,6,0);
            Serial.print ("\t");
            Serial.println (average());
            long read2= average();
            
            long sensor1 = (read1 + read2)/2;
            
            Serial.print ("resistance bias =" );
            Serial.println (read1-read2);
            Serial.print ("sensor bias compensated value = ");
            Serial.println (sensor1);
            Serial.println ();
            
             delay (3000);
            
            }
            
            void measure (int sensor, int phase_b, int phase_a, int analog_input)
            {
             
              // read sensor, filter, and calculate resistance value
              // Noise filter: median filter
            
              for (i=0; i<NUM_READS; i++) {
            
                // Read 1 pair of voltage values
                digitalWrite(phase_a, HIGH);                 // set the voltage supply on
                delayMicroseconds(25);
                supplyVoltage = analogRead(analog_input);   // read the supply voltage
                delayMicroseconds(25);
                digitalWrite(phase_a, LOW);                  // set the voltage supply off 
                delay(1);
                 
                digitalWrite(phase_b, HIGH);                 // set the voltage supply on
                delayMicroseconds(25);
                sensorVoltage = analogRead(analog_input);   // read the sensor voltage
                delayMicroseconds(25);
                digitalWrite(phase_b, LOW);                  // set the voltage supply off 
            
                // Calculate resistance
                // the 0.5 add-term is used to round to the nearest integer
                // Tip: no need to transform 0-1023 voltage value to 0-5 range, due to following fraction
                long resistance = (knownResistor * (supplyVoltage - sensorVoltage ) / sensorVoltage)-457 ;
                
                delay(1); 
                addReading(resistance);
                Serial.print (resistance); 
                Serial.print ("\t");
              }
              }
              
            
            
            // Averaging algorithm
            void addReading(long resistance){
              buffer[index] = resistance;
              index++;
              if (index >= NUM_READS) index = 0;
            }
            
            long average(){
              long sum = 0;
              for (int i = 0; i < NUM_READS; i++){
                sum += buffer[i];
              }
              return (long)(sum / NUM_READS);
            }
            

            and my hall of fame and shame of sensors I've tried :

            IMG_20150801_083113.jpg

            z-wave - Vera -&gt; Domoticz
            rfx - Domoticz &lt;- MyDomoAtHome &lt;- Imperihome
            mysensors -&gt; mysensors-gw -&gt; Domoticz

            1 Reply Last reply
            0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            9

            Online

            12.0k

            Users

            11.2k

            Topics

            113.4k

            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