I got tired of my espresso machine running out of water unexpectedly. There were two clear options: remember to fill it regularly OR #OverEngineer the problem away! With an #ESP32 and a sonar distance sensor, I now have the water level displayed in #HomeAssistant, and an automatic alert on my phone when it drops before 10%.
I should clarify that it's an ultrasonic sensor (HC-SR04), not "sonar".

The HC-SR04 sensor does not seem to be terribly consistent, so I'm really considering switching to something else. Maybe the VL53L0X infrared sensor. Bonus, it's way smaller too. Anyone have experience with it?

#ESP32 #embedded #hardwarehacking #HomeAutomtion

@jameswynn The machines I've used usually had some dirt cheap contactless sensor that only distiguished between "empty" and "not empty" and allowed the water tank to be removed. E.g., an optical sensor with a prism in the tank, or a floater disc with a magnetic or electric sensor.
@danimrich
That's basically what mine has currently. Really annoying.
@jameswynn Oh, okay. For me, that's usually enough information. Next step up would be a machine that's either plumbed in or fills its tank automatically.
@jameswynn Why do you think it's not β€œsonar”? Because it's in air? Because it's ultrasonic?
@edavies
Technically it's still "sonar" but it's distinct in that it uses an ultrasonic frequency. Though I've heard reports that some people can hear it, so maybe that's not quite accurate either.
@jameswynn OK, though I think sonar includes ultrasonic, as does Wikipedia: β€œThe acoustic frequencies used in sonar systems vary from very low (infrasonic) to extremely high (ultrasonic).”
@edavies
I don't disagree. My phrasing was not the best.
@jameswynn very cool. I am interested in details :-)
@jameswynn I so need to do this! Which sonar distance sensor did you use and how did you power it? Our water jug is inside the machine and not readily accessible πŸ€”
@beyondwatts
Right now it's an HC-SR04 that I stuck to the top of the water reservoir lid. I'm not sure how it will withstand the heat and humidity, but it's a cheap sensor. It took longer to calibrate the custom sensor template in HA than to set up the hardware.
@jameswynn given remembering to check is clearly not working maybe this is the way to go after all
@jameswynn OR add a fixed water supply. πŸ˜‡
@martin_schillig
I've thought about that many times, but it would require either drilling through tile or granite 😬

@jameswynn
On the ONE hand, I'd like to do the same, because, nerd.

On the OTHER hand, my wife and I each have 2 mugs of Decaf Americano every day. Like clockwork. After that, the bugger's nearly empty. So filling the reservoir is the first thing every morning anyway.

@jameswynn i feel you. My attempt was a water resistant one, the SR04M-2. Didn't read the specs so found out the hard way it didn't work. What about the moisture in your setup? Maybe a VL53L0X behind perspex will work
@rutgrrr
That's exactly what I'm considering next. I've heard they don't work well in tight spaces though.
@jameswynn was thinking that maybe it can be done dead simple bij two wires in the watertank that are pulled HIGH by the water and low when the water lowers.
* disclaimer: I clearly did not study electronic engineering πŸ˜‚
@jameswynn and what about https://aliexpress.com/item/1005004309828489.html doesn't give you the level though, just true/false
@rutgrrr
I saw some of those, but I really want a meter so I can tell at a glance if I can pull a shot or need to refill first.
@jameswynn next a tube and a pump....😁
@jameswynn I had the same idea! Sadly my ultrasonic sensors did not like the constant moisture… Did you waterproof it?
@jameswynn Can you share your project? I have a rain water tank I would like to monitor also!
@jameswynn Haha I got the same issue with my machine, that's a nice sophisticated solution 😁 πŸ‘
@jameswynn why not fill the container automatically

@Stellar @jameswynn That was my expectation on reading "OverEngineer".

A selenoid valve with a water level sensor and some flex piping.

@lispi314
Oh I've definitely been thinking about that. I'm just hesitant to drill through my countertop or tile to run the water line.
@Stellar
@jameswynn @Stellar Right, that would be a bit awkward, depending on how one's things are built.
@jameswynn OMG I need to do this πŸ˜†
@jameswynn always overengineer!!! πŸ› οΈ
@jameswynn @unlobito hmmm I wonder how hard it'd be to do something like this for my cat's water recirculator tank, which I regularly forget to refill
@vikxin
It can actually be even simpler if you just want an alert when it gets too low. They're are some capacitive binary sensors that would work really well.
@unlobito
@jameswynn Awesome idea! πŸ‘πŸ»
@jameswynn what? No solenoid controlled auto fill valve? And you call yourself an engineer.
@SkipHuffman
Oh I'm thinking about that. I just haven't found a water line route that doesn't involve drilling through the counters or tile.