Moisture reading inverse in Domoticz

  • Hello everyone here at MySensors,

    I have made a mysensors sketch to measure soil moisture in the garden, the sketch work properly, so it is not falling apart 😉

    Only the value in Domoticz is the opposite of what it really is.
    If I have the sensor loose on the desk I get 20cb as value (irrigation advise) and when I put the sensor in a glass of water I get 100cb (dangerously dry)

    is there a possibility to turn this into domoticz, or is the problem in the mysensors sketch?

    I read the value in this way:

     int moistureLevel11 = (1023 - analogRead(VOCHT_PUT_1_PIN))/ 10.23;
        if (moistureLevel11 != lastsoilValue11) {
        send (msg11.set(moistureLevel11));
        lastsoilValue11 = moistureLevel11;}

    And With: S_Moisture

    I Use Mysensors 2,3 and Domoticz Beta V4.10064

    thank you in advance


  • Mod

    @dzjr the debug log from the node would be useful to see which number is being sent.

    If the value needs to be inverted in the sketch, just remove this part:

    1023 - 

  • @mfalkvidd

    Thank Your for the reply,

    I removed the 1023 - And it looks bij now, i think that i have to tweak it to get te right value.

    The node i have combined in a gateway, do i get a good debug than with #my_debug ?

  • Mod

    @dzjr MY_DEBUG should work fine

  • @mfalkvidd

    This is the MyDebug output:

    0 MCO:BGN:INIT GW,CP=R-NGA---,VER=2.3.0
    741 GWT:TIN:IP=
    1744 MCO:BGN:STP
    39316 GWT:TSA:ETH OK
    39375 GWT:RFC:MSG=0;0;3;0;2;
    39382 GWT:RFC:MSG=0;0;3;0;2;Get Version
    45932 GWT:RFC:MSG=0;0;3;0;18;PING
    55858 GWT:RFC:MSG=0;0;3;0;18;PING
    65783 GWT:RFC:MSG=0;0;3;0;18;PING
    75709 GWT:RFC:MSG=0;0;3;0;18;PING
    85635 GWT:RFC:MSG=0;0;3;0;18;PING
    95560 GWT:RFC:MSG=0;0;3;0;18;PING
    105486 GWT:RFC:MSG=0;0;3;0;18;PING
    115411 GWT:RFC:MSG=0;0;3;0;18;PING
    125337 GWT:RFC:MSG=0;0;3;0;18;PING

    i have edit the sketch to this:

    int moistureLevel11 = (analogRead(VOCHT_PUT_1_PIN)) / 5.8;
        if (moistureLevel11 != lastsoilValue11) {
        send (msg11.set(moistureLevel11));
        lastsoilValue11 = moistureLevel11;}

    i only have to adjust the " / 5.8 " for the right value in the ground.

    Thank you for helping!


  • @dzjr , glad you solved your problem .. but... can you please share which sensor are you using to measure the soil moisture?
    I found a lot of sensor suitable for in-house measuring but nothing for outside which is not becoming unusable very quickly.
    Whatever information is highly appreciated...


  • @gbuico

    I use the soil humidity sensor with the external pcb.

    Only I find the measured range somewhat disappointing, I get when completely in water, not the measured value "saturated" it lingers on irrigation.

    so if you have a different solution, I am very much recommended.


    this sensor i use

  • @gbuico

    the external pcb has been built in a housing together with the arduino and the relay board.
    I am controlling the sensor printing with a transistor circuit which I then make a measurement every 15 minutes.

    I have laid a cable between the PCB and the sensors.

  • @dzjr this is what I also had in mind but... are you using a commercial sensor or you built one yourself?
    When I say "sensor" I mean the device that is currently in the soil.
    I checked different commercial sensor and all seem to become unusable in a very short time... this is why I'm really interested in your solution

  • @gbuico

    I now use the commercial sensors from the above link.

    Because the sketch I was still testing the sensors I only tried in a plant or loose on my desk with a glass of water.

    For the control I make an output of the arduino high and use it to control the transistors.

    I will try to post a photo tomorrow.


Log in to reply

Suggested Topics

  • 3
  • 2
  • 2
  • 15
  • 2
  • 4