↓ Skip to main content
  1. Home projects/

avr_flow: a new brain for a liquid vending machine

··
Table of Contents

The machine dispensed liquid for coins, but its original PLC-based controller could do very little. avr_flow replaced it with a small ATmega328 board (an Arduino Pro Mini at 8 MHz) and new firmware.

What the firmware does
#

  • Coins. Three coin acceptors are read through pin-change interrupts. Each coin adds credit, and a running total of coins is kept in EEPROM, so it survives power cuts.
  • Dispensing. Start switches on the pump. A flow meter sends pulses for every bit of liquid, and the firmware counts them in an interrupt and stops the pump when the paid amount has been delivered. A stop button ends it early.
  • Display. A 4-digit, 7-segment LED display is driven through 74HC595 shift registers and multiplexed from a TimerOne interrupt, so it never flickers while the main loop works.
  • Settings. The price per token is set with the buttons, with auto-repeat on a long press, and stored in EEPROM.
  • Feedback. The display counts down what is left to pour, and the status LED blinks faster as the paid amount runs out (past 75% and 85%). An inactivity timeout and a buzzer complete it.

The display circuit was first simulated in Proteus, and the repository keeps those simulation 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.

Source on GitHub.