Build a Reverse Vending Machine That Rewards You for Recycling!
Drop in a plastic bottle or can — earn points instantly! A super fun Arduino project that helps save the planet 🌍
♻️ What is a Reverse Vending Machine?
A normal vending machine gives you stuff when you put in money. A Reverse Vending Machine (RVM) works the opposite way — you put in empty bottles or cans, and it gives you points!
🌟 Real World Example
Countries like Sweden, Norway and Germany have giant RVMs in supermarkets. People return millions of plastic bottles every day and earn money back! Our project is a mini version you can build at home or school.
Drop Bottle In
Insert an empty plastic bottle or aluminium can
Sensor Detects
IR sensor spots the object dropping inside
Arduino Thinks
The brain counts it and adds points
Points Appear!
LCD screen shows your updated score
Buzzer Celebrates
A happy beep confirms your reward
🔬 How Does It Actually Work?
Our machine uses three main ideas from robotics and electronics:
💡 Infrared Sensing
An IR (Infrared) sensor sends out invisible light. When a bottle breaks that beam, the sensor signals the Arduino — just like how automatic doors know you're there!
🧮 Counting Logic
The Arduino code keeps track of every item dropped in. It's like a calculator that never forgets — it adds points every single time.
📺 LCD Display
A 16×2 LCD screen shows your total points in real time — like a scoreboard in a video game, always updating!
🛒 Parts You Need
Everything below is available at your local electronics shop or online on Robocraze, Robu.in, or Amazon India. 🇮🇳
Arduino Uno
The brain of the machine
~₹40016×2 LCD Display
Shows your points
~₹120IR Sensor Module
Detects bottles (x2)
~₹605V Buzzer
Plays a reward beep
~₹30LED (Green + Red)
Status lights (x2 each)
~₹20I2C Module for LCD
Saves Arduino pins
~₹80220Ω Resistors
Protect LEDs (x4)
~₹10Breadboard + Wires
Connect everything
~₹80Cardboard Box
Large shoebox or cereal box
Free!Pro Tip: Get a starter kit! Kits like the "Arduino Uno Starter Kit" often include the breadboard, LEDs, resistors, buzzer and wires all in one box — saves money and time.
⚡ Circuit Connections
This is how to connect all the parts. Go slowly — double-check each wire before adding the next one! Wrong connections can damage parts. Always unplug USB before wiring.
| Component | Component Pin | Arduino Pin | Wire Colour |
|---|---|---|---|
| IR Sensor #1 | VCC | 5V | 🔴 Red |
| IR Sensor #1 | GND | GND | ⚫ Black |
| IR Sensor #1 | OUT | D2 | 🟢 Green |
| IR Sensor #2 | VCC | 5V | 🔴 Red |
| IR Sensor #2 | GND | GND | ⚫ Black |
| IR Sensor #2 | OUT | D3 | 🟡 Yellow |
| LCD (I2C Module) | VCC | 5V | 🔴 Red |
| LCD (I2C Module) | GND | GND | ⚫ Black |
| LCD (I2C Module) | SDA | A4 | 🔵 Blue |
| LCD (I2C Module) | SCL | A5 | 🟠 Orange |
| Green LED | Anode (+) | D9 → 220Ω → LED | 🟢 Green |
| Green LED | Cathode (−) | GND | ⚫ Black |
| Red LED | Anode (+) | D10 → 220Ω → LED | 🔴 Red |
| Red LED | Cathode (−) | GND | ⚫ Black |
| Buzzer | + (Positive) | D11 | 🔴 Red |
| Buzzer | − (Negative) | GND | ⚫ Black |
[IR SENSOR 1] [IR SENSOR 2] [LCD Display - I2C]
VCC ──── 5V VCC ──── 5V VCC ──── 5V
GND ──── GND GND ──── GND GND ──── GND
OUT ──── D2 OUT ──── D3 SDA ──── A4
SCL ──── A5
┌──────────────────────────────┐
│ ARDUINO UNO │
│ │
│ D2 D3 D9 D10 D11 A4 A5│
│ │ │ │ │ │ │ │ │
└───┼───┼───┼───┼────┼───┼──┼─┘
│ │ │ │ │ │ └─── LCD SCL
│ │ │ │ │ └────── LCD SDA
│ │ │ │ └────────── BUZZER +
│ │ │ └─────────────── 220Ω → RED LED
│ │ └─────────────────── 220Ω → GREEN LED
│ └─────────────────────── IR Sensor #2 OUT
└─────────────────────────── IR Sensor #1 OUT
All GNDs connect to Arduino GND rail
All VCCs connect to Arduino 5V rail
🔨 Step-by-Step Build Guide
🗃️ Prepare the Box
Take a large cardboard box (a cereal box or shoebox works great). Cut a rectangular slot at the top — big enough for a plastic bottle to slide in (about 8cm × 8cm). This is the "deposit slot" where people insert their waste.
Ask an adult to help cut the cardboard! Use a box cutter safely — never point it at yourself.
📡 Mount the IR Sensors
Glue or tape the two IR sensors on opposite sides inside the slot — one on each wall, facing each other. Sensor 1 sends the IR beam, Sensor 2 receives it. When a bottle passes through, it blocks the beam!
Keep them at the same height and exactly facing each other for reliable detection.
📺 Attach the LCD Screen
Cut a small rectangle window on the front of the box. Glue the LCD screen behind it so you can see the display from outside. This is where your points will show up!
💡 Add LEDs and Buzzer
Poke small holes in the front of the box. Push the green LED through one hole (success light) and the red LED through another (stand-by / full light). Place the buzzer anywhere inside — sound travels through cardboard!
🔌 Wire Everything
Place the Arduino Uno and breadboard inside the box. Follow the wiring table above. Take your time — wrong connections are the most common mistake. Use the wire colour guide to stay organised.
Use actual coloured wires (red for power, black for ground, others for signals). It makes debugging 10× easier!
💻 Upload the Code
Connect the Arduino to your computer with the USB cable. Open Arduino IDE, install the "LiquidCrystal_I2C" library (Sketch → Include Library → Manage Libraries), paste the code below, and click Upload!
🧪 Test It!
Drop an empty bottle through the slot. If you hear a beep, see the green LED flash and the points go up — you've built it correctly! 🎉 Celebrate!
💻 Arduino Code
Copy this code exactly into Arduino IDE. We've added comments (the // lines) to explain what each part does so you can learn from it!
📦 Library to Install First
In Arduino IDE: go to Sketch → Include Library → Manage Libraries, then search for "LiquidCrystal I2C" by Frank de Brabander and click Install.
// ============================================ // REVERSE VENDING MACHINE // DIY Robotics Project for Kids! 🤖♻️ // Awards points for recycling waste // ============================================ #include <Wire.h> #include <LiquidCrystal_I2C.h> // --- Set up the LCD (I2C address 0x27, 16 cols, 2 rows) --- LiquidCrystal_I2C lcd(0x27, 16, 2); // --- Pin Numbers --- const int IR_PIN_1 = 2; // First IR sensor const int IR_PIN_2 = 3; // Second IR sensor const int GREEN_LED = 9; // Green success LED const int RED_LED = 10; // Red standby LED const int BUZZER_PIN = 11; // Buzzer // --- Points and Counting Variables --- int totalPoints = 0; // Starts at 0, grows! int bottleCount = 0; // Total items inserted int POINTS_PER_ITEM = 10; // Change this number to adjust rewards // --- Timing to avoid counting same bottle twice --- unsigned long lastDetectTime = 0; const unsigned long COOLDOWN_MS = 1500; // 1.5 second gap between detects bool isReadyForNext = true; // ============================================ // SETUP — runs once when Arduino starts // ============================================ void setup() { // Set pin modes pinMode(IR_PIN_1, INPUT); pinMode(IR_PIN_2, INPUT); pinMode(GREEN_LED, OUTPUT); pinMode(RED_LED, OUTPUT); pinMode(BUZZER_PIN, OUTPUT); // Start the LCD lcd.init(); lcd.backlight(); // Start Serial for debugging Serial.begin(9600); // Show welcome message showWelcomeScreen(); // Red LED on = Ready and waiting digitalWrite(RED_LED, HIGH); } // ============================================ // LOOP — runs over and over forever // ============================================ void loop() { int sensor1 = digitalRead(IR_PIN_1); int sensor2 = digitalRead(IR_PIN_2); unsigned long now = millis(); // Detect if EITHER sensor is triggered (object detected = LOW signal) bool objectDetected = (sensor1 == LOW || sensor2 == LOW); // Only count if cooldown time has passed (prevents double-counting) if (objectDetected && (now - lastDetectTime > COOLDOWN_MS)) { lastDetectTime = now; rewardPoints(); } } // ============================================ // REWARD FUNCTION — adds points + celebrates! // ============================================ void rewardPoints() { bottleCount++; totalPoints += POINTS_PER_ITEM; Serial.print("Item #"); Serial.print(bottleCount); Serial.print(" | Points: "); Serial.println(totalPoints); // Flash green LED 3 times digitalWrite(RED_LED, LOW); for (int i = 0; i < 3; i++) { digitalWrite(GREEN_LED, HIGH); delay(150); digitalWrite(GREEN_LED, LOW); delay(100); } // Play happy reward tune 🎵 tone(BUZZER_PIN, 1000, 100); delay(150); tone(BUZZER_PIN, 1500, 100); delay(150); tone(BUZZER_PIN, 2000, 200); delay(250); // Show updated score on LCD updateDisplay(); // Animate +10 message lcd.setCursor(0, 1); lcd.print(" +10 POINTS! "); delay(1500); // Return to score display updateDisplay(); digitalWrite(RED_LED, HIGH); } // Updates the main score display void updateDisplay() { lcd.clear(); lcd.setCursor(0, 0); lcd.print("PTS: "); lcd.print(totalPoints); lcd.setCursor(0, 1); lcd.print("Items: "); lcd.print(bottleCount); } // Shows welcome message on startup void showWelcomeScreen() { lcd.clear(); lcd.setCursor(0, 0); lcd.print(" ECO MACHINE! "); lcd.setCursor(0, 1); lcd.print(" Drop & Earn :) "); delay(2000); updateDisplay(); }
🏆 Points System
You can customise the rewards! Change the POINTS_PER_ITEM variable in the code. Here are ideas for a school or home points program:
| Waste Type | Points Earned | Why? |
|---|---|---|
| 🍼 Plastic Bottle (small) | +10 pts | Very common, easy to recycle |
| 🥤 Plastic Bottle (large) | +15 pts | More plastic = more impact |
| 🥫 Aluminium Can | +20 pts | Aluminium saves 95% energy to recycle! |
| 📦 Cardboard Box | +5 pts | Bulky but recyclable |
| 🎃 Bonus: 10 items in a day | +50 pts | Consistency bonus! |
💰 What Can You Do With Points?
At school: exchange for stickers, free lunch, or class privileges. At home: 100 points = extra screen time, or a small treat! Let your teacher or parent set up the reward store.
🕹️ Interactive Demo
Can't build it yet? Try the virtual version below! Click each waste type to see how points are awarded — just like the real machine!
🚀 Cool Upgrades to Try
Once your basic machine works, try these awesome upgrades to make it even smarter!
Bluetooth App
Add an HC-05 module to send points to your phone via Bluetooth!
Wi-Fi Leaderboard
Use an ESP8266 to put scores on a website leaderboard
Custom Tunes
Program different songs for 100, 500, 1000 points milestones!
Servo Sorter
Add a servo motor to sort plastic vs cardboard into different bins
RFID Student Cards
Scan student ID cards to assign points to individual accounts
Passcode Reset
Add a keypad so only a teacher can reset the point counter
🔧 Troubleshooting Guide
Something not working? Don't panic — debugging is part of robotics! Check these common issues:
-
LCD shows nothing / blank screenTurn the small blue potentiometer on the I2C module with a screwdriver — it controls contrast. Also confirm SDA→A4 and SCL→A5 are correct.
-
Points keep adding without anything dropped inIR sensor is triggered by sunlight or room light. Put the machine in a slightly darker spot, or cover the slot with a dark flap when not in use.
-
Bottle not detected at allCheck the IR sensors are facing each other exactly. Also confirm sensor OUT pins go to D2 and D3, and not to analog pins.
-
Buzzer makes no soundConfirm the buzzer's + leg is on D11 and – leg on GND. Also check you have a passive buzzer (active buzzers need different code).
-
LED doesn't light upLEDs have polarity! The longer leg (Anode) must connect through the 220Ω resistor to the Arduino pin. The shorter leg (Cathode) goes to GND.
-
Arduino IDE gives library errorGo to Sketch → Include Library → Manage Libraries. Search "LiquidCrystal I2C" and install the one by Frank de Brabander. Then restart IDE.

Comments
Post a Comment