💬 Soil Moisture Sensor


  • Plugin Developer

    @neverdie They support I2C. So in theory you can connect a whole bunch to a pin. I'm trying to figure out if I can detect all of them and then automatically give each a unique ID.



  • @alowhum I amm not sure how easy it is to change the I2C address on devices like this.


  • Plugin Developer

    @dbemowsk Changing the Chirp's I2C address is very easy actually.

    #include <I2CSoilMoistureSensor.h>
    #include <Wire.h>
    
    I2CSoilMoistureSensor sensor(0x20);
    
    // connect the reset pin (5) of the Chirp to a pin on your Arduino. It will create a small reset signal. This tells the chirp it should not be a stand-alone ensor, but an I2C connected one. If it receives I1C data shortyl after a reset (few seconds), then it will understand.
    int resetPin = 4;
    
    void setup() {
      pinMode(resetPin, OUTPUT); 
      delay(1000);
      digitalWrite(resetPin, HIGH);       // sets the digital pin 13 on
      delay(100);                  // waits for a second
      digitalWrite(resetPin, LOW);        // sets the digital pin 13 off
      delay(1000);
      Wire.begin();
      Serial.begin(9600);
    
      sensor.begin(); // reset sensor
      delay(1000); // give some time to boot up
      Serial.print("I2C Soil Moisture Sensor Address: ");
      Serial.println(sensor.getAddress(),HEX);
      Serial.print("Sensor Firmware version: ");
      Serial.println(sensor.getVersion(),HEX);
      Serial.println();
    
      Serial.print("Change address to 0x21 ...");
      if (sensor.setAddress(0x21,true)) // set Sensor Address to 0x21 and reset
        Serial.println("... DONE");
      else
        Serial.println("... ERROR");
      Serial.println();
    }
    
    /*loop scans I2C bus and displays foud addresses*/
    void loop() {
      byte error, address;
      int nDevices;
    
      Serial.println("Scanning...");
    
      nDevices = 0;
      for(address = 1; address < 127; address++ ) {
        // The i2c_scanner uses the return value of
        // the Write.endTransmisstion to see if
        // a device did acknowledge to the address.
        Wire.beginTransmission(address);
        error = Wire.endTransmission();
    
        if (error == 0) {
          Serial.print("I2C device found at address 0x");
          if (address<16)
            Serial.print("0");
          Serial.print(address,HEX);
          Serial.println("  !");
    
          nDevices++;
        }
        else if (error==4) {
          Serial.print("Unknow error at address 0x");
          if (address<16)
            Serial.print("0");
          Serial.println(address,HEX);
        }
      }
      if (nDevices == 0)
        Serial.println("No I2C devices found\n");
      else
        Serial.println("done\n");
    
      delay(3000);           // wait 5 seconds for next scan
    }
    

    The default address is 0x20. So my idea is to just keep scanning, and if I find a 0x20 Chirp, then I change its I2C address to 0x21 and higher. Repeat as necessary until all 0x20 devices are gone.

    The only thing I'm not sure about is if this is possible. If I can pick them off one by one this way.



  • @alowhum That is nice. Some I2C devices have it hard coded and do not allow this from my understanding.


  • Plugin Developer

    @dbemowsk True. But it's another reason why I think the Chirp devices are pretty great soil sensors.





  • @alowhum
    Not sure I2C is a good idea excepting case all sensors inside one room. It can be used just for testing to make it easy. As usual RS485 used to connect any sensors to nework. And there is Modbus protocol over RS485 that enable to use not only custom sensors, but kind of devices can be usefull in automatic systems. For example pump controllers, valve controllers....

    So.. no good perspecrives to go


  • Plugin Developer

    Well, the Chirp doesn't support that protocol, so..
    It does have a mini arduino inside. Perhaps you could reprogram it. Then I will happily have a look 😉

    https://wemakethings.net/chirp/



  • No reason to reprogramm. There is I2C wired outside of sensor instead of UART. And some IC necessary to drive RS485.

    Would be easy to use custom adapter over the sensor with only two IC on board, some MCU and MAX485 (or analog).


  • Plugin Developer



  • @robkuipers

    Your code will fail compiling in Arduino 1.8.5 (mysensors 2.2.0) with the following errors:

    /mnt/data/Dropbox/UTV/Arduino/SoilMoisture/SoilMoisture.ino: In function 'void before()':
    /mnt/data/Dropbox/UTV/Arduino/SoilMoisture/SoilMoisture.ino:112:114: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
       sensors[0] = { SENSOR1_ROD1_DIGITAL, SENSOR1_ROD1_ANALOG, SENSOR1_ROD2_DIGITAL, SENSOR1_ROD2_ANALOG, -1, false };
                                                                                                                      ^
    /mnt/data/Dropbox/UTV/Arduino/SoilMoisture/SoilMoisture.ino:112:14: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
       sensors[0] = { SENSOR1_ROD1_DIGITAL, SENSOR1_ROD1_ANALOG, SENSOR1_ROD2_DIGITAL, SENSOR1_ROD2_ANALOG, -1, false };
                  ^
    /mnt/data/Dropbox/UTV/Arduino/SoilMoisture/SoilMoisture.ino:116:114: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
       sensors[1] = { SENSOR2_ROD1_DIGITAL, SENSOR2_ROD1_ANALOG, SENSOR2_ROD2_DIGITAL, SENSOR2_ROD2_ANALOG, -1, false };
                                                                                                                      ^
    /mnt/data/Dropbox/UTV/Arduino/SoilMoisture/SoilMoisture.ino:116:14: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
       sensors[1] = { SENSOR2_ROD1_DIGITAL, SENSOR2_ROD1_ANALOG, SENSOR2_ROD2_DIGITAL, SENSOR2_ROD2_ANALOG, -1, false };
                  ^
    

    So the following code need tobe changed to something valid

    sensors[0] = { SENSOR1_ROD1_DIGITAL, SENSOR1_ROD1_ANALOG, SENSOR1_ROD2_DIGITAL, SENSOR1_ROD2_ANALOG, -1, false };
    
    	sensors[1] = { SENSOR2_ROD1_DIGITAL, SENSOR2_ROD1_ANALOG, SENSOR2_ROD2_DIGITAL, SENSOR2_ROD2_ANALOG, -1, false };
    
    

    I'm not a c++ guy so I can't tell what needs to be done. Maybe you or someone else would like to help out?

    Cheers!

    EDIT: After removing the file platform.txt for solving another problem (as suggested here) The problem above vanished. So strange. But it works now so... 😎 😎 😎



  • I've found that measuring soil moisture by the electrical resistance is not a trivial task.

    If the probe is put into compact soil containing no mold, you'll typically get a high reading even at very low moisture levels. It will most likely always stay within the span of 90-100%.

    However if the probe is put into pure mold, the readings will range between 0% to 100%.

    My conclusion is that measuring directly in the soil is very unpredictable. A better solution might be to surround the probe with some material that adapts the ambient humidity from whatever kind of soil it's put into.


  • Plugin Developer

    Perhaps the capacitive sensors are more useful.


  • Mod

    I guess it depends on the soil. Resistive measurements works well for all my plants.



  • This post is deleted!


  • @mfalkvidd It depends from mineral composition of soil. I buld capacitive sensor with additional electrodes to measure salinity of soil with resistive method (it measures the resistance of soil to alternating current). So, while value of capacitive sensor stable and let say 50%, value of resistive can be critically changed by adding few milliliters of water with fertilizer. Capacitive value will be chaged only to 60% e.g.

    It's not a good idea to use resistive sensor, especcialy measuring resistance to direct current.


  • Mod

    @ul7aajr could you expand on why is it not a good idea? I've been using my sensors for almost 3 years without noticing any problem.



  • Sure. At first, I'm very surprised that your resistive sensor in soil still not destroyed under corrosion especially when the current flows. All my experiments with such sensors have been stuck many years ago. May be a miss sometihing, just show me your sensors after three years in soil? And again, it's a basic phisical things, that the conductivity of the soil depends on the mineral composition. I have already said more than once that there is possible to get a "negative" conductivity of the soil, something like effect of the battery.



  • Hello,
    I start with mysensors and I do not know much about programming. Is there a possibility to have 7 soil moisture sensor on one or two arduino mini pro.
    Thank you


  • Plugin Developer

    My sketch handles 6. Feel free to use it. It uses analog capacitive sensors. They cost about 3 euro.

    I would recommend getting an Arduino Nano with an Expansion board. Then you don't need to solder anything.
    https://www.aliexpress.com/item/Free-shipping-Nano-328P-IO-wireless-sensor-expansion-board-for-XBEE-and-NRF24L01-Socket-for-arduino/32298692903.html

    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * DESCRIPTION
     * 
     * This node can measure the moisture of 6 different plants. It uses the cheap 'capacitive analog 
     * moisture sensor' that you can get for about 3 dollars an Aliexpress or eBay. For example:
     * https://www.aliexpress.com/item/Analog-Capacitive-Soil-Moisture-Sensor-V1-2-Corrosion-Resistant-Z09-Drop-ship/32858273308.html
     * 
     * Each plant' moisture value can also be responded to individually, either by turning on an LED (wire that to the plan, and you can see which one is thirsty) or, if you want, per-plant automated irrigation by connecting a little solenoid..
     * 
     * Todo: Allow the controller to set the threshold values for each plant individually. Unfortunately, Domoticz doesn't support this yet :-(
     * 
     */
    
    //#define MY_SIGNING_SIMPLE_PASSWD "changeme"
    #define MY_SPLASH_SCREEN_DISABLED                       // saves a little memory.
    //#define MY_DISABLE_RAM_ROUTING_TABLE_FEATURE          // saves a little memory.
    
    #define MY_NODE_ID 60                                   // Optional. Sets fixed id with controller.
    #define MY_PARENT_NODE_ID 0                             // Optional. Sets fixed id for controller.
    #define MY_PARENT_NODE_IS_STATIC                        // Optional. Sets fixed id for controller.
    
    #define MY_TRANSPORT_WAIT_READY_MS 5000                 // try connecting for 5 seconds. Otherwise just continue.
    
    // Enable debug prints to serial monitor
    //#define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_NRF5_ESB
    //#define MY_RADIO_RFM69
    //#define MY_RADIO_RFM95
    
    #define MY_RF24_PA_LEVEL RF24_PA_LOW                    // Low power radio setting works better with cheap Chinese radios.
    
    #include <MySensors.h>
    
    #define NUMBEROFSENSORS 6                               // How many sensors are connected?
    
    #define DRYNESSTHRESHOLD 45                             // minimum moisture level that is still ok. A lower value will trigger LED/irrigation.
    
    uint32_t SLEEPTIME = 60;                                // Sleep time between the sending of data (in SECONDS). Maximum is 254 seconds. Change "byte" to "int" further down in the code if you want more time between sending updates.
    unsigned long lastTimeChecked = 0;
    
    MyMessage msg(0, V_LEVEL);
    
    void before()
    {
    
      for (byte i = 3; i < NUMBEROFSENSORS + 3; i++){             // Set the LED (or irrigation vales) to their initial position.
        pinMode(i, OUTPUT);
        digitalWrite(i, LOW);
      }
      
    }
    
    
    void presentation()
    {
    	// Send the sketch version information to the gateway and Controller
    	sendSketchInfo(F("Plant Sensorium"), F("1.2"));
    
      // present the sensors
      for (byte i=0; i<NUMBEROFSENSORS ; i++) {
        present(i, S_MOISTURE, i); // the last i gives the controller a name, in this case the number of the sensor.
      }
    
    }
    
    void setup()
    {
      Serial.begin(115200);
      delay(1000);
      
      Serial.println(F("Hello world. Warming up the sensors (15 seconds)."));
    
      delay(15000);
      
    }
    
    void loop()
    {
    
      static byte measurementCounter = 0;                     // Counts the measurements that are done, once per second.
      uint32_t currentMillis = millis();                      // The millisecond clock in the main loop.
    
      if (currentMillis - lastTimeChecked > 1000) {           // Internally, the moisture values are checked every second.
        lastTimeChecked = currentMillis;
        
        Serial.println(F("__________"));
        
        for (int i=0; i<NUMBEROFSENSORS; i++) {               // loop over all the sensors.
          byte shiftedDigitalPin = i + 3;
        	int16_t moistureLevel = (1023-analogRead(i))/10.23;
          Serial.print(i);
          Serial.print(F(" mosture level: "));
        	Serial.println(moistureLevel);
          Serial.print(F("- output pin: "));
          Serial.println(shiftedDigitalPin);      
          Serial.print(F("- irrigation/LED state is "));
          Serial.println(digitalRead(shiftedDigitalPin));
    
          if(digitalRead(shiftedDigitalPin) == HIGH){                         // outputs the LED/irrigation status via serial. This code can be removed.
            Serial.print(F("- currently watering until "));
            Serial.println(DRYNESSTHRESHOLD + 10);
          }
    
          if (moistureLevel < DRYNESSTHRESHOLD){              // if the plant doesn' have enough water, turn on the LED/water.
            Serial.print(F("- moisture level is below "));
            Serial.println(DRYNESSTHRESHOLD);
            digitalWrite(shiftedDigitalPin, HIGH);
          }else if (moistureLevel >= DRYNESSTHRESHOLD + 10){   // turn of the water/led if the plant is wet enough.
            digitalWrite(shiftedDigitalPin, LOW);
          }
    
          if(measurementCounter < NUMBEROFSENSORS){           // During the first 6 seconds the script will send updated data.
            if(measurementCounter == i){                      // it sends sensor 0 at second 0. Sensor 1 at second 1, etc. This keeps the radio happy.
              Serial.println(F("- sending data."));
              send(msg.setSensor(i).set(moistureLevel));
            }
          }
          if(measurementCounter > SLEEPTIME){ // If enough time has passed, the counter is reset, and new data is sent.
            measurementCounter = 0;
          }else{
            measurementCounter++;
          }
        }
        
      }
    }
    


  • I command and I try. Thank you very much


  • Plugin Developer

    @mathieu44444 My pleasure. Good luck.



  • @mfalkvidd , maybe you are using your resistive sensors indoors in soil consisting of 100% mold. (blomjord). I guess it works great. However I'm just curious if your sensors are also working on soil from outdoors. I guess not very well.



  • @รอเร-อ I have resistive sensors (YL-69 type) both indoors and outdoors. Both have been working correctly for months now. I'm using a direct-reverse polarization sketch to minimize corrosion and it seems to work well. What I found to be very important in outdoors sensors is the isolation of the connector between the probe and the cable; if rain water or watering stays into there, they tend to corrode and their resistance increases, therefore fooling the sensor into thinking that the soil is drier than it really is. I have a couple of capacitive sensors somewhere but haven't felt the need to try them since the resistive ones are working well.



  • @alowhum

    I've ordered 5 capacitive sensors from Aliexpress now. I need to find a way to protect them so I can bury them into the soil in the garden at different depths.

    What sketch are you using for capacitive sensors?

    EDIT: I just saw your sketch posted above. I will try it out. Thanks!



  • @manutremo

    thanks

    here with my soil, it's different. Even at very little moisture it shows 100%. Maybe I have a lot of iron in the soil.



  • @alowhum

    How are your capacitive sensors wired to the board?


  • Plugin Developer

    I use the expansion board I mentioned. You can just plug the sensors directly into it, all in a row from A0 to A5.

    Then on the opposite side of the board I have LED's connected to digital pins 3 till 8, one for each plant.

    I'm working on replacing the LED's with solenoids that will automatically water the plants. The code already supports this.



  • @manutremo

    how did you wire you normal fork sensor, i get different reading when using a voltage divider if i switch the polarization.
    i used this to connect it.
    http://www.electronicwings.com/sensors-modules/soil-moisture-sensor
    using pin digital 6 and 7 as alternating power, and pin A0 to read

    And how do other people protect there capacitive sensor electronics from water .. rain





  • How would you guys protect one of these capacitive soil moisture sensors from moisture in case the probe shall be buried 20 cm deep in the soil outdoors.

    The way they are made now, they may only be used in a indoor flower pot and even then there is a risk that the probes electronic components will be drowned in water while watering your flowers. Ideally, they should be water proof from the beginning, that's what I think.

    Anyway, now I have a few of them and I intend to do a solar powered a multi depth soil moisture sensor using capacitive soil moisture sensors at various depths.

    So, how to protect them?

    I have an idea but I'm not sure it's working: Put it partly inside a plastic tube and cover the electronics with 2 component expoxy glue. ...

    EDIT 1 : maybe silicone rubber would work...
    EDIT 2 : Adding a photo of an untested prototype. Plastic housing filled with construction silicone rubber!
    0_1529322106621_sensor.jpg

    EDIT 3: Prototype sensor works great. (At least for the moment. I hope it will last several years.)
    Cheers!



  • Grafana graph
    0_1531117303097_hacken.jpg

    Tjo!

    Edit: Updated Graphana graph with watering events marked red. Red horizontal line is the automatic watering threshold (Which has been adjusted a few thimes)



  • if you buy a capacitive sensor like this then it is extremely simple. Here are some sample sketches which work pretty good. Not sure why one should bother with corrosion and similar issues when you can buy a pretty cheap capacitive sensor. Are there any drawbacks I may have missed ? I just installed one in a pot and curious to see how it goes

    Here's the code that I use

    /*
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * DESCRIPTION
     *
     * Arduino soil moisture based on gypsum sensor/resistive sensor to avoid electric catalyse in soil
     *  Required to interface the sensor: 2 * 4.7kOhm + 2 * 1N4148
     *
     * Gypsum sensor and calibration:
     *    DIY: See http://vanderleevineyard.com/1/category/vinduino/1.html
     *    Built: Davis / Watermark 200SS
     *        http://www.cooking-hacks.com/watermark-soil-moisture-sensor?_bksrc=item2item&_bkloc=product
     *        http://www.irrometer.com/pdf/supportmaterial/sensors/voltage-WM-chart.pdf
     *        cb (centibar) http://www.irrometer.com/basics.html
     *            0-10 Saturated Soil. Occurs for a day or two after irrigation
     *            10-20 Soil is adequately wet (except coarse sands which are drying out at this range)
     *            30-60 Usual range to irrigate or water (except heavy clay soils).
     *            60-100 Usual range to irrigate heavy clay soils
     *            100-200 Soil is becoming dangerously dry for maximum production. Proceed with caution.
     *
     * Connection:
     * D6, D7: alternative powering to avoid sensor degradation
     * A0, A1: alternative resistance measuring
     *
     *  Based on:
     *  "Vinduino" portable soil moisture sensor code V3.00
     *   Date December 31, 2012
     *   Reinier van der Lee and Theodore Kaskalis
     *   www.vanderleevineyard.com
     * Contributor: epierre
     */
    
    // 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.
    
    #define MY_NODE_ID 6
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Enable and select radio type attached
    //#define MY_RADIO_NRF24
    //#define MY_RADIO_NRF5_ESB
    #define MY_RADIO_RFM69
    //#define MY_RADIO_RFM95
    #define MY_RFM69_NEW_DRIVER
    
    
    #include <math.h>       // Conversion equation from resistance to %
    #include <MySensors.h>
    
    
    #define CHILD_ID 0
    
    MyMessage msg(CHILD_ID, V_LEVEL);
    static const uint64_t UPDATE_INTERVAL = 43200000;
    
    void setup()
    {
     Serial.begin(115200); // open serial port, set the baud rate as 115200 bps
    }
    
    void presentation()
    {
        sendSketchInfo("Soil Moisture Sensor", "1.0");
        present(CHILD_ID, S_MOISTURE);
    }
    
    void loop()
    {
        int moisture;
        moisture = analogRead(0);
        //Serial.println(moisture); //print the value to serial port
        send(msg.set(moisture));
        sleep(UPDATE_INTERVAL);
    }
    

    Regards,


  • Mod

    @cgeo the reasons I'm using the resistive sensor are:

    • the cost for the resistive sensor is less than 10% of the cost of the capacitive sensor you linked
    • after 3 years of use I don't experience corrosion issues except for the part that is above the dirt, which the capacitive sensor will have problems with as well


  • Hey. usually on A0 battery. as here?


  • Mod

    @ihor could you rephrase that question? What do you mean?



  • I mean, in sketch: A0, A1: alternative resistance measuring. In MySensors usually, A0 input battery level.


  • Mod

    @ihor I see. Thanks for explaining. Easiest way is probably to use some other analog pin for the battery measurement. Any of A2 to A6 should work.



  • I understood. Thank you



  • How to use:
    Required to interface the sensor: 2 * 4.7kOhm + 2 * 1N4148 (DESCRIPTION in skech)
    And: D6, D7: alternative powering to avoid sensor degradation

    • A0, A1: alternative resistance measuring

  • Mod

    @ihor A6 and A7 can not be used for alternating power. They can do analog read only.



  • understandably. but I asked about D6 (D7). what is the sensor connection?


  • Admin

    @mfalkvidd
    I think they can actually.


  • Mod


  • Mod

    @ihor oh. Sorry. Yes, D6 and D7 are fine.


  • Admin

    @mfalkvidd
    Ok, didn't know that these two had a special thing going. Thanks.



  • I use A0, A1
    2018-08-12 01:31:11.969 [vent.ItemStateChangedEvent] - MoistHum changed from 11 to 964

    2018-08-12 01:31:42.386 [vent.ItemStateChangedEvent] - MoistHum changed from 964 to 121

    2018-08-12 01:31:42.440 [vent.ItemStateChangedEvent] - MoistBat changed from 42 to 43

    2018-08-12 01:32:13.860 [vent.ItemStateChangedEvent] - MoistHum changed from 121 to 299

    2018-08-12 01:32:45.300 [vent.ItemStateChangedEvent] - MoistHum changed from 299 to 129

    2018-08-12 01:33:16.717 [vent.ItemStateChangedEvent] - MoistHum changed from 129 to -11

    2018-08-12 01:33:48.132 [vent.ItemStateChangedEvent] - MoistHum changed from -11 to -101

    2018-08-12 01:34:19.528 [vent.ItemStateChangedEvent] - MoistHum changed from -101 to 514

    2018-08-12 01:34:50.943 [vent.ItemStateChangedEvent] - MoistHum changed from 514 to 1478

    2018-08-12 01:35:22.355 [vent.ItemStateChangedEvent] - MoistHum changed from 1478 to -265

    What do I connect wrongly? the results are not true



  • any ideas?



  • Hi, I'm trying to get my first sensor to work and I followed this guide https://www.mysensors.org/build/moisture

    I got my gateway to work and the sensor got discovered in openhab. But I think the values I'm getting are quite odd and I don't think it's working as intended for me.

    0_1546800718960_soil.jpg

    That's my setup, just like on the guide. When I put the sensor it into water, 2 LED start to light up on the small blue board.

    I decreased the SLEEP_TIME for testing purpose and here's what I'm getting:

    https://pastebin.com/e93P86aY (too many characters to post it directly here)

    while this measuring, I put it several times into a cup with water and I dried it. Should negative values even happen? I'm not sure how to work with those values.

    It feels like, it's just giving me random numbers without actually measuring something.



  • Hi @atzohy

    The info in the page is confusing. The small board between the sensor and the arduino is an on-off level switcher. It provides a digital binary singnal so can't be connected to an analog pin on the arduino.

    If you wish to measure the moisture level with an analogic scale, you need to eliminate that board and then use a voltage divider and an analog pin. The sketch will be also different. Everything in explained above in the thread.

    You may want to read the full thread and then don't hesitate to come back with your questions.


 

Suggested Topics

281
Online

8.5k
Users

9.3k
Topics

98.7k
Posts