Software Architecture
System Overview
The vending machine's software architecture is designed to handle user interaction, item dispensing, inventory tracking, and data logging through a streamlined Arduino-based control system. It ensures smooth integration between the hardware and user interface components, while enabling real-time feedback and fault tolerance.
Key Components
Keypad Input Handler
Interprets button presses and matches inputs with available item slots, communicating with dispensing system
Motor Control Logic
Control the servo rotation to trigger item dispensing
IR Sensor Monitoring
Validates item delivery by detecting presence of dispensed product, triggers retry or unlocks keypad based on results
Data Logger and Inventory Tracker
Logs item sales, updates inventory counts and triggers LED alerts when stock is low
Key Functions
| Function | Purpose | Implementation |
|---|---|---|
| handleKeypadInput() | Process user input | Interrupt-driven keypad scanning |
| controlMotor() | Dispense items | PWM-based servo control |
| checkInventory() | Track stock levels | EEPROM-based storage |
Technology Stack
| Component | Technology | Purpose |
|---|---|---|
| Microcontroller | Arduino Mega 2560 Rev3 | Handles input and control logic |
| Programming Language | C++ | Built on Arduino IDE |