This machine sold liquid for coins, but the PLC-based controller it came with could do very little. I took it out, put a small ATmega328 board in its place (an Arduino Pro Mini running at 8 MHz) and wrote new firmware for it, avr_flow.
What the firmware does#
Three coin acceptors add credit, and a running total of coins is saved to EEPROM, so the count survives power cuts. Pressing start switches on the pump. A flow meter sends pulses as liquid goes through, the firmware counts them and turns the pump off once customers get what they paid for, unless somebody presses stop earlier.
While pouring, a 4-digit LED display counts down how much is left to dispense, and a status LED blinks faster and faster as the paid amount runs out. Owners set the price of a token with the buttons, and that value goes to EEPROM as well. There’s also an inactivity timeout and a buzzer.
Before building anything I simulated the display circuit in Proteus; those simulation projects and a photo of the hardware are in the repository too.
A few years later the same kind of machine got a Raspberry Pi successor, the liquid dispenser with a touchscreen.