This is the software for a self-service dispenser of windscreen-washer fluid, in a summer and a winter version, where customers pay with coins or a payment terminal, press start, and the machine pumps the amount they paid for. It runs on a Raspberry Pi with a 1024×600 touchscreen and is the successor of my ATmega-based avr_flow.
How it works#
Everything goes through GPIO: three coin acceptors, a card-terminal input, a flow-meter input counted on rising edges, two pump outputs, a status LED and the service buttons (enter, up, down, cancel, start). Because the flow meter gives a fixed number of pulses per litre, the controller is able to tell exactly how many litres have been pumped and to stop at the paid amount.
In the service menu you set pulses per litre (for calibration), price per litre and product type with the buttons, and reset the counters there too. Money taken and litres dispensed are saved to disk, in total and since the last reset, to survive restarts. Customers see a full-screen tkinter interface with the credit and the dispensed amount, and the controller also publishes its state over a local WebSocket.
The machine has to be able to run unattended: supervisord keeps the program alive, the Pi boots into a read-only kiosk mode, and the GPIO pins get their initial states already at boot through the device tree, before the program starts.