Soil Moisture Level Automation

Concept art of a machine that is caring for a basil plant generated in midjourney

Adventures in plant care automation

The long-term goal of this system is to create a fully contained automated plant pod that can take care of a plant or a group of plants at a time. The MVP goal is simply to indicate to a plant-care-taker that the soil moisture content is too low. The short-term goal is to have it automatically water itself from a vat. The plant can essentially ask for water.

Outlining the Goal

  1. Accurately detect soil moisture levels: This means interpreting sensor output from a specific Analog sensor I’ve soured and set read intervals.

  2. Transform raw values from monitoring sensors into values that make sense to carry out logical decisions on them

  3. Create a variable ‘moisture level monitoring’ function or class that will have some internally held parameters and create moisture level statuses based on the most recently measured value.

  4. Measure the water level in a reservoir with a sensor, and translate its output into meaningful values

  5. using soil moisture level plus reservoir level values, control a pump output

  6. create 2 different ways to handle pump output:

    1. periodic pump & measure until target moisture level is hit

    2. run pump for x time or until reservoir level is too low

This Is No Simple Task

Diagram of a system that is providing water supply to a basil plant

If I were using some libraries that had sensor handling and various other items it would be really simple. But since everything will be from scratch, this will be its own little module. It will require a lot of design and testing efforts, but in the end, it will be part of my own greenhouse control library to speed up the roll-out of similar features over time.


Breaking it down into smaller chunks

My plan is to start with Step One. I need to start working with my soil sensors and be sure that I am accurately measuring before I move any further. I don’t want to risk incorrectly reading the sensor and not providing the right amount of water to any plant that is under PicoPonic care.


Task Chunk List

  1. Verify sensor measurements and signal tuning

  2. abstract sensor measurements into real meaningful values to the system that I can more easily make decisions with.

  3. Create interval to check the sensor values

  4. the interval should trigger a read from inputs, that then triggers the abstraction into system state.

  5. A separate standard ‘system tick’ should evaluate state on some interval and decide to make updates based on the actively held state

  6. The system state ‘tick’ should be at least 2-5x slower than the sensor read tick

  7. create dummy water level monitoring that always provides ‘adequate water level’ status

  8. create logic that combines water level state with moisture state to create a ‘pump safe to run signal’

  9. create a pump control function that runs the pump on intervals to give time for the soil to saturate without flooding the pot

  10. map the pump control output onto the system state

  11. system tick should trigger and that system state should then map onto the outputs


Conclusion

Looks like this might end up taking a while. If I completed one task per day, that’d be 11 days. I doubt I’ll move that fast as I have other things going on in life right now.

Previous
Previous

Understanding ADC with the Raspberry Pi Pico and Rust

Next
Next

Building Understanding of Closures with Rust