At Bright Signals we were recently commissioned by a client to create a prototype vending machine, incorporating touchscreen product selection and NFC-based payment tokens.
The starting point for the machine was to be a late 90s-era Vendo vending machine which had seen better days. The machine had served over 15,000 cans over its career, but its heavy-duty vending mechanism was still in great shape.
Thanks to a clever series of shafts, pivots and swing-arms, the machine can vend four can positions per column (left and right side, both front and back) from a single AC motor.
The electronics side of things was a bigger challenge. The machine still had its main circuit board, but was missing the sub-board that would accept coins or place the machine into free vend, so there was no way to test if it worked fully.
As the goal of the project was to accept NFC tokens as payment, I decided to completely ditch the electronics and replace them with a Raspberry Pi and some relays.
First step was to understand the mechanism: The machine has five vending columns, each of which is designed to store and vend cans or bottles in a zig-zag pattern left, right, left, right, etc. For bottles, the machine would simply alternate left and right, but for cans the machine could double its capacity by storing cans two-deep; serving left front, left back, right front, right back, etc.
Whether a column is in can or bottle mode is determined by a movable ‘blanking disc’ on the motor wheel: with the disc open, the motor wheel has four stop positions, but with it closed it has only two. A microswitch detects when the wheel hits a stop position, with a second microswitch detecting when the column is empty.
I wired the ten microswitches to the Pi’s GPIO, with another five pins being dedicated to a set of relays to control the motors. The motors themselves required 24V AC, which was a bit of a concern until I found that the main PSU within the vending machine had a dedicated 24VAC output.
With everything wired up, I wrote a Python script to switch the motor on whenever requested by the front-end, and off again when the relevant microswitch flipped open. A simple bit of inventory control allowed the script to automatically move on to the next column with the same product when one was empty.
Fortunately, it all worked pretty well first time, allowing me to hand the touchscreen build over to my colleague, Jack, while I took a quick family break.
Jack did wonder with the front end (as he always does), so all that was left was for me to hook up the NFC reader and build a new plywood door to house the touchscreen and replace the ageing tube-lit acrylic front.
With the (usual) tight deadline, I worked through the night to complete and paint the machine before it went off for vinyl wrapping the next morning.
I’m really pleased with the end result — the machine looks great and works really well. Best of all, it fits in perfectly next to the off-the-shelf NFC draught beer vending machine they already have.