A vending machine is one of those inventions that we use all the time, yet we don’t really think much about how it works. When you are hungry and want a chocolate bar or a packet of crisps from a vending machine, all you need to do is insert a coin and press the button. Like magic, your selection drops down to the bottom of the machine where you can retrieve it. But how exactly does this work?

vending machines

A vending machine is designed to dispense items when the customer inserts currency (or sometimes credit) into the machine. These types of machines can be used to dispense all different types of items, from beverages to snacks to cigarettes to lottery tickets. They are commonly found in many locations, including offices, waiting rooms, shopping complexes, sports facilities and gyms.

How the Vending Machine Was First Invented

The very first reference to a vending machine was by Hero of Alexandria, who was an engineer and mathematician in the First Century. He described a machine that would accept a coin and then dispense holy water. The coin would fall into a pan which was attached to a lever – which would upon up a valve and let some of the water flow out. As the pan tilted with the weight of the coin, it would eventually fall off and the counterweight would lift the lever back up and stop the flow of water.

Although portable coin-operated machines that dispensed tobacco were used in the early 1600s in the taverns in England, the first fully automatic vending machine was patented by Simon Denham in 1867. The machine dispensed stamps.

How Does it Work?

A vending machine seems like quite a simple invention, but how do today’s modern NJ snack vending machines – with multiple products and different coin denominations – actually work?

The Keypad

It all starts with the keypad, where you enter the code for the specific product that you want to buy. The keypad is not only the main input device for the machine, but is also home to the vending machine’s central computer. When you press “D7” on the keypad, it will tell the central computer which product to dispense.

Making the Payment

When you make a payment for your product, how does the machine know whether you are giving it a tenner or a fiver? When you pay with a bill, the note slides through an optical scanner. The scanner will take a photo of the bill, which will be sent to the main computer of the machine. The machine will look for specific details on the bill to verify its worth and whether or not it is authentic.

If you pay with coins, the machine will recognise the value of the coins based on their size, thickness and diameter. These details are specific to each amount of coin, making it easy for the machine to tell exactly how much money you have given it.

Dispensing the Product

Once you have inserted the money and made your selection, the central computer of the machine will compare the amount you have inserted with the price of the product you have chosen. If it is not enough, the machine will usually remind you to insert more money. If you have inserted more money than your purchase is worth, the change will be refunded afterward in a slot below.

At this point, older vending machines would electronically activate a motor which would spin a metal coil that holds the product. The rotating metal coil would push the product forward, allowing it to fall into the retrieving bin. There are sensors in the retrieving bin, which let the machine know that it has made a successful transaction.

On some new electronic vending machines, especially those which dispense beverages, a motorised arm is used. The arm stretches across the width of the machine and will move to the correct shelf. The drink will be pushed onto it, then the arm will be lowered and the product pushed to the dispensing slot, which is usually on the side of the machine.

The vending machine is an invention with a simple concept, yet with a surprising complexity to its inner workings. Next time you buy yourself a snack from a vending machine, take a moment to think about what is happening inside!

Tim Grimshaw is a freelance writer and blogger. He is interested in science and technology and he is always fascinated by the way that ordinary everyday items work.