How to use the soil moisture sensor in a sequence?

I would like to write a sequence that conditionally waters various amounts based on a soil sensor reading. Is there a way to do this? What I think you’d need to do is to go across the bed taking individual soil readings at or near each plant in one pass while the soil sensor is in the head of the gantry. Then with that gathered data, you would then test each value against several levels and water a little, medium or a lot.

It would be even nicer if the wait time could be varied based on the reading so that you could have an algorithmic watering time that is based on soil moisture level, but at least having several ‘buckets’ of time might work.

Also, how exactly do you take a soil moisture reading?


Did you ever make any progress with this?

I just finished my first sequence for grabbing the seeder tool and removing it from the bay.
Next, I want to start working with the soil sensor to do exactly what you have posted above.


No. I have no idea how to use the soil sensor. Given the fields available in the sequence, I would assume that this is a “future” feature and not yet implemented :frowning:

I see where you can “read a pin” as either digital I/O or as a PWM. I’m guessing that the soil sensor needs to be an analog value as the sparkfun sensor they use has analog out proportional to soil moisture.

I see that the “IF” statement can also read a pin and compare it to a value. Does that read an analogue value is are those 1/0 or PWM values like the “read pin” method?

1 Like

that would make some sense.

Thanks for the reply.

At this point, ill continues to work on a plant seed and watering sequence until further updates.

Let me know if you find anything useful!


BTW, here’s the soil sensor’s documentation:

The +5 and GND are connected via the tool holder. The Signal pin from the sensor is connected to tool pin “D”. From there, we know that pin “D” is connected to Pin A59 on Arduino/RAMPS - which is Analog-In.

The missing piece is how do you read that pin from the web application?

1 Like

You can read the moisture level with the function Read pin. Using pin 59 and pin mode 1, you can see a value in the logger.

But using this value seems not to work yet. I expect it to be used in the IF function, but there are only pin 1-10 available.


has any one found more info on this ?
an i would love to see a pic or a video on this

Everybody can show the picture about using the soil sensor, writing comman in the web-app.

Some information about reading pins, including the soil sensor, can be found in the pin reading documentation.

Where is the data of soil moisture?

1 Like

This is my sequence for reading soil sensor:

Ok, so now that you have read the pin, what can you do with that information? Can you save it anywhere for use later in another sequence? Can you related that reading to any specific soil moisture level? Can you use that reading to make a logical decision in the flow of a sequence or to call up a sub-sequence.

This is the nature of this thread. We are asking, how do you “use” the reading, not how do you read the pin.

Here is a simpe example.

1 Like

I can’t get rid of the tools when I plant sowing, because the pipe is not closed when changing the tool, which causes the loss of gas. How does it achieve the seed absorption??thank you.

I have read this conversation about using the Soil Moisture Sensor, as well as others in different threads related to use of this tool.

What amazes and frustrates me is that Farmbot provides a tool without also providing any viable procedures for using this tool, provides no information regarding obtaining moisture readings and then using those readings as levels of soil moisture, and is comfortable letting the community struggle to work out such details on their own. If you sell a product it is logical to assume that the product, in its entirety, would be tested, documented, and reliable in what it proposes the product will do.

Without such documentation our solution is to use vendors who supply quality instruments (such as Vernier and their soil moisture sensors) and use them outside of the Farmbot system. Sort of defeats the purpose!

The documentation for the soil sensor is included in the Reading Pins page of the software documentation, as has been linked to previously in this thread. If you have any suggestions for improvements to the documentation, please me know.