π University Project | A complete smart vending machine management system with hardware integration
- Overview
- β¨ Key Features
- πΈ Screenshots
- ποΈ System Architecture
- π οΈ Technology Stack
- π Getting Started
- π» Usage Guide
- π Database Schema
- π§ Hardware Setup
- π Performance
- π€ Contributing
- π License
- π Contact
Vital Vending Machine (VVM) is a comprehensive smart vending machine management system developed as a university capstone project. It seamlessly integrates a modern JavaFX desktop application with Arduino hardware through serial communication, creating a complete vending solution.
The system simulates a real-world vending environment with:
- π Multi-level authentication (User/Admin)
- π Real-time sales tracking and analytics
- π Comprehensive logging system
- π¨ Modern glass-morphism UI design
- π€ Hardware integration with Arduino
- π’ Smart advertisement display system
| Feature | Description |
|---|---|
| π€ User Login | Secure access for regular users |
| π Admin Login | Privileged access for administrators |
| π‘οΈ Role-based Access | SuperAdmin, Manager, Operator levels |
| π Activity Logging | Complete entry/exit tracking |
| π Password Security | BCRYPT hashing for credentials |
- β Create Users with complete profiles
- β Create Admins with specific permission levels
- β View & Manage user lists
- β Edit Profiles with full CRUD operations
- β Permission-based interface rendering
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Product ββββββΆβ Confirmation ββββββΆβ Payment β
β Selection β β & Settings β β Processing β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- π― Two-step sales interface
- βοΈ Customizable product settings (sweetness, caffeine, temperature)
- π Automatic sales logging
- π Real-time inventory tracking
- π³ Multiple payment methods support
| Log Type | Tracked Data |
|---|---|
| π Entry/Exit Logs | User/Admin access times, IP, device info |
| π° Sales Logs | Products, quantities, prices, timestamps |
| π¨βπΌ Admin Actions | All administrative activities |
| π System Events | Application events and errors |
graph LR
A[Active Session] -->|1 min idle| B[Advertisement Mode]
B -->|Click/Key Press| A
B -->|Slideshow| C[Display Ads]
C -->|Loop| B
- β±οΈ Auto-activates after 1 minute of inactivity
- πΌοΈ Dynamic slideshow of advertisement images
- π Returns instantly on user interaction
- π Auto-loads from server directory
- π Dynamic Dark/Light mode based on time
- πͺ Glass-morphism effects with iOS 16 aesthetics
- β¨ Smooth animations and transitions
- π± Responsive layout for all screen sizes
- π― Intuitive navigation with visual feedback
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β JavaFX ββββββΆβ Serial ββββββΆβ Arduino β
β App βββββββ Communicationβββββββ Hardware β
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
- π Physical button triggers
- π‘ LED status indicators
- π LCD display integration
- π Real-time hardware feedback
![]() π Login Page |
![]() π€ User Dashboard |
![]() π Admin Panel |
![]() β Add User |
![]() π₯ Add Admin |
![]() π Product Selection |
![]() β Confirmation Page |
![]() π Sales Logs |
![]() π Entry Logs |
![]() π Admin Logs |
![]() π’ Advertisement Mode |
|
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PRESENTATION LAYER β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
β β Login β β User β β Admin β β Screens β β
β β Pages β β Panels β β Panels β β ayer β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β BUSINESS LAYER β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
β β Auth β β Sales β β Cache β β Idle β β
β β Manager β β Manager β β Manager β β Monitor β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β DATA LAYER β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
β β ApiClientβ β Cache β β Serial β β Database β β
β β β β System β β Comm β β β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββ΄ββββββββββ
βΌ βΌ
βββββββββββββββββ βββββββββββββββββ
β MySQL β β Arduino β
β Database β β Hardware β
βββββββββββββββββ βββββββββββββββββ
| Technology | Version | Purpose |
|---|---|---|
| β Java | 21 LTS | Core programming language |
| ποΈ JDBC | 8.0 | Database connectivity |
| π BCrypt | 0.9 | Password hashing |
| π¦ Maven | 3.9 | Build automation |
| Technology | Version | Purpose |
|---|---|---|
| π¨ JavaFX | 21 | UI framework |
| π FXML | - | UI markup |
| π CSS | - | Styling |
| β¨ Animation | - | Smooth transitions |
| Component | Purpose |
|---|---|
| π Arduino Uno | Main controller |
| π LCD 16x2 | Display interface |
| π‘ LEDs | Status indicators |
| π Buttons | Physical input |
| π‘ Serial Port | Communication |
-- Main tables
βββ users
βββ admins
βββ buttons
βββ sales_logs
βββ user_login_logs
βββ adminlogs
βββ api_keys- Java 21 or higher (Download)
- MySQL 8.0 or higher (Download)
- Arduino IDE (Download)
- Git (optional, for cloning)
https://sadraghofran.ir/VVM.zip
| Role | Username | Password | Level |
|---|---|---|---|
| π SuperAdmin | ... |
... |
SuperAdmin |
| π¨βπΌ user | test_user |
123456789 |
user |
- Login with user credentials
- Browse products with pagination
- Select product β Configure settings
- Confirm order β Complete purchase
- View logs of your transactions
- π₯ Manage Admins (Add/Edit/Delete)
- π€ Manage Users (Add/Edit/Delete)
- π₯οΈ Manage Devices (Configure)
- π¦ Manage Products (Buttons)
- π View All Logs (System-wide)
- π€ View Users
- π₯οΈ View Devices
- π View Reports
- π€ Basic User View
- π₯οΈ Device Status
-- Users table
CREATE TABLE `users` (
`id` int NOT NULL AUTO_INCREMENT,
`fullname` varchar(150) NOT NULL,
`username` varchar(100) NOT NULL UNIQUE,
`password` varchar(255) NOT NULL,
`phone` varchar(20),
`email` varchar(150),
`address` text,
`company_name` varchar(150),
`ceo_name` varchar(150),
`ceo_phone` varchar(20),
`ceo_email` varchar(150),
`device_location` text,
`background_image` varchar(255) DEFAULT 'default_bg.jpg',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
`created_by_admin` varchar(100),
PRIMARY KEY (`id`)
);
-- Admins table
CREATE TABLE `admins` (
`id` int NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL UNIQUE,
`password` varchar(255),
`fullname` varchar(100),
`email` varchar(100),
`phone` varchar(20),
`level` varchar(20),
PRIMARY KEY (`id`)
);
-- Buttons table
CREATE TABLE `buttons` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL,
`title` varchar(100) NOT NULL,
`caption` text,
`image` varchar(255),
`price` decimal(10,2) NOT NULL,
`sweetness_level` int DEFAULT 0,
`caffeine_level` int DEFAULT 0,
`temperature_level` int DEFAULT 0,
`stock` int DEFAULT 0,
PRIMARY KEY (`id`),
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`)
);
-- Sales logs
CREATE TABLE `sales_logs` (
`id` bigint NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL,
`username` varchar(100) NOT NULL,
`fullname` varchar(150) NOT NULL,
`button_id` int NOT NULL,
`button_title` varchar(100) NOT NULL,
`quantity` int DEFAULT 1,
`total_price` decimal(10,2),
`sold_at` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`),
FOREIGN KEY (`button_id`) REFERENCES `buttons`(`id`)
);- 1x Arduino Uno
- 1x LCD 16x2 with I2C
- 4x Push buttons
- 3x LEDs (Red, Green, Blue)
- 1x Buzzer (optional)
- Resistors and wires
Arduino Uno Components
βββββββββββ βββββββββββ
β Pin 2 ββββββββββ€ Button1 β
β Pin 3 ββββββββββ€ Button2 β
β Pin 4 ββββββββββ€ Button3 β
β Pin 5 ββββββββββ€ Button4 β
β Pin 6 ββββββββββ€ LED-Red β
β Pin 7 ββββββββββ€ LED-Greenβ
β Pin 8 ββββββββββ€ LED-Blue β
β Pin 9 ββββββββββ€ Buzzer β
β SDA(20) ββββββββββ€ LCD SDA β
β SCL(21) ββββββββββ€ LCD SCL β
βββββββββββ βββββββββββ
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int button1 = 2;
const int button2 = 3;
const int button3 = 4;
const int button4 = 5;
const int ledRed = 6;
const int ledGreen = 7;
const int ledBlue = 8;
void setup() {
Serial.begin(9600);
lcd.init();
lcd.backlight();
pinMode(button1, INPUT_PULLUP);
pinMode(button2, INPUT_PULLUP);
pinMode(button3, INPUT_PULLUP);
pinMode(button4, INPUT_PULLUP);
pinMode(ledRed, OUTPUT);
pinMode(ledGreen, OUTPUT);
pinMode(ledBlue, OUTPUT);
lcd.setCursor(0, 0);
lcd.print("VVM Ready");
}
void loop() {
if (Serial.available() > 0) {
String command = Serial.readStringUntil('\n');
processCommand(command);
}
checkButtons();
}
void processCommand(String cmd) {
if (cmd.startsWith("LCD:")) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(cmd.substring(4));
}
else if (cmd.startsWith("LED:")) {
String ledCmd = cmd.substring(4);
if (ledCmd == "RED_ON") digitalWrite(ledRed, HIGH);
if (ledCmd == "RED_OFF") digitalWrite(ledRed, LOW);
// ... etc
}
}
void checkButtons() {
if (digitalRead(button1) == LOW) {
Serial.println("BUTTON:1");
delay(200);
}
// ... check other buttons
}| Operation | Time | Cache Status |
|---|---|---|
| π Login | < 100ms | - |
| π Load Products (first) | 350ms | Miss |
| π Load Products (cached) | 15ms | Hit π― |
| π Load Sales Logs | 280ms | - |
| π₯ Load Users | 320ms | - |
| πΌοΈ Load Images | 150-500ms | Varies |
- π― Hit Rate: 85%
- π¦ Memory Usage: ~50MB
- πΎ Disk Cache: ~200MB
- β‘ Response Time Improvement: 65%
- Lead Developer: Sadra Ghofran
- π§ Email: sadrareza1847@gmail.com
- π Website: sadraghofran.ir
- π» GitHub: einmensch1847
- π Linkedin: SadraGhofran










