MilkMate: Liquid Level Sensor Project

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
ThomasB
Normal user
Posts: 1208
Joined: 17 Jun 2018, 20:41
Location: USA

MilkMate: Liquid Level Sensor Project

#1 Post by ThomasB » 24 Jul 2024, 07:28

I thought I would share a bit about my Milk Level Sensor that is based on ESPEasy. It's built and running, but unfortunately the ending is not a happy one. At least not yet.

BTW, I've briefly mentioned this project in this thread: viewtopic.php?p=70133

The goal was simple: Show the remaining level of refrigerated milk that is locked inside a cabinet that is stored below a coffee machine. The milk is in a one gallon container that frequently needs to be changed. It is used to make hot milk foam on a fully automated EverSys coffee machine. Here is what the machine looks like:

CoffeeMachine2.png
CoffeeMachine2.png (476.7 KiB) Viewed 13027 times

There were some self-imposed rules.
(1) Must be "fool proof." Fools in this case are mostly college educated retirees.
(2) No changes permitted to the equipment, cabinets, and countertops.
(3) Nothing can have direct contact with the milk or other food items.
(4) Materials must be suitable for food contact applications and tolerate alcohol based sanitizing chemicals.
(5) Must be easy to install and/or remove. Simple hand tools allowed.

The finished system is shown below.

System1b.jpg
System1b.jpg (162.35 KiB) Viewed 13027 times

The ESPEasy Hardware is shown below:

ESPEasy1.png
ESPEasy1.png (127.79 KiB) Viewed 13027 times

Some notable things:
▪ A VL53L1X non-contact distance sensor (optical laser) determines liquid level. It measures distance from top of jug downward to milk surface. Math does the rest.
▪ This optical laser is in a plastic assembly that rests on top of the milk container. It touches the container, NOT the milk.
▪ The color display mounts on a cup holder rack next to the machine. It reports 0-100% milk level and its temperature.
▪ A large RGB NEOPixel LED shows status at a glance. Green=Good Milk Level, Yellow=Low Level, Red=Milk Empty
▪ Emails are sent to report status that needs immediate attention.

In the end I was able to check off all the boxes in my "rule" list except #1. The system is not fool proof. Which is a deal killer.

The issue is that the long milk suction tubing (which goes into the top of the milk container) often gets in the view of the optical sensor and disrupts the measurements. And unfortunately it causes the display to report good milk levels, even if the jug is empty.

I could solve the issue by replacing this flexible silicone hose with a stiffer suction tube so it could be directed away from view. But that would violate rule #2; No changes to equipment are permitted.

The suction tube goes though the plastic assembly that holds the sensors. It's made of three pieces, shown below. The big "tongue" seen on the top piece is used to push the milk suction tubing away from the VL53L1X distance sensor. But the tubing has a mind of its own and managing its direction is like controlling a room full of angry cats.

milk_jug_mtg3b.png
milk_jug_mtg3b.png (227.84 KiB) Viewed 13027 times

TL;DR The project is assembled, hardware working, ESPEasy rules written and debugged. Too bad I have to find a solution to make it work for the intended application.

- Thomas

User avatar
ThomasB
Normal user
Posts: 1208
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MilkMate: Liquid Level Sensor Project

#2 Post by ThomasB » 24 Jul 2024, 07:43

P.S. Thanks to TD-er and Ath for providing solutions to some issues I ran into. I appreciate it!

User avatar
Ath
Normal user
Posts: 3845
Joined: 10 Jun 2018, 12:06
Location: NL

Re: MilkMate: Liquid Level Sensor Project

#3 Post by Ath » 24 Jul 2024, 08:25

Thomas,

You have a very well executed and documented project, chapeau!

Unfortunately the tube is working against you for now; as a possible solution you could separate the tube/milk input and the level sensor, and move the sensor into a more fixed position at the back of the container, where it doesn't get obtruded by the tube? It will require to add another (small) opening to the container, so that might be a no-go, or even unfeasible if the complete container is replaced with a fresh one when empty :?
Second suggestion is to direct the sensor angle diagonal to the back-bottom of the container, so the chances of the tube getting in the way are smaller. You'll have to slightly adjust the volume calculation, but that's in capable hands, AFAICS ;)
/Ton (PayPal.me)

TD-er
Core team member
Posts: 9144
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MilkMate: Liquid Level Sensor Project

#4 Post by TD-er » 24 Jul 2024, 08:49

I have not yet looked closely at this exact version of the sensor you use, but maybe we could also do a read-out of several sections of the field-of-view and then not take the closest object, or perform some filtering.
Maybe you could find something in the datasheet to see if there is some indication the sensor is capable of doing so?

User avatar
Ath
Normal user
Posts: 3845
Joined: 10 Jun 2018, 12:06
Location: NL

Re: MilkMate: Liquid Level Sensor Project

#5 Post by Ath » 24 Jul 2024, 08:57

The VL53L1X has settings to narrow its ROI (Region Of Interest), that's planned to be implemented, though I didn't start with that project yet...
/Ton (PayPal.me)

User avatar
ThomasB
Normal user
Posts: 1208
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MilkMate: Liquid Level Sensor Project

#6 Post by ThomasB » 24 Jul 2024, 18:30

I also thought about changing the ROI / Field of View. Probably won't fully solve my dilemma, but could help.

Like TD-er mentioned, what would have been cool is if this sensor had electronic beam steering. But as far as I know that's not supported.

BTW, I spent twenty years in medical ultrasound, so beam steering is something I understand. :)


EDIT:
... unfeasible if the complete container is replaced with a fresh one when empty
That is correct, the entire milk container is changed. And poking a hole in it violates at least one of the "rules."

- Thomas

TD-er
Core team member
Posts: 9144
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MilkMate: Liquid Level Sensor Project

#7 Post by TD-er » 24 Jul 2024, 23:16

Ultrasound beamsteering is slightly different from what this sensor does... or at least what I suspect it does.
If it does indeed look at phase shifts in IR, then I'm extremely impressed.
I think it does just have multiple "pixels" to see in slightly different angles.

Anyway, with your background, I think you can already form some ideas of why I have been working lately in improving time-sync among ESPEasy nodes to get sub-msec jitter :)

User avatar
ThomasB
Normal user
Posts: 1208
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MilkMate: Liquid Level Sensor Project

#8 Post by ThomasB » 25 Jul 2024, 02:40

I think it does just have multiple "pixels" to see in slightly different angles.
According to the application notes, by default it uses the entire 16x16 photo diode array for 27°FOV. That is about 10cm diameter at the bottom of the milk container. But the FOV can be programmed to use as little as a 4x4 region, which narrows it to about 15°. So there is merit in this idea.
I think you can already form some ideas of why I have been working lately in improving time-sync among ESPEasy nodes to get sub-msec jitter
Increase your clock frequency. A lot. And switch to decaf. You're welcome. :)

- Thomas

TD-er
Core team member
Posts: 9144
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MilkMate: Liquid Level Sensor Project

#9 Post by TD-er » 25 Jul 2024, 08:53

Not sure if my clock frequency should be increased...
It is not like my brain will be in 'sleep mode' while waiting for just about anything.
So better not make those waiting periods even longer.

User avatar
chromo23
Normal user
Posts: 838
Joined: 10 Sep 2020, 16:02
Location: germany

Re: MilkMate: Liquid Level Sensor Project

#10 Post by chromo23 » 25 Jul 2024, 08:59

Hey Thomas,

nice project! I once had a similar problem with a flexible silicone hose. I therefore shortened it and attached a stainless steel tube. It violates your rule #2 but only a tiny bit :) And rules are meant to be broken...sometimes.

TD-er
Core team member
Posts: 9144
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MilkMate: Liquid Level Sensor Project

#11 Post by TD-er » 25 Jul 2024, 09:02

Well at least to be "bent a bit".
Quite on-topic in more than one way :)

User avatar
chromo23
Normal user
Posts: 838
Joined: 10 Sep 2020, 16:02
Location: germany

Re: MilkMate: Liquid Level Sensor Project

#12 Post by chromo23 » 25 Jul 2024, 09:30

BTW: Thomas, you are not the first one that is ESPEasyfying a coffeemachine :D

viewtopic.php?p=65029#p65029

bidrohini
Normal user
Posts: 109
Joined: 03 Nov 2022, 16:24

Re: MilkMate: Liquid Level Sensor Project

#13 Post by bidrohini » 25 Jul 2024, 10:45

Hello Mr. Thomas,I have a question. if I use homemade low-cost sensors like this https://www.pcbway.com/project/sharepro ... 69c3d.html
instead of the VL53L1X sensor, how will it effect the performance do you think?

User avatar
ThomasB
Normal user
Posts: 1208
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MilkMate: Liquid Level Sensor Project

#14 Post by ThomasB » 25 Jul 2024, 18:30

I once had a similar problem with a flexible silicone hose. I therefore shortened it and attached a stainless steel tube. It violates your rule #2 but only a tiny bit :)
I agree, a stiff hose would solve it. But I would be hated by the coffee crew. Because inserting it into the container would be difficult due to the cramped space in the little refrigerator.

BTW, any changes to the coffee machine's parts, no matter how simple, would allow the manufacturer's repair tech to blame me for everything that goes wrong. Some of my "rules" are intended to prevent that situation.
BTW: Thomas, you are not the first one that is ESPEasyfying a coffeemachine
Nice. Maybe we should start a club for ESPEasy Coffee Machine Hackers.

BTW, you would have been filled with joy if you got to hack the mechanics on the machine I show in the first post. There are many solenoids, valves, motors, and clicky/blinky things to play with. Here's a top view into the main part, which shows the boiler (right) and bean grinder (left).

The machine's main guts.
The machine's main guts.
Eversys_TopView1.jpg (195.62 KiB) Viewed 12911 times
f I use homemade low-cost sensors like this https://www.pcbway.com/project/sharepro ... 69c3d.html
instead of the VL53L1X sensor, how will it effect the performance do you think?
Sensors like those typically have direct contact with the liquid. Which opens up a whole can of worms in my situation due to food safety issues. Which is the reason I need to use a non-contact method of measuring the milk level.

When I was conceiving this project I initially thought of using a strain gauge and measure the weight (0-3.6 kg) of the milk container. But space in the refrigerator was limited and I worried about the sensor accuracy as ice built up on it. Then the idea of using a laser based sensor took hold. And I got what I asked for, but the results are not exactly what I wanted. I hope to rectify that soon. :)

- Thomas

User avatar
chromo23
Normal user
Posts: 838
Joined: 10 Sep 2020, 16:02
Location: germany

Re: MilkMate: Liquid Level Sensor Project

#15 Post by chromo23 » 25 Jul 2024, 22:01

ThomasB wrote: 25 Jul 2024, 18:30 But I would be hated by the coffee crew. Because inserting it into the container would be difficult due to the cramped space in the little refrigerator.
I see, so my next best recommendation would be something like ptfe tubing. Stiff enough but also flexible. ;)
ThomasB wrote: 25 Jul 2024, 18:30 BTW, you would have been filled with joy if you got to hack the mechanics on the machine I show in the first post.
I definitely would be... :)
ThomasB wrote: 25 Jul 2024, 18:30 There are many solenoids, valves, motors, and clicky/blinky things to play with. Here's a top view into the main part, which shows the boiler (right) and bean grinder (left).
There have to be. Otherwise the high price of these machines would not be justified. :shock:

User avatar
chromo23
Normal user
Posts: 838
Joined: 10 Sep 2020, 16:02
Location: germany

Re: MilkMate: Liquid Level Sensor Project

#16 Post by chromo23 » 25 Jul 2024, 22:04

ThomasB wrote: 25 Jul 2024, 18:30 When I was conceiving this project I initially thought of using a strain gauge and measure the weight (0-3.6 kg) of the milk container. But space in the refrigerator was limited and I worried about the sensor accuracy as ice built up on it.
Another idea would be to put the load cell unter the fridge if possible....

User avatar
chromo23
Normal user
Posts: 838
Joined: 10 Sep 2020, 16:02
Location: germany

Re: MilkMate: Liquid Level Sensor Project

#17 Post by chromo23 » 25 Jul 2024, 22:06

ThomasB wrote: 24 Jul 2024, 07:28 I could solve the issue by replacing this flexible silicone hose with a stiffer suction tube so it could be directed away from view. But that would violate rule #2; No changes to equipment are permitted.
i missed that... so no ptfe tube i guess

User avatar
ThomasB
Normal user
Posts: 1208
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MilkMate: Liquid Level Sensor Project

#18 Post by ThomasB » 25 Jul 2024, 22:23

Another idea would be to put the load cell unter the fridge if possible....
In the planning phase I considered something like that. I looked at digital shipping scales that had a serial port. Prices are low too.

But I eventually decided that the laser distance sensor solution was more elegant and appeared simpler. Got it half right. :)
There have to be. Otherwise the high price of these machines would not be justified.
Crazy high prices! This machine sells for >$20K USD. But it is a coffee brewing miracle. It grinds beans, presses them, adds water and milk foam, and mostly cleans itself. All menu driven, so the user can choose their favorite brew.

- Thomas

User avatar
ThomasB
Normal user
Posts: 1208
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MilkMate: Liquid Level Sensor Project

#19 Post by ThomasB » 26 Jul 2024, 00:26

Based on all the suggestions, and the advice from a magic eight ball, I think I can solve this. Hopefully I won't violate any of the rules, at least not in an obvious way.

Currently playing with a short piece of semi-rigid PE poly tubing that I heat-formed into a gentle "S." With a bit of luck I won't have to modify anything on the coffee machine. Will report back soon.

- Thomas

User avatar
ThomasB
Normal user
Posts: 1208
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MilkMate: Liquid Level Sensor Project

#20 Post by ThomasB » 02 Aug 2024, 06:53

The solution I decided to use requires cutting the coffee machine's milk suction tubing. Not a horrible thing, but it bothers me because this is a modification and that breaks one of my self-imposed rules.

I'm using 6mm clear PTFE tubing that was heat-formed into a "S" curved shape. The milk cap was redesigned to hold it in a fixed position. When the cap is placed on the milk container the suction tubing is forced into a corner, out of the way of the optical sensor's view.

The PTFE tubing's top end will be connected to the long silicone hose that feeds the coffee machine. The bottom end gets a 17cm length of silicone hose terminated in a filter/sinker that lays on the bottom of the milk jug. This section of hose is the piece that will get cut off the existing suction hose.

Redesigned milk cap with PTFE tubing.
Redesigned milk cap with PTFE tubing.
Milk_Jug_Cap3.jpg (247.81 KiB) Viewed 12282 times

The PTFE tubing is semi-flexible and so it's not difficult to insert it into the milk container while everything is still inside the refrigerator's tight quarters.

I haven't installed the MilkMate system on the coffee machine yet. I need to do a demo and earn approval before I can proceed. But I think I can say the project is done. And a success.

- Thomas

User avatar
Ath
Normal user
Posts: 3845
Joined: 10 Jun 2018, 12:06
Location: NL

Re: MilkMate: Liquid Level Sensor Project

#21 Post by Ath » 02 Aug 2024, 08:29

ThomasB wrote: 02 Aug 2024, 06:53 I think I can say the project is done. And a success.
Yay! ;)
/Ton (PayPal.me)

TD-er
Core team member
Posts: 9144
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MilkMate: Liquid Level Sensor Project

#22 Post by TD-er » 03 Aug 2024, 09:40

Maybe you can also write some rules to trigger a warning when the level gradually rises :)

User avatar
ThomasB
Normal user
Posts: 1208
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MilkMate: Liquid Level Sensor Project

#23 Post by ThomasB » 03 Aug 2024, 18:35

Maybe you can also write some rules to trigger a warning when the level gradually rises
Good idea. And maybe there should be an air quality sensor on the milk cap so it can analyze the odor.

Looks like I'm back to the drawing board; Version 2 will fix these missing features.

- Thomas

TD-er
Core team member
Posts: 9144
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MilkMate: Liquid Level Sensor Project

#24 Post by TD-er » 03 Aug 2024, 19:43

Do you want to wait till v2 is ready, or do you want more new suggestions now? ;)

User avatar
ThomasB
Normal user
Posts: 1208
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MilkMate: Liquid Level Sensor Project

#25 Post by ThomasB » 03 Aug 2024, 20:26

You are a brat. :)

TD-er
Core team member
Posts: 9144
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MilkMate: Liquid Level Sensor Project

#26 Post by TD-er » 03 Aug 2024, 20:35

OK, so some more ideas...
You could also wire some current sensing (thus no modifications needed) so you could detect how often it is used.
And some reflective sensor to detect if the stack of cups is low, or change of milk holder so you know how long it has been since last replacement.
Might only need some reflective tape on the milk can.

And maybe adding some presence sensor to turn on some light if needed.

User avatar
Ath
Normal user
Posts: 3845
Joined: 10 Jun 2018, 12:06
Location: NL

Re: MilkMate: Liquid Level Sensor Project

#27 Post by Ath » 03 Aug 2024, 21:17

:lol:

An active mind can be a burden... but also very helpful :?
/Ton (PayPal.me)

User avatar
ThomasB
Normal user
Posts: 1208
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MilkMate: Liquid Level Sensor Project

#28 Post by ThomasB » 03 Aug 2024, 21:53

You could also wire some current sensing (thus no modifications needed) so you could detect how often it is used.
That's a tough one. Because the machine periodically does automated functions that current-wise would look similar to beverage dispensing. For example, boiler heating, hot water flushes, coffee rinses, and other operations.

But I have access to the beverage logs using the front touch display. Went rogue and found the password in order to do that. Because I'm a nerd. And the machine has remote access via its Ethernet port that is currently unused (no nearby jack). One of these days I will get it connected to the network and crack that function so ESPEasy can read its mind. :)
And some reflective sensor to detect if the stack of cups is low,
I like that sort of thing. But it is very low fruit. The rack holds about a week's worth of cups and we (coffee crew) visit the machine several times a day to clean/check it. So cup inventory never gets low.
change of milk holder so you know how long it has been since last replacement. Might only need some reflective tape on the milk can.
No need for another sensor to detect if it was replaced. The MilkMate system has an open door sensor, plus the milk cap has a luminance sensor (along with the distance sensor). So plenty of clues to decide if the carton was changed. I considered adding a rule to email me that the milk was changed, but not interested in knowing that (yet).

Good ideas, thanks for the suggestions. Even if you are trying to be a brat. :D
An active mind can be a burden... but also very helpful
Yes, nerd-people like us seem to be afflicted with that problem.

- Thomas

TD-er
Core team member
Posts: 9144
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MilkMate: Liquid Level Sensor Project

#29 Post by TD-er » 03 Aug 2024, 22:24

A number of years ago, I've done some work for a company (1.5 year on location) which employs lots of nerds in all kinds of degrees of nerdyness (radio-astronomy) and one day the cleaning crew (or maintenance crew) did not properly lock the front of the coffee machine.
There you could see an USB connector and some view of the PCB.

Within a day someone had tried to write a new firmware for the coffee machine, probably trying to add some easter egg.
That didn't go as well as planned, as one of those firmware-upgrades did actually brick the machine (not even the first attempt) and we had to walk to another one further away for at least a week.
And no, it wasn't me... I only heard about it from various people.

TD-er
Core team member
Posts: 9144
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MilkMate: Liquid Level Sensor Project

#30 Post by TD-er » 03 Aug 2024, 22:27

ThomasB wrote: 03 Aug 2024, 21:53 [...]
Good ideas, thanks for the suggestions. Even if you are trying to be a brat. :D
A brat ? ;)

User avatar
ThomasB
Normal user
Posts: 1208
Joined: 17 Jun 2018, 20:41
Location: USA

Re: MilkMate: Liquid Level Sensor Project

#31 Post by ThomasB » 03 Aug 2024, 22:44

:lol: Hee-hee. Yes you were being "a brat." This is not the same as "being brat."

https://www.reddit.com/r/OutOfTheLoop/c ... term_brat/

- Thomas

TD-er
Core team member
Posts: 9144
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MilkMate: Liquid Level Sensor Project

#32 Post by TD-er » 03 Aug 2024, 23:11

I also found this as a description:
"very honest, very blunt, a little bit volatile."
To double-down on this definition;
Sounds like typical Dutch to me :)

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests