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. Announcements
  3. 💬 Soil Moisture Sensor

💬 Soil Moisture Sensor

Scheduled Pinned Locked Moved Announcements
99 Posts 33 Posters 31.7k Views 32 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.
  • alowhumA Offline
    alowhumA Offline
    alowhum
    Plugin Developer
    wrote on last edited by
    #71

    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.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rene046
      wrote on last edited by
      #72

      @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

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rene046
        wrote on last edited by
        #73

        o and i forget to ask if this product is a better option .

        https://nl.aliexpress.com/item/Soil-moisture-probe-antioxidant-anti-corrosion-Soil-hygrometer-test-probe-Moisture-detection-sensor-Soil-moisture-detect/32829609385.html?spm=a2g0z.10010108.1000016.1.6403300d7IQapA&isOrigTitle=true

        1 Reply Last reply
        0
        • ร Offline
          ร Offline
          รอเรือ
          wrote on last edited by รอเรือ
          #74

          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!

          ร 1 Reply Last reply
          2
          • ร รอเรือ

            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!

            ร Offline
            ร Offline
            รอเรือ
            wrote on last edited by รอเรือ
            #75

            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)

            1 Reply Last reply
            0
            • C Offline
              C Offline
              cgeo
              wrote on last edited by cgeo
              #76

              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,

              mfalkviddM 1 Reply Last reply
              0
              • C cgeo

                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,

                mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote on last edited by
                #77

                @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
                1 Reply Last reply
                1
                • I Offline
                  I Offline
                  Ihor
                  wrote on last edited by
                  #78

                  Hey. usually on A0 battery. as here?

                  mfalkviddM 1 Reply Last reply
                  0
                  • I Ihor

                    Hey. usually on A0 battery. as here?

                    mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by
                    #79

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

                    1 Reply Last reply
                    0
                    • I Offline
                      I Offline
                      Ihor
                      wrote on last edited by
                      #80

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

                      mfalkviddM 1 Reply Last reply
                      0
                      • I Ihor

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

                        mfalkviddM Offline
                        mfalkviddM Offline
                        mfalkvidd
                        Mod
                        wrote on last edited by
                        #81

                        @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.

                        1 Reply Last reply
                        1
                        • I Offline
                          I Offline
                          Ihor
                          wrote on last edited by
                          #82

                          I understood. Thank you

                          1 Reply Last reply
                          0
                          • I Offline
                            I Offline
                            Ihor
                            wrote on last edited by
                            #83

                            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
                            mfalkviddM 1 Reply Last reply
                            0
                            • I Ihor

                              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
                              mfalkviddM Offline
                              mfalkviddM Offline
                              mfalkvidd
                              Mod
                              wrote on last edited by mfalkvidd
                              #84

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

                              hekH 1 Reply Last reply
                              0
                              • I Offline
                                I Offline
                                Ihor
                                wrote on last edited by
                                #85

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

                                mfalkviddM 1 Reply Last reply
                                0
                                • mfalkviddM mfalkvidd

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

                                  hekH Offline
                                  hekH Offline
                                  hek
                                  Admin
                                  wrote on last edited by
                                  #86

                                  @mfalkvidd
                                  I think they can actually.

                                  mfalkviddM 1 Reply Last reply
                                  0
                                  • hekH hek

                                    @mfalkvidd
                                    I think they can actually.

                                    mfalkviddM Offline
                                    mfalkviddM Offline
                                    mfalkvidd
                                    Mod
                                    wrote on last edited by
                                    #87

                                    @hek not according to this https://github.com/arduino/Arduino/issues/6297

                                    hekH 1 Reply Last reply
                                    0
                                    • I Ihor

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

                                      mfalkviddM Offline
                                      mfalkviddM Offline
                                      mfalkvidd
                                      Mod
                                      wrote on last edited by
                                      #88

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

                                      1 Reply Last reply
                                      0
                                      • mfalkviddM mfalkvidd

                                        @hek not according to this https://github.com/arduino/Arduino/issues/6297

                                        hekH Offline
                                        hekH Offline
                                        hek
                                        Admin
                                        wrote on last edited by
                                        #89

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

                                        1 Reply Last reply
                                        1
                                        • I Offline
                                          I Offline
                                          Ihor
                                          wrote on last edited by
                                          #90

                                          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

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


                                          16

                                          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