last updated: 12/20/2023
My friend Greg and I designed and built a drink machine that dispenses precise amounts of up to 8 liquids into a cup. It uses a load cell to measure the weight of the liquid as it is dispensing and an old tablet as a user interface. The concept was initially workshopped by my friend Greg Vanderham and me. But the project ended up being pretty code heavy, more than we anticipated, and because of some timing issues he was only able to contribute to designing and constructing the wood parts.
The drinks are measured as they are poured. I am able to dispense the drinks with considerable accuracy, usually a few grams. A load cell is used to weigh the cup as liquid is poured in. The ESP32S2 reads this value from the HX711 amplifier with a digital protocol.
I might have spent more time on this screen than the hardware. Maybe. I built the application in Svelte (my fav) and installed some plugin that can compile your css js and html into one big html string. Then I copied that string into my MCU program. The compiled HTML is 100K big, so nothing for my 4MB of flash. :)
The application consists of the following flow - drink selection, drink configuration and confirmation, and then live results. All information is sent over a websocket connection, including a screen that shows the amount dispensed live at about 5 Hz.
The ingredients are configured on an ingredients editor screen. You can type in the name of the ingredient and what pump is attached to it. This information is stored in localstorage on the tablet. A similar menu is available for the drinks menu. These menus don't look amazing but aren't intended to be available to the average user.
In the home screen on the tablet the user is presented with options, sorted by whether all of the ingredients needed are in stock. The user clicks on the options and adds or removes ingredients as they wish. You can also adjust the amount of ingredients.
I coded a pump testing screen that allows the user to turn on individual pumps. It sends a request to the websocket server to turn a certain pump on. This allowed me to test the pumps and also to clean them - I used a 250mL 25% rubbing alcohol solution, running that through the pump and tube. Then I ran 500mL of water through each pump which removes the cleaning solution.