Water level sensor

Hello, I am working on a smart pot (similar to Flaura)
It uses 5 wires on a 3D-printed pillar to check for the water level present in the tank. 4 wires are pins detecting 0-100 % and the fifth one on the bottom is ground. My current code works, but the problem is, that it only works without water. When I short out any pin with the GND pin, it shows the right percentage, however, when I put it in water, the resistance of the water is probably so high that the pins can’t detect the change. I tried it with salty water and it worked flawlessly, but watering a plant with salty water isn’t ideal😁. So what should I do? Thank you for any suggestions.

Note: I know the pins will be corroded in some time, but I don’t care. I will simply sand them down after some time. The reason I ask for help is that the Flaura pot uses the same idea and it somehow works but it uses a fifth Gpio pin instead of GND. You can see Flaura’s diagram below.

BTW here is Flaura’s GitHub

Here is my code and photos of my smart pot:

#water level
binary_sensor:
  - platform: gpio
    pin:
      number: D1
      inverted: true

      mode:
        input: true 
        pullup: true
    id: Full
    
  - platform: gpio
    pin:
      number: D2
      inverted: true

      mode:
        input: true
        pullup: true
    id: Good

  - platform: gpio
    pin:
      number: D3
      inverted: true

      mode:
        input: true
        pullup: true
    id: Fine

  - platform: gpio
    pin:
      number: D4
      inverted: true

      mode:
        input: true
        pullup: true
    id: Critical

sensor:
  - platform: template
    name: Tank Level
    unit_of_measurement: "%"
    lambda: |-
      if (id(Full).state) {
        return 100;}
      else if (id(Good).state) {
        return 75;}
      else if (id(Fine).state) {
        return 50;}
      else if (id(Critical).state) {
        return 25;}
      else {
        return 0;}
    update_interval: 1s


HI
You could try Capacitive sensor if you use ESP32. Others have used it on the forum for there automatic plant watering projects. Put in plastic covering and then no worry about it wearing out. Have a search.
capacitive sensor

1 Like

Thank you for your advice. I am using ESP8266, but that shouldn’t matter. I will consider alternative sensor variants as a last resort. I am trying my best to stick to my original plan and not to change too much stuff. My design was already printed and It took 2+ days to print and cost me like 600g of filament, so I really don’t want to do it all again.

I am relatively new to coding so I created this topic in the hope someone will help me solve my issue. I mentioned the Flaura Pot project because I got inspired by him and I used the same sensor as him. Obviously, for him, it is working, but the problem is that his Smart Pot was built for Blynk and not ESPHome and HA. Here is Flaura’s GitHub if someone could figure out the code and rewrite it to suit ESPHome.

I see on the site it was left as an unfinished project on github. Perhaps he never worked out the wrinkles. What about if you added a small amount of something to the water that wasn’t toxic to your plants. Perhaps a tiny amount of epsom salts?

1 Like

Brilliant idea, I will definitely give it a try. Plants need some kind of fertilizer anyway. Thank you. If anyone else has some other idea, I am open to everything.

Interesting design this pot. Could you share 3d file on thingiverse as a remix of flaura ?

If you don’t have enough ADC entries on your microcontroller you can buy LC1BD04 to convert in digital levels instead of analog.

Hey, I might post it once ill get it to work. I don’t have much time now and I am working on other projects than Smart Pot. I replaced those annoying wires with a homemade aluminum capacitive water level sensor, which works pretty well. Now I am stuck with the choice of MOSFET to control the pump. Most MOSFETs I tried were starting slow and then gradually the motor speed went up. However, that’s not what I am looking for. I need to “shock” the pump to make it spin as fast as possible, so it has enough force to make the blades and water move.

Hello,
For those how still try to make working original Flaura project with esphome
I read original Blynk code for Flaura here i understand now how water level measurement works !
It measure each level one by one in a loop:

  • Put first pin in HIGH level
  • Check pin 35, if level HIGH then there is water at this pin, if LOW then no water at this pin
  • Put pin in LOW level
  • Pin++ (next pin)

(All pins for water level are: 25, 26, 27, 14, 13)

Now i have to implement this logic in esphome. No idea for the moment → I use Plantidote code but with pin adapted for Lolin32 instead of Lolin D32

I also had to replace 100K R1 resistance with a 1M one to have a HIGH level at pin 33 (nearly 3V) → I use ADC with high level above 0.1V
(Also other issues solved in this post)

All is working for me now: Here is my ESPHome config for original Flaura forked from Plantidote config