How does a vending machine deliver a snack?
A coin checker, a small computer, a turning spiral and a light beam work together to hand you a snack.
The big idea: The machine counts your money. If it is enough, a motor turns a spiral once, and that pushes the front snack off the shelf into the tray.
It's like a screw going into wood: each full turn moves it forward one thread. Each turn of the spiral moves every snack forward one space, and the front one tips off.
The interactive parts didn't load. The explanations below still work; try reloading the page.
How a snack gets out
- Theo wants the apple chips. They sit behind glass, held inside a metal spiral. No person is inside the machine, so how does it hand over a snack?
- Each coin rolls past sensors that measure how big it is and what metal it is made of. That tells the machine its value. The display adds it up.
- Theo presses the button for the apple chips. A small computer compares his money with the price. Enough? Then it switches on the motor behind that one spiral.
- Look from the side. A motor at the back turns the spiral one full turn. Every snack between the coils slides forward one space, like a nut moving along a screw.
- The front snack is pushed off the shelf and falls. On the way down it breaks an invisible beam of light. That tells the machine: the snack really dropped.
- Theo lifts the flap and takes his snack. He paid a little too much, so the machine drops his change into the cup. Coin, button, spiral, beam: done!
Look inside a vending machine
The picture on the right shows one shelf from the side. Tap each part to see it work.
- Coin slot and checker. Coins drop in here and roll past sensors that measure their size and metal, so the machine knows what each coin is worth.
- Display. The display shows how much money you have put in, and tells you if you need to add more.
- Selection buttons. Each snack position has a button and a price tag. Pressing a button tells the computer which spiral you chose.
- Controller. A small computer. It adds up the coins, compares them with the price, and switches on the right motor.
- Motor. Every spiral has its own small electric motor at the back. It turns the spiral exactly once for each snack sold.
- Spiral. A wire wound like a spring. Snacks sit between its coils. When it turns, every snack moves forward one space.
- Drop sensor. A beam of invisible light shines across the space where snacks fall. A falling snack blocks it for a moment, so the machine knows the snack arrived.
- Delivery bin. The snack lands in this tray. You push the flap inward to reach it.
Pay, pick and watch the spiral
Tap pretend coins to pay, then tap a snack. Watch the side view. Try once with too little money and once with enough.
Experiment: You put in less money than a snack costs and press its button. What happens?
- Tap one nickel, then tap the pretzels. Read the display.
- Add coins until you have enough and tap the pretzels again.
- Watch the side view: how far does the spiral turn?
What we found: The computer compares your money with the price before anything moves. Too little money: no motor, and the display asks for more. Enough money: the motor turns the spiral exactly once, which pushes exactly one snack over the edge.
Turn on JavaScript to try it yourself.
Exact change, fewest coins
Serve two customers. Pay the exact price with as few pretend coins as you can, then press the snack they want.
How a machine sells a snack
A vending machine is a tiny shop with no shopkeeper. It has to do three things by itself: check your money, find the snack you chose, and hand over exactly one.
First, the money. Each coin rolls past sensors that measure its size and what metal it is made of. Every kind of coin is a little different, so the machine can tell a quarter from a dime, and it sends anything strange back out. A small computer adds up your coins and shows the total.
Next, your choice. When you press a button, the computer looks up that snack's price and compares it with your money. If you have enough, it switches on the motor behind that one spiral.
Last, the delivery. The spiral is a wire wound like a spring, with a snack in each gap. The motor turns it once, and every snack moves forward one space, like a nut moving along a screw. The front snack runs out of shelf and falls. On its way down it breaks a beam of light, which tells the computer that the snack really arrived. Then the machine pays your change. The screw comparison is not perfect: a screw moves itself into the wood, but the spiral stays in place and moves the snacks instead.
Key words
- Credit
- The money you have put in so far that the machine has accepted.
- Helix
- A spiral shape like a spring or the thread of a screw.
- Pitch
- The distance from one coil of a spiral to the next. One full turn moves a snack forward by one pitch.
- Sensor
- A part that notices something, such as a coin's size or a snack falling, and tells the computer.
- Controller
- The small computer that follows the machine's rules step by step.
- Feedback
- Checking the result of an action and using it to decide what to do next.
Check your thinking
-
What moves the snacks toward the front of the shelf?
Show the answer
A spiral turned by a motor. The motor turns the spiral, and each turn moves every snack forward one space.
-
How does the machine tell a quarter from a dime?
Show the answer
Sensors measure each coin's size and metal. Each kind of coin has its own size and metal, and the sensors measure both.
-
You pay too little and press a button. Why does nothing drop?
Show the answer
The computer checks the money first and leaves the motor off. No motor turns until the money is at least the price.
-
What is the beam of light near the tray for?
Show the answer
To check that a snack really fell. The falling snack blocks the beam for a moment. No blocked beam means no snack arrived.
-
A shelf is fitted with a wide-pitch spiral but loaded with thin snack bars. What is likely to go wrong?
Show the answer
Two bars can sit in one gap and drop together. One turn empties one gap. If a gap holds two thin items, both are pushed off the edge.
You're a Money, shops & services expert!
You watched, looked inside, tried it, solved the challenge and went deeper. Pick another question below, or switch the age at the top to see this topic another way.
Keep exploring
Games to play next
- Coin MarketRun a pretend market stall: pay exactly, use the fewest coins, and give the right change.
- Festival PlannerPlace the stalls, book the acts and keep the budget — make every rule true.
- Supermarket StockerRoll out your cart and make every shelf ready for the day.
Guide for grown-ups
- How to start homeschooling: a step-by-step guide for familiesA guide for parents · 7 min read