Drink Machine

#005 Drink Machine

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.

Design

Pumps / Liquid Storage

Electronics

Unable to load drinkmachine/esp32s2deals.png
ESP32S2 board, 27 GPIOs, 4MB flash, 2MB RAM, WiFi, USB C. for TWO DOLLARS, SHIPPED!
Unable to load drinkmachine/electronics.jpg
The electronics. Pretty clean if you ask me!
The electronics used are as follows:
  • ESP32S2 (LOLIN S2 Mini). See image. This serves a webserver and a websockets server to communicate with the tablet.
  • My grandmas old tablet. I have no idea what it is. But it runs a web browser!
  • Power supply. 5V 10A claimed. Even with a Chinese de-rating of 50% it still does what I need. AliExpress, $6, shipped.
  • Relay board. 8 relays, each with a transistor to allow them to be powered by a 3.3V low current signal. These pumps use about .1A when running, so the relays are overkill. But it was so easy! Amazon.
  • Load Cell Amplifier Board. HX711. Found lying around.
  • 8 cheap pumps. Not food grade. Not continuously rated. Cheap, Amazon!
I should have used a terminal block with a bus bar... but I couldn't find one. Two 1/4-20 bolts into the wood is becoming my go-to cheap way of distributing voltage.

Load Cell

Unable to load drinkmachine/loadcellrear.jpg
The load cell with load cell amplifier.
Unable to load drinkmachine/scale_internals.jpg
Scale internals.

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.

Screen (Tablet)

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. :)

Unable to load drinkmachine/menureal.png
The menu. Beautiful! The red dot means it is not connected to the machine. It fades away when connected.
Unable to load drinkmachine/ingredientseditor.png
Configure the ingredients. (Ugly)
Unable to load drinkmachine/menueditor.png
Configure the drinks. (Ugly)

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.

Use

Dispensing

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.

Cleaning

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.

Go To Top Guess what? I made this website! Check it and many of my other projects on my github.