Making an Arduino juice vending machine diy project

DIY Arduino Juice Vending Machine | Fun Robotics Project for Kids
Kid-Friendly Robotics Project

🧃 Build Your Own Arduino Juice Vending Machine!

Press a button, pick your flavor, and watch real juice pour into your cup — all controlled by an Arduino, a tiny water pump, and a few push buttons. A perfect mini vending machine for your room or next school fair!

What You'll Build

A mini vending machine that pours juice into a cup when you press a flavor button. An Arduino Uno reads the button presses and turns on a small submersible water pump for a few seconds — just enough to fill a cup — using a relay or transistor to safely control the pump's power.

🎯 Why Kids Love This Robotics Project

This is one of the most exciting Arduino robotics projects for kids because it actually does something useful and tasty! It teaches real-world ideas like input (buttons), output (pumps), and timing (how long to pour) — all while building a machine you can show off and actually use at parties.

Fun Fact: Real vending machines use the exact same basic idea as your juice machine — sensors detect your choice and payment, then a motor or pump delivers your snack or drink!

🧰 Materials You Need

🔌Arduino Uno board
💧1–3 Small submersible pumps (5V)
🔁Relay module (1 per pump) or transistor
🔘Push buttons (1 per flavor)
🧪Plastic bottles for juice
🧰Silicone tubing
🔋5V power supply / USB
📦Cardboard or box for the body

⚠️ Adult Supervision Needed

This project involves electrical wiring near liquids. Always keep wires, the Arduino, and any non-waterproof parts away from spills, and have an adult help with wiring and testing the pumps.

🛠️ Step-by-Step Building Instructions

1

Build the Machine Body

Cut a sturdy cardboard box into a vending machine shape, with a small open shelf at the bottom where the cup will sit, and a front panel for the buttons.

2

Set Up the Juice Bottles

Place each juice bottle upright inside the machine, with one submersible pump sitting inside each bottle, fully covered by juice.

3

Connect the Tubing

Attach a length of silicone tubing to each pump's outlet, running it down to a spout positioned above where the cup will sit.

4

Mount the Buttons

Fix one push button on the front panel for each flavor, labeled clearly (e.g., "Orange," "Berry," "Lemon") so it feels like a real vending machine.

5

Wire the Relays

Connect each pump to its own relay module, which acts as a safe switch the Arduino can control. Wire each relay's control pin to a different Arduino digital pin.

6

Wire the Buttons

Connect each push button to its own Arduino digital input pin, following the circuit diagram below.

7

Upload the Code

Copy the code below into the Arduino IDE and upload it. Each button should now trigger its matching pump for a few seconds.

8

Test with Water First

Before using real juice, test the whole system with plain water to check tubing, timing, and cup placement — then swap in juice once everything works smoothly!

🔌 Circuit Diagram

Layout (shown for one flavor — repeat per pump):

        ARDUINO UNO                 RELAY MODULE
        ┌───────────────┐          ┌─────────────┐
        │  5V  ●─────────┼──────────┤ VCC         │
        │  GND ●─────────┼──────────┤ GND         │
        │ Pin 7●─────────┼──────────┤ IN          │
        │              │          │ COM ●────┬───┼── External 5V (+)
        │              │          │ NO  ●────┼───┼── Pump (+)
        └───────────────┘          └──────────┼───┴── Pump (-) ── External GND
                                                │
        BUTTON: Pin 2 ──[Button]── GND (using INPUT_PULLUP)
      
ComponentWireArduino Pin
Flavor 1 ButtonOne legPin 2 (other leg to GND)
Flavor 2 ButtonOne legPin 3 (other leg to GND)
Flavor 3 ButtonOne legPin 4 (other leg to GND)
Relay 1 (Pump 1)IN signalPin 7
Relay 2 (Pump 2)IN signalPin 8
Relay 3 (Pump 3)IN signalPin 9

Tip: Power the pumps from a separate 5V supply (not directly from the Arduino), and only let the relay switch that external power — this keeps your Arduino safe from pump power spikes.

💻 Arduino Code

juice_vending_machine.ino
// ---- Pin Setup ----
const int buttonPins[3] = {2, 3, 4};   // Orange, Berry, Lemon
const int relayPins[3]  = {7, 8, 9};   // Matching pumps

const unsigned long pourTime = 3000;   // 3 seconds per cup (adjust to taste!)

void setup() {
  for (int i = 0; i < 3; i++) {
    pinMode(buttonPins[i], INPUT_PULLUP);  // button connects pin to GND when pressed
    pinMode(relayPins[i], OUTPUT);
    digitalWrite(relayPins[i], LOW);       // make sure pumps start OFF
  }
  Serial.begin(9600);
  Serial.println("Juice machine ready! Pick a flavor.");
}

void pourFlavor(int index, String name) {
  Serial.print("Pouring: ");
  Serial.println(name);

  digitalWrite(relayPins[index], HIGH);  // turn pump ON
  delay(pourTime);
  digitalWrite(relayPins[index], LOW);   // turn pump OFF

  Serial.println("Enjoy your juice!");
}

void loop() {
  if (digitalRead(buttonPins[0]) == LOW) {
    pourFlavor(0, "Orange");
    delay(1000); // tiny pause to avoid double-presses
  }
  if (digitalRead(buttonPins[1]) == LOW) {
    pourFlavor(1, "Berry");
    delay(1000);
  }
  if (digitalRead(buttonPins[2]) == LOW) {
    pourFlavor(2, "Lemon");
    delay(1000);
  }
}
How it works: Each button press tells the Arduino which pump to switch on through its relay. The Arduino keeps the pump running for exactly 3 seconds (the pourTime), then switches it off — pouring just the right amount of juice every time!

🌟 Tips for a Better Juice Machine

  • Start with water tests to find the perfect pourTime for a full cup without overflowing.
  • Use a drip tray under the spouts to catch any extra drops and keep things tidy.
  • Label each button with the flavor name and a fun sticker or drawing.
  • Clean the tubing and pumps regularly if using real juice, since sugary drinks can get sticky.
  • Add a "Thank You!" message on a small LCD or just print it to the Serial Monitor for now.

❓ Frequently Asked Questions

Do I need to know how to code to build this?

No! The code above is ready to copy and upload. You can adjust the pourTime value to change how much juice is poured.

Can I add more flavors?

Yes! Just add more entries to the buttonPins and relayPins arrays and connect more buttons, relays, and pumps following the same pattern.

Is it safe to use real juice with electronics nearby?

With careful wiring, keeping electronics away from spills, and adult supervision, this project is safe — but always test with water first and never let liquid touch the Arduino or relays.

What age group is this project good for?

With an adult's help for wiring and testing, kids aged 10 and up can enjoy building and using this fun vending machine.

🏆 You Did It!

You just built a real working juice vending machine! Try adding an LCD screen to show flavor names, a coin slot for pretend payments, or even a cup sensor so it only pours when a cup is in place.

Made with 🧃 juice, code, and curiosity — Happy Building!

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
Young inventors love it!
🖨️
3D Print
All parts
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course