Vending machines are like mechanical genies. Put money in and whatever you want — candy bars, soft drinks, DVDs, cigarettes — pops out. To those of us feeding money in, the machines' ability to tell a $5 bill from a $1 bill and give back change might seem uncanny, but it's based on simple, effective technology.

Tip

Vending machines gauge the size and metal of coins to determine if they're dimes, nickels, quarters or a slug trying to fake the machine out. The machines use a digital camera to scan and identify bills by key features.

Vending Machine History

Heron of Alexandria created the first known vending machine in the 1st century A.D. Frustrated with churchgoers using too much holy water, he designed a machine that dispensed the liquid when a token tossed inside pressed down on a lever, opening the spigot. When the token inevitably fell off the lever, the flow ceased.

This idea faded from history until the 1880s when postcard-dispensing vending machines were introduced in England. Gum-dispensing vending machines popped up in New York in 1888. Today's machines are far more sophisticated technologically, but they still operate on the same principle as Heron's invention: You put something in the machine to get something out.

The vending machines of the 19th century required exact change before they'd give you your purchase. Today's currency-detector vending machine can read the exact amount of money and make change.

Currency-Detector Vending Machine

A currency-detector vending machine can distinguish a dime from a quarter or a $10 bill from a buck. Of the two, coins are the easier to handle because a dime, a quarter and a nickel aren't physically alike. A quarter is 0.955 inches across and 0.069 inches thick with 119 edge ridges; a dime is 0.705 inches across and 0.053 inches thick with 118 ridges.

When you put a coin in the slot, the vending machine uses light sensors to get a feel for the size and electromagnetic sensors to measure the type of metal. When the coin sensor is working, the machine knows the difference between three quarters and three nickels. The sensors can also tell the difference between a quarter and a fake that's roughly quarter-shaped.

Reading Paper Money

In the 1960s, magnetism in vending machines made it possible to start accepting bills. Ink has iron in it. Magnetic scanners checked the amount in the ink, which enabled them to identify the bills. Counterfeiters got around this by using magnetic ink to make phony bills that read as real.

The currency-detector vending machine became more sophisticated at reading bills starting in the 1990s.

  • Internal lights illuminate the bill, allowing a digital camera to scan it and look for specific patterns unique to each bill. 

  • Vending machines detect an infrared strip incorporated into modern U.S. bills, something that isn't present in counterfeits.

  • Bills above $2 have a thin thread of mylar woven into them, which is visible in ultraviolet light. Vending machines also look for the mylar. 

  • Top-of-the-line machines can detect the image and the magnetic ink to confirm it's the right sort of paper used by the U.S. mint.

When Good Detectors Go Bad

Almost everyone's had the experience of putting a bill into a vending machine and having it spat back out. There are multiple reasons for this.

  • Crumpled bills distort the pattern, making it impossible for the machine to read it as real.

  • Money picks up a lot of dirt as it travels around, and the dirt rubs off inside the vending machine. After a certain point, the detector is too dirty to scan the bills properly.

  • If the machine accepts $10 bills but doesn't have change, it won't take the bill.

  • Vending machines wear out. If the belt that carries the bills to the scanner breaks, it's not going to take your money.