Real-Time ML Soil Moisture Mapping Using FarmBot Images

Hi everyone,

I’m Paul, a high school student working on an open-source computer vision project.

I’ve developed a lightweight pipeline that takes FarmBot camera images together with the X/Y coordinates and generates a fully meshed soil moisture heatmap from RGB imagery alone. The goal is to provide a visual map of where irrigation is needed without installing additional soil sensors throughout the bed.

The system currently works through an API and I also wrote a Lua script that can send FarmBot images directly for processing.

I’m curious whether anyone in the community would be interested in testing it or discussing possible integration into existing FarmBot workflows. I’d also appreciate any feedback on where something like this could be useful.

Thanks!

I’d be interested in testing it, I’ve been trying to build a home assistant app to address some of the limitations of my bot and would love to be able to include something like this

Thanks @farmbotau for being willing to test MoisturePilot on your FarmBot!

Client repository:
github.com/paulschnabl/moisturepilot-farmbot-client

Setup instructions:
github.com/paulschnabl/moisturepilot-farmbot-client/blob/main/USER_INSTRUCTIONS.md

Getting started only requires adding two Lua sequences:

  1. Run the single-position camera test.
  2. Run the full-garden scan.

A few current limitations I’ll evaluate through broader FarmBot testing:

  • Plant-covered tiles are currently still processed by the moisture model. Depending on how much visible soil is typically available across FarmBot gardens, I may add vegetation filtering.
  • The model was trained using three California soil types, so its estimates may be less accurate for soil and lighting conditions outside the current training set. I am training a more universal model, which I expect to add to the API next week.

Please let me know if you encounter any errors

I’ve looked through the code and I’m not super comfortable sending my FarmBot account authorization token to an external service during enrolment as this would effectively give over control of my farmbot.

Would you be able to manually provision an MP_DEVICE_ID and MP_DEVICE_KEY for my FarmBot, or provide a one-time pairing-code method that does not require the Lua client to send auth_token() to the MoisturePilot server?

The existing client already appears able to operate using those stored device credentials once they have been issued.

I’ve also opened an issue on the repo as one of the lua scripts is too long

I manually provisioned a unique MP_DEVICE_ID and MP_DEVICE_KEY for your FarmBot and sent them to you privately.

To install them, create a temporary Lua sequence using the provided setup code, run it once, and then delete the sequence. The regular MoisturePilot scripts will read the stored credentials and skip the auth_token() enrollment process.

I also shortened the full-garden Lua script so it is safely below FarmBot’s 3,000-character limit. Thank you for identifying both issues.

2 Likes

If anyone else would like to try the API, just let me know, and I’ll send you login credentials.