The machine dispensed liquid for coins, but its PLC-based controller could do very little. I replaced it with a small ATmega328 board (an Arduino Pro Mini at 8 MHz) and wrote new firmware, avr_flow.
What the firmware does#
Three coin acceptors add credit, and a running total of coins is kept in EEPROM, so it survives power cuts. Start switches on the pump. A flow meter sends pulses for the liquid, the firmware counts them and stops the pump when the paid amount is delivered. A stop button ends it early.
A 4-digit LED display counts down what is left to pour. The status LED blinks faster as the paid amount runs out. The price per token is set with the buttons and stored in EEPROM. An inactivity timeout and a buzzer finish the job.
I simulated the display circuit first in Proteus. The repository keeps those projects and a photo of the hardware.
A few years later the same kind of machine got a Raspberry Pi successor: the liquid dispenser with a touchscreen.