Close
0%
0%

BudKoin: ESP32-Powered Smart Vending Machine

We built a vending machine that doesn't take coins. No quarters, no dollar bills, no jammed change dispensers.

Similar projects worth following
We built a vending machine that doesn't take coins. No quarters, no dollar bills, no jammed change dispensers. Just tap your phone, grab your snack, and go. Our team designed the PCB, wrote the firmware, and 3D-printed the enclosure in-house. Here's how we did it.

This is BudKoin — a custom vending machine running on an ESP32, handling payments through NFC and UPI.

Why Build a Custom Vending Machine?

Off-the-shelf vending machines cost ₹50,000 and up. They run proprietary software. You can't modify the payment flow. You can't add IoT features without ripping out the controller.

We needed something smaller. Something we could put in a co-working space, accept UPI payments, and track inventory from a dashboard. So we built our own.

Advantages Over Commercial Machines

| Feature | BudKoin | Typical Commercial Machine |

|---------|---------|---------------------------|

| Payment | UPI, NFC, card | Cash only or proprietary card |

| Cost | ₹2,500 + 3D print | ₹50,000+ |

| Customization | Change firmware anytime | Locked firmware |

| Inventory tracking | MQTT to dashboard | Manual check |

| Size | 30cm x 20cm x 25cm | 1.8m tall |

| Power | 5V, 10W | 220V, 200W+ |

For a small office, co-working space, or dorm, BudKoin makes sense. You can scale it by adding more product slots with additional servos and relays.

Future Enhancements

We're working on version 2:

Matter protocol support : Make the vending machine discoverable on smart home networks. Imagine "Hey Google, restock the vending machine in room 3."

Camera-based inventory: ESP32-CAM module. Takes photo of each slot every hour. Runs a tiny CNN on the ESP32 to count products. Sends alert when stock runs low.

Solar power option: Small 10W panel + 18650 battery pack. Run the machine off-grid for events.

Multiple product sizes: Different servo angles for different product widths. Current design handles anything from gum packets to small chip bags.

Refund API: Full UPI refund flow. User gets money back if product jams or if they double-tap.

We're also porting the firmware to Zephyr RTOS. Better task management, proper threading for WiFi, NFC, and servo control. The Arduino framework works but we want deterministic timing for the IR sensor polling.

Need a Custom Vending Machine?

We ship fully assembled prototypes. Give us your requirements — product dimensions, payment methods, quantity — and we'll deliver a working unit with firmware source code, PCB design files, and 3D models.

Our team handles:

- Firmware development (ESP32, nRF52, STM32)

- PCB design (KiCad, Altium)

- 3D design and printing (FreeCAD, Prusa)

- Full prototype assembly and testing

- Matter protocol integration

- UPI/NFC payment integration

We're based in India with offices in the US and UK. If you're a Raspberry Pi developer looking to build custom hardware, or a business that needs a smart vending solution, reach out. We'll build it.

vmch (2).jpeg

JPEG Image - 191.70 kB - 07/14/2026 at 07:22

Preview

  • 1 × ESP32-WROOM-32
  • 1 × PN532 NFC module
  • 1 × MG995 servo
  • 1 × 16x2 I2C LCD
  • 1 × 5V 10A power supply

View all 9 components

  • What Actually Broke

    Himanshu Dada07/14/2026 at 07:18 0 comments

    Week 1: Servo jittered. Ground loop from separate power supplies. Fixed by tying all grounds together.

    Week 2: PN532 stopped reading NFC tags. Dead. Replaced with a new one. Added TVS diode on the I2C lines for protection.

    Week 3: Product jammed in chute. A bag of chips got stuck. Redesigned chute angle from 30° to 45°. Added a Teflon strip on the slide surface.

    Week 4: ESP32 crashed during MQTT publish. Stack overflow in WiFi task. Increased `CONFIG_MAIN_TASK_STACK_SIZE` to 8192 bytes. Stable since.

View project log

  • 1
    Design the PCB

    We used KiCad. The board has:

    - ESP32 breakout with 3.3V regulator

    - Level shifters for 5V peripherals

    - I2C header for LCD

    - GPIO headers for servos and sensors

    - USB-UART bridge (CP2102) for programming

  • 2
    Wire the Prototype

    Before ordering PCBs, we breadboarded everything:

    ```

    ESP32 GPIO 22 → LCD SCL

    ESP32 GPIO 21 → LCD SDA

    ESP32 GPIO 4  → Servo signal

    ESP32 GPIO 18 → IR sensor OUT

    ESP32 GPIO 15 → PN532 IRQ

    ESP32 GPIO 32-35 → Push buttons

    ```

    Power: 5V rail for servo and relay. ESP32 runs on 3.3V from onboard regulator. Common ground everywhere — this matters.

  • 3
    Write the Firmware

    We used Arduino framework on ESP32. Not ideal for production, but fast for prototyping.

    Key firmware components:

    WiFi Manager: Captive portal on first boot. User connects to `BudKoin-Setup`, enters WiFi credentials. Saved to NVS.

    NFC Payment Handler: PN532 reads UPI tap-to-pay NFC tags. We generate a payment request with amount, UPI ID, and merchant reference. User taps phone, UPI app opens, payment completes. ESP32 polls UPI API for confirmation.

    Product Dispense Logic: When payment confirmed, servo rotates 180 degrees. IR sensor checks if product actually dropped. If not, retry three times, then refund.

    MQTT Reporting: Every 30 seconds, ESP32 publishes:

    - Product count remaining

    - Temperature (DHT22 inside enclosure)

    - Last transaction timestamp

    - Error flags

    Broker runs on a Raspberry Pi 4 in the same building.

View all 5 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates