How does a vending machine know that the coin you inserted is the correct value and not a slug?

Vending machines are equipped with a coin testing device that not only measures the diameter and thickness of your coin, but checks its weight, alloy composition, and magnetic properties.

The coin enters a slot, which has been carefully measured to accommodate the required coin or coins, and rolls down a chute to two hook shaped balance arms.

A coin of the correct weight presses the right arm sufficiently to move a counterweight on the left; displacement of the arm allows the coin to pass.

The diameter of the coin is also checked at this point, too small coins slip from the hooks to the coin return receptacle. Those that are too large get stuck. When the coin return button is pushed, a side flap opens, allowing the coin to fall into the return receptacle.

A coin of the proper size and weight continues through the machine past a strong magnetic field. If the iron content of the coin is high, for example, the magnet catches it. The coin return button triggers a wiper that sweeps the coin away from the magnet. The speed of the coin as it moves through the machine is thus dependent on composition and on mass.

The speed it accumulates must be sufficient to allow the coin to jump over a rejector pin and down an outlet leading to the release mechanism, which in turn allows the vending machine to deliver the desired product.