Mocktails only. Mokxi is used by kids, and every recipe in this course is juice and soda water. Real builds use food-safe silicone tubing and pumps sold for drinks, and run the cleaning cycle after every session.
What you build
One circuit carries the whole course. Every lesson opens on the same wiring and changes only the sketch:
- The pumps: four water pumps for lemonade, orange, berry and soda water, each moving about 36 L/h, which is 10 ml a second. Each runs from its own 6 V supply through a relay contact.
- The relays: a four-channel relay board, its inputs on pins 5, 4, 3 and 2. It is active low: LOW pulls a relay in.
- The menu: a 20x4 I2C LCD on A4 and A5, and a keypad with its rows on pins 12 to 9 and its columns on pins 8 to 6.
- The brain: an Arduino Uno.
The diagram leaves out one part a real mixer needs: a 1N4007 diode across each pump, stripe toward +, so the motor's coil cannot spike the relay contact when it opens.
How it works
Pumps and relays. A pump draws far more current than a pin can give, so the pin drives a relay coil and the contact carries the pump current. Relay pins are written HIGH before they become outputs, so no pump twitches on at power-up, and every pump stops itself after 8 seconds whatever the commands say.
Measured pours. A pump moves a steady amount each second, so a pour is a time: seconds = ml / (ml per second). 50 ml at 10 ml/s is 5.0 seconds. Calibration runs a pump for exactly 10 seconds into a measuring jug; 95 ml means 9.5 ml/s for that pump from then on. The sketch never calls delay(): it notes each pump's stop time and keeps looping.
Recipes. A recipe is a struct, a 12-character name and four amounts in ml: 16 bytes. Six of them live in flash with PROGMEM, and memcpy_P() copies one into RAM when it is needed. Every bottle has its own pump, so all four start together and the drink takes as long as its biggest share: a Sunrise, 60 ml lemonade, 60 ml orange and 20 ml berry, takes 6.0 seconds.
The menu. The menu is one number, the recipe on show, and two states, BROWSING and POURING. 8 moves down, 2 moves up and wraps around with (choice + count - 1) % count, # pours, and * stops every pump at once. The LCD is redrawn only when something changes.
Cleaning. With every tube in warm water, each pump runs for 5 seconds, one after another, a step every 6 seconds: about 24 seconds in all, and stop ends it at once. A drink counter asks for a clean after a few drinks.
The course
Build a drink mixer takes six lessons:
- Pumps and relays: active low, the flyback diode, and an 8 second safety limit.
- Measured pours: ml per second, timed pours and calibration.
- Recipes: structs in flash, and every pump at once.
- A menu: an LCD, a keypad, two states and a stop key.
- Cleaning cycle: a state machine that flushes each line in turn.
- Project: a mocktail bar: two glass sizes, a drink counter that asks for a clean after 5, and your own recipes.
Every step but the last is checked against the running circuit.