Cutaway video of a vending machine in action
Look at this cutaway video (CGI) of a typical vending machine. The video explains how it sorts coins, detects fake money, and also uses infrared beams to make sure your food falls down each time you input an order. I had no idea infrared beams were there. Cool, I guess. This just makes me want to go to Japan -- land of vending machines!