Build a DIY Food ATM
That Feeds the Needy!
Collect extra food from your community and give it to anyone who needs a meal — powered by Arduino and RFID magic! 💚
🤔 What Is a Food ATM?
A Food ATM works just like a regular ATM machine — but instead of money, it stores and gives out food packets! People with extra food can drop it in, and anyone who is hungry can scan a card to collect a meal. No money needed. No questions asked. Just kindness powered by technology! 💚
Your robot will use an Arduino Uno as the brain, an RFID reader to identify donors and receivers, a servo motor to open the food hatch, and an LCD screen to show messages. It's tech that truly helps people!
Scans RFID card to unlock the deposit door
Records food count on display and buzzes confirmation
Scans their RFID receiver card at the machine
Servo motor opens food door; person collects meal
LCD shows updated food stock; buzzer beeps thanks!
🛒 Parts You'll Need
All these parts are available on Amazon India, RoboElements, or your local electronics shop:
⚡ Circuit Diagram
Here's how all the parts connect to the Arduino Uno. Study this carefully before wiring!
🔧 Step-by-Step Build Guide
Follow these steps in order. Take photos as you go — you'll want to show this off! 📸
Take a large cardboard box (shoe box works great!) or cut plywood panels. You need:
- Top slot — where food gets dropped in (deposit door)
- Front hatch — where food comes out (collection door)
- Front panel — where RFID reader and LCD are mounted
- Inside shelf — cardboard tray that holds food packets
Cut two rectangular holes for the servos to swing open their doors. Hot-glue the servo bodies inside the box walls so the servo horn is exactly over each door flap.
Download the Arduino IDE from arduino.cc. Then install these libraries from the Library Manager (Sketch → Include Library → Manage Libraries):
- MFRC522 — for the RFID reader
- LiquidCrystal_I2C — for the LCD screen
- Servo — built into Arduino IDE already
First, you need to find the unique ID of each RFID card. Upload this sketch to your Arduino, open the Serial Monitor (9600 baud), and scan each card:
read_rfid_id.ino#include <SPI.h> #include <MFRC522.h> #define SS_PIN 10 #define RST_PIN 9 MFRC522 rfid(SS_PIN, RST_PIN); void setup() { Serial.begin(9600); SPI.begin(); rfid.PCD_Init(); Serial.println("Scan your RFID card..."); } void loop() { if (!rfid.PICC_IsNewCardPresent()) return; if (!rfid.PICC_ReadCardSerial()) return; Serial.print("Card UID: "); for (byte i = 0; i < rfid.uid.size; i++) { Serial.print(rfid.uid.uidByte[i] < 0x10 ? " 0" : " "); Serial.print(rfid.uid.uidByte[i], HEX); } Serial.println(); rfid.PICC_HaltA(); }
Write down the UID shown for each card — you'll paste them into the main code next!
This is the full brain of your Food ATM. Replace DONOR_UID and RECEIVER_UID with the UIDs you found in Step 3:
#include <SPI.h> #include <MFRC522.h> #include <Servo.h> #include <Wire.h> #include <LiquidCrystal_I2C.h> // ── Pin Definitions ──────────────────────────── #define SS_PIN 10 #define RST_PIN 9 #define SERVO1_PIN 3 // Deposit door #define SERVO2_PIN 5 // Collection hatch #define BUZZER_PIN 7 #define GREEN_LED 6 #define RED_LED 4 // ── ⭐ REPLACE WITH YOUR ACTUAL CARD UIDs ────── byte DONOR_UID[] = {0xAB, 0xCD, 0xEF, 0x12}; byte RECEIVER_UID[] = {0x34, 0x56, 0x78, 0x9A}; MFRC522 rfid(SS_PIN, RST_PIN); Servo depositDoor; Servo collectHatch; LiquidCrystal_I2C lcd(0x27, 16, 2); int foodStock = 0; // meals available // ── Setup ────────────────────────────────────── void setup() { Serial.begin(9600); SPI.begin(); rfid.PCD_Init(); depositDoor.attach(SERVO1_PIN); collectHatch.attach(SERVO2_PIN); // Start with both doors closed depositDoor.write(0); collectHatch.write(0); pinMode(BUZZER_PIN, OUTPUT); pinMode(GREEN_LED, OUTPUT); pinMode(RED_LED, OUTPUT); lcd.init(); lcd.backlight(); lcd.print("Food ATM Ready!"); lcd.setCursor(0, 1); lcd.print("Stock: 0 meals"); Serial.println("Food ATM started!"); } // ── Helpers ──────────────────────────────────── bool matchUID(byte* target, byte size) { if (rfid.uid.size != size) return false; for (byte i = 0; i < size; i++) if (rfid.uid.uidByte[i] != target[i]) return false; return true; } void beepSuccess() { digitalWrite(GREEN_LED, HIGH); tone(BUZZER_PIN, 1000, 200); delay(250); tone(BUZZER_PIN, 1500, 200); delay(300); digitalWrite(GREEN_LED, LOW); } void beepDeny() { digitalWrite(RED_LED, HIGH); tone(BUZZER_PIN, 400, 500); delay(600); digitalWrite(RED_LED, LOW); } void updateLCD() { lcd.clear(); lcd.print("Food ATM Ready!"); lcd.setCursor(0, 1); lcd.print("Stock: "); lcd.print(foodStock); lcd.print(" meals"); } void openDeposit() { lcd.clear(); lcd.print("DONOR card OK!"); lcd.setCursor(0, 1); lcd.print("Drop food in..."); depositDoor.write(90); // open beepSuccess(); delay(5000); // 5 sec to drop food depositDoor.write(0); // close foodStock++; lcd.clear(); lcd.print("Thank you! :)"); lcd.setCursor(0, 1); lcd.print("Food added!"); delay(2000); updateLCD(); } void openCollection() { if (foodStock <= 0) { lcd.clear(); lcd.print("Sorry! Empty."); lcd.setCursor(0, 1); lcd.print("Check back soon"); beepDeny(); delay(2000); updateLCD(); return; } lcd.clear(); lcd.print("Here's your meal"); lcd.setCursor(0, 1); lcd.print("Collect it now!"); collectHatch.write(90); // open hatch beepSuccess(); delay(6000); // 6 sec to collect food collectHatch.write(0); // close hatch foodStock--; lcd.clear(); lcd.print("Stay strong! :)"); delay(2000); updateLCD(); } // ── Main Loop ────────────────────────────────── void loop() { if (!rfid.PICC_IsNewCardPresent()) return; if (!rfid.PICC_ReadCardSerial()) return; if (matchUID(DONOR_UID, 4)) { openDeposit(); // donor card scanned } else if (matchUID(RECEIVER_UID, 4)) { openCollection(); // receiver card scanned } else { lcd.clear(); lcd.print("Unknown card!"); beepDeny(); delay(1500); updateLCD(); } rfid.PICC_HaltA(); rfid.PCD_StopCrypto1(); }
Make your Food ATM look welcoming! Decorate the box with:
- Painted label: "Free Food ATM — Take what you need 💚"
- Instructions printed on a card: "Donors: Scan GREEN card. Receivers: Scan YELLOW card."
- Arrow stickers showing where to scan and where to collect
- Solar fairy lights around the box for night visibility! ✨
🛠️ Troubleshooting Guide
Something not working? Don't worry — every inventor hits bumps! Check these:
| 🔴 Problem | 🟡 Likely Cause | ✅ Fix |
|---|---|---|
| LCD shows nothing | I²C address wrong or contrast too low | Try address 0x3F instead of 0x27. Adjust contrast pot on I²C backpack |
| RFID card not reading | Wiring issue or wrong SS/RST pins | Double-check pin 10 → SS, pin 9 → RST. RFID needs 3.3V — not 5V! |
| Servo doesn't open | Insufficient current from Arduino 5V | Power servos from external 5V (phone charger), share GND with Arduino |
| Card always shows "Unknown" | UID in code doesn't match card | Re-run the read_rfid_id sketch, copy UID exactly into the main code |
| Buzzer makes no sound | Passive buzzer needs tone(), active needs digitalWrite | Replace tone() with digitalWrite(BUZZER_PIN, HIGH/LOW) for active buzzers |
| Food count resets on restart | Variable stored in RAM (lost on power off) | Use EEPROM.write() to save foodStock permanently (upgrade idea!) |
🚀 Level Up Your Food ATM!
Once your basic Food ATM is working, try these awesome add-ons:
Send a WhatsApp message to the community group whenever stock drops below 3 meals — using ESP8266 + Twilio API.
Add a small solar panel and 18650 battery so it runs 24/7 outdoors without any power plug.
Save the food count to EEPROM so it doesn't reset when power goes off — use Arduino's built-in EEPROM library.
Add a NodeMCU (ESP8266) and log donations to a Google Sheet so you can see how many meals were shared!
Add a DHT11 sensor — if it's too hot inside the box, the LCD warns donors not to leave perishable food.
Store up to 10 donor UIDs in an array — so a whole school or apartment block can each have their own card!
❓ Frequently Asked Questions
Basic Arduino (C++) knowledge helps, but you can copy-paste the code and just change the RFID UIDs. Even total beginners get it working with the steps above!
Absolutely! Just add more UID arrays and extra if-else checks in the loop. You could have a "school card", a "temple card", a "community card" — all different donors!
Best to use sealed, non-perishable packets — biscuits, chips, energy bars, small rice packets. Avoid fresh food in a basic box without refrigeration.
Yes, and it's a fantastic project because it's both a technical build AND has a social impact story. Judges love projects that solve real problems!
Great spots: school entrance, apartment building lobby, temple, community centre, local park corner. Always get permission from the building manager first!

Comments
Post a Comment