Want to use ESP32 as a water sensor

I want to set up an ESP32 to sense when my water fountain is low on water. I tried using an Aqara leak detector but the problem is that it will tell me very quickly when it is wet but takes quite a while to switch back to dry and that is taking too long and the pump runs dry. Basically I submerge a wire in the fountain and when it goes dry it will alert me.

Anyone have any ideas to help me figure this out?


HI
Just suggesting capacitative detection. Easy to set up on ESP32

Sweet! Can you provide some details?

Have a look

Is that just a regular jumper wire attached to D27? Hard to tell from the pic…

Yeah, with a bit of tinfoil on the end.

Awesome! Thanks so much! I think I can make that work. Just need to create the binary sensor and set the thresholds.

Can’t thank you enough! :slight_smile:

I use these to track my pool and pond water levels. Just another option. Easy to set up.

https://a.aliexpress.com/_mrhf9Va

I ised one of these double float switches in mine. Unlike most float switches just like the one above, it only has 1 float switch.

With only 1 float, you have to choose if you want to monitor for a Low level or a High level, not both. The purpose for monitoring an uoper and lower water threshold is if you have already or plan to automate the refilling or your resevoir. So, bottom float switch turns On, water is Low now open valve to refill and when Top float turns On your resevoir is full so turn off refill valve.
https://www.amazon.com/dp/B09JSYMM5G/ref=sspa_mw_detail_0?ie=UTF8&psc=1&sp_csd=d2lkZ2V0TmFtZT1zcF9waG9uZV9kZXRhaWw

For me, I wanted a secondary way to monitor water level just incase one of the floats get stuck, quit working or whatevet because It would either run dry and burn up the pump or would continuously show a Low level and attempt filling up and both scenarios are no good.

For a backup, i also use these IR liquid level sensors. One at Low level and 2 more ar at the very top of the resevoir and serve as backups to the double float switch. Since they are above the maximum level my upper float reaches, they function as a backup “full” sensor and overflow sensors.

https://www.amazon.com/EPTTECH-Optical-Infrared-Sensibility-Controller/dp/B075R6SSHJ/ref=mp_s_a_1_20?crid=3B4UZGPGRL2DB&dib=eyJ2IjoiMSJ9.D1r7o-5pPpEjMX6gz6n9HMD-s-NgBWDLoGvIG47HxECxV9qTq83_AD_2WEbi8yf0HnDvDNuSfFWdUm9JbcVf9Xl2xqM5JxARB6UlWW1w6OZ70RaZPesOzsGS3SxaEg2qCtNA-E2AtG4ohTrNvPwQCt6LIGtxEDp0hZncpVBRjVZ1gZMa1A63_u0IXiwl1gdGZbT5FxwyeUMebVRVGgKkFw.wlXz_VtYcg5p8e9J8i_486jqQQczMiW_ka2xPz62l6M&dib_tag=se&keywords=ir+level+sensor+3&qid=1725347474&sprefix=ir+level+sensor+3%2Caps%2C150&sr=8-20

I havnt gotten around to digging and burrying a permanent line to it yet but, thats the plan. If you lose water to evaporation ike l do and have to frequently drag a garden hose out to refill it then I would suggest something similar to my setup. When I get water run to it, my plan is for the whole thing to automated and maintenance free!

I’m having trouble setting the threshold. When I attach a small breadboard jumper to pin 33, the readings are pretty steady when in water or out of the water so that part works fine. But when I hook it up to the much longer and bigger wire that runs out to my fountain, the numbers vary wildly so it has been impossible so far to find a threshold that works for both situations (wet and dry). With the longer wire, the pin reads between 400 and 600 but hardly changes at all whether in or out of water. But if I touch touch the wire, it varies much less so I CAN set a threshold that works for that situation. Any ideas on how to settle down the fluctuations?

Run a ground wire from the esp down very close to the capitance wire. I recall a youtube video that had 2 bare copper tapes close together but laminated in plastic apart from the very tops. I used the wire in aluminum to prevent rust in the wire developing slowly and affecting the readings over time.

That fixed it! Thanks again for your help! Can’t believe I didn’t think of just attaching the ground wire but it is working as expected now :slight_smile:

Is there a way to get the output to show “Good” or “low” instead of just OFF or ON?