You might not think of the humble vending machine as a particularly impressive piece of technology, but it turns out there’s some pretty complex engineering that comes into play every time you buy a snack. Ensuring you end up with exactly what you ordered—and don’t cheat the system out of its fifty cents—involves the synchronized work of minuscule motors, tiny cogs, infrared light sensors, electro-magnets, and more.

In “How Do Vending Machines Detect Fake Coins,” Science Channel explains exactly how all of these complex elements work together to identify the value and authenticity of coins. (Bills are a different matter entirely.) The video, which also delves into a few other fascinating facets of vending machine operation, shows how surprisingly sophisticated vending machine technology really is. Check it out above.

[h/t Gizmodo]

Banner Image Credit: iStock