



Turning cisco switches into cocktail machines





Build process in a nutshell

Used Tools

The pumps

other electronics:

16 port relay card

Arduino Nano

Wemos lolin esp32 lite

some web browser

{p1: 'vodka', p2: 'gin', p3: 'orange_juice', ...}

[{p3: 45, p4: 45, p14: 45, p15 45, p6: 30},{p19: 5}]

/* fill an array of given size 'evenly' with values */ void get_sequence(unsigned int result[],int boxes, int cats){ float cats_per_box = (float)cats / boxes; int index = 0; float stored_cats = 0; int full_cats = 0; while (index < boxes) { stored_cats += cats_per_box; int schroedinger_cat = (int) round(stored_cats - full_cats); full_cats += schroedinger_cat; result[index++] = schroedinger_cat; } } // gets called like this in the code: ... /* evenly distribute the ml per max_ml this leads to mixing the liquids as good as possible */ for(int i = 0; i < max_pump; i++){ get_sequence(pump_commands[i], max_ml, data[i]); } ...

Some pictures

I currently do have two transformed switches in use. With a total of 24 pumps.Cisco switches because:a) needed to justify to Judith that having them around is smartb) they do contain pretty beefy power suppliesc) they can each fit 12 pumps + electronics and have 24 ports, 12 for 'in' and 12 for 'out'd) I liked the idea of building units that you can chain togetherIt took me a few weekends to hack the first version together.To build the second unit was a bit faster. I estimate a total of 100 hours build+coding time spread over 2 years.I used the cisco power supply to power the 12 pumps and the relay card with 12 volt. The relay card does provide a 5 volt output to power the arduino nano and the esp32 board (wemos lolin lite).The pumps are wired to the relay card. The nano controls the relay card with its 5 volt outputs.The esp32 provides a webserver and controls the nano via i2c (an 5v to 3v logic converter is in between).I was a bit in a hurry, so I never tested if the esp32 board could switch the relays with its 3 volt output.In hinsight I guess I should test for that. During that time I was keen to wire later versions together on an i2c bus; by now I have my two units communicating via wlan, but that i2c bus stayed and might be used later to control an automatic lazy susan or other external devices.Software is pretty simple: The nano just listens on i2c on which pins to set high/low. Pretty universal to use for all kinds of on/off operations via i2c. The esp32 runs a small webserver that serves up a website with some questionable javascript and is ready to take and process 'recipes' that the javascrip generates.Just a normal multimeter and 10 bucks soldering iron.A CR-10 3d printer to print mounting brackets and the new 'ports' for the switches.When I had some initial trouble with the i2c bus, I learned why people would want to have an oscilloscope. (Other than that they just look cool.) I hope for some other problem that would justify me getting one.I have two boxes with each 12 pumps.24 pumps may sound a lot, but is required to have fun.One pump in itself is pretty slow. They can deliver roughly 1ml per second.So running them in parallel (set 4 pumps to run orange juice) is required to have a decent experience.I was pretty amazed by those cheap peristaltic pumps. They just squeeze the tubes to transport the liquid, so only food grade tubing is required to build something that won't kill your friends.It makes it easy to clean and also easy to explain why it is clean.My biggest surprise was how accurate those pumps are for my use. I can mix you a cocktail into a 40ml double shot glass.The code does contain an array called: pump_factors, but all are set to 1 as I found no noticeable difference between them.12 are in usethe pumps are on 12v, logic runs on 5v, + it gives you a nice 5v output as bonus.basically only starts and stops pumpsgets its commands via i2cruns a static webpage with some ugly javascriptreceives commands via web and tells the local nano (or chained system) which pumps to enableThe esp32 board runs on 3 volt logic and the nano takes 5 volt. So a converter was used to run the i2c bus on 5 volt.display the UIthe localStorage is used to have a mapping from ingredient to pumpYou store in the browser which pumps are connected to which liquid. You make this mapping at the start of your party.Then some default cocktails will appear based on the available ingredients.You can add more recipes and store them in your local storage.When you order a tequila sunrise, your browser knows:pump 3,4,14,15 are connected to orange juicepump 6 is connected to tequilaand pump 19 is connected to grenadineIf you want 180ml orange juice mixed with 30ml tequila and as a finish 5ml grenadine on top, then the browser would tell the esp basically this:The esp will then build a 'drop' sequence to mix the juice and alcohol.You would observe a constant flow of orange juice running, with a drop of tequila getting added every now and then.As you can have multipe of those sequences after each other, the 5ml finishing drop of grenadine is possible.The esp does the mixing and then tells the nano(s) which pumps to start or to stop.At the company party:Head of QA is QAing.24 pumps in usedispensing beautyHead of engagement is engaged.Sales department did send representative for testing.In action at the Cccamp2019. Attracting a real cyborg.Both units, still a bit camp dust on top.My first cocktail mixer, stuffed into a book and an whiskey casing.Hope you found all that somehow funny. Thanks for your attention.