Building a soil humidity sensor for pot plant

A Simple Indicator

An easy setup for an indicator is using a WS2812 with an USB moduel for ESP826 with ESP-01. The the setup is straight forward. The only thing I changed from a standard subscriber is to modify a function to set up the color based on the humidity value.

void set_color(int hum_){
    if ((hum_ < 280) || (hum_>550)){
        b = 255;
    } else {
        r = map(hum_,280,550,255,1);
        g = 255-r;
        b = 0; 
    Serial.print("r: ");
    Serial.print("\tg: ");
    Serial.print("\tb: ");
    pixels.setPixelColor(0, pixels.Color(r, g, b));;

The full code is in the Github. WS2812 (this version requires 5V) only requires 1 wire to set any color you want. I put a 510Ω to limit the current.


Now you know when to water the plant without going outside and poking into the soil. It is not a complete solution such as adding a pump to add water automatically. That is doable. However, having a water pump that is not fully tested could be problematic. That is reason I am deliberating if I should add the pump to the humidity sensing system.

Here is the update of a few days of the sensor on work.