Turning cisco switches into cocktail machines

Watch a video of the build process on youtube

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 smart
b) they do contain pretty beefy power supplies
c) 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 together

Build process in a nutshell

It 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.

Used Tools

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.

The pumps

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.

other electronics:

16 port relay card
12 are in use
the pumps are on 12v, logic runs on 5v, + it gives you a nice 5v output as bonus.

Arduino Nano
basically only starts and stops pumps
gets its commands via i2c

Wemos lolin esp32 lite
runs a static webpage with some ugly javascript
receives commands via web and tells the local nano (or chained system) which pumps to enable

The 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.
some web browser
display the UI
the localStorage is used to have a mapping from ingredient to pump
{p1: 'vodka', p2: 'gin', p3: 'orange_juice', ...}

You 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 juice
pump 6 is connected to tequila
and pump 19 is connected to grenadine

If 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:
[{p3: 45, p4: 45, p14: 45, p15 45, p6: 30},{p19: 5}]

The esp will then build a 'drop' sequence to mix the juice and alcohol.
/* 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]);
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.

Some pictures

At the company party:

Head of QA is QAing.

24 pumps in use

dispensing beauty

Head 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.

Talk to me

IT-Dienstleistungen Sven Tantau
Drostestrasse 3
53819 Neunkirchen
USt-Id-Nr.: DE203610693

email: sven@beastiebytes.com
skype: sven2342
phone: +49 22 47 90 80 250
mobile/signal: +49 157 3131 4424

OTR-Fingerprint: 7849BD93B65F9E4BC1206B06C09B7445721063BC
GPG/PGP-Key: (pub 4096R/069DD13C 2014-02-13) local copy pgp.mit.edu
GPG/PGP-Key: fingerprint: 9BAD 94D3 9176 5BD1 F64F 542E 37E4 3542 069D D13C