Build a Coin-Operated Mini Pizza Vending Machine!
Meet Sliceo — a friendly Arduino robot that opens its door, spins its pizza tray, and pops out a slice the moment you drop in a coin. Follow our easy step-by-step guide, circuit diagram, and code to build your own!
🪙 Say hi to Sliceo, your pizza vending robot!
What Is a Pizza Vending Robot, Anyway?
A vending machine is a robot that waits for a signal (like a coin!) and then performs a series of automatic actions. In this project, our Arduino brain will detect a dropped coin, then command four servo motors to open a door, spin a pizza tray to the next slice, push the slice out, and close everything back up.
This project is a fantastic way to learn sequencing — teaching a robot to do several things, one after another, in exactly the right order.
What You'll Need
Gather these parts before you start building!
Arduino Uno
The brain that runs the whole vending sequence.
SG90 Micro Servo Motors
Door, tray rotation, slice pusher, and a coin gate.
IR Break-Beam Sensor
Detects when a coin drops through the slot.
Breadboard
For connecting everything without soldering.
Small Cardboard Box
The vending machine's body/cabinet.
Round Cardboard Disc
The rotating pizza tray, mounted on Servo 2.
4x AA Battery Pack
Powers the servos once unplugged from USB.
Jumper Wires
Male-to-male and male-to-female.
The Circuit Diagram
Here's how Sliceo's four servos and coin sensor connect to the Arduino.
Step-by-Step Build Instructions
Ask an adult to help with cutting cardboard and wiring the sensor. Let's build Sliceo!
Build the cabinet
Cut a small window in the front of your cardboard box for the door, and cut a coin slot near the top that leads down to the IR sensor.
Mount the coin gate and sensor
Place Servo 4 just under the coin slot as a tiny gate that only opens once the coin is detected. Mount the IR break-beam sensor right below it, so the coin breaks the beam as it falls.
💡 Tip: Test the sensor alone first — open the Serial Monitor and check it prints "Coin detected!" when a coin passes.Attach the door servo
Mount Servo 1 beside the window opening with a small cardboard flap glued to its horn. When it rotates, the flap should swing open like a real door.
Build the rotating pizza tray
Glue the round cardboard disc flat on top of Servo 2's horn, mounted inside the cabinet. Draw slice sections on the disc and place a paper pizza slice in each one.
Add the slice pusher
Mount Servo 3 behind the tray with a small arm on its horn. When it swings, the arm should nudge the front slice out through the open door.
Wire everything and test
Connect all four servos and the IR sensor as shown in the diagram. Upload the code, switch to battery power, drop in a coin, and watch the whole sequence run!
The Arduino Code
Copy this into the Arduino IDE and click Upload. It waits for a coin, then runs the whole vending sequence automatically.
// 🍕🤖 Sliceo the Pizza Vending Robot — Arduino Servo Project // Uses 4 servos: coin gate, door, rotating tray, and slice pusher #include <Servo.h> Servo doorServo; // opens/closes the front door Servo trayServo; // rotates the pizza tray Servo pusherServo; // pushes the slice out Servo coinGate; // lets the coin drop through const int irSensorPin = 2; // coin sensor input int sliceCount = 0; // tracks which slice is next void setup() { doorServo.attach(9); trayServo.attach(10); pusherServo.attach(11); coinGate.attach(6); pinMode(irSensorPin, INPUT); // resting positions doorServo.write(0); pusherServo.write(0); coinGate.

Comments
Post a Comment