This is the readme file about the entire project
Full-stack IoT-based Asset Management Project
A comprehensive IoT-based asset management solution for facilities, combining ESP32-CAM QR code scanning, WiFi-based zone detection, and real-time web dashboard monitoring.
ArgusLink automates asset location tracking in facilities using:
- ESP32-CAM devices for autonomous QR code scanning with camera vision
- WiFi fingerprinting fallback for location detection when QR scanning fails
- Real-time dashboard for facility managers to monitor asset locations
- Departure intent detection using ignition signal monitoring
- Automatic state management with PostgreSQL triggers and scheduled jobs
Traditional asset management relies on manual tracking, leading to:
- Time wasted searching for assets
- Inefficient space utilization
- Difficulty tracking asset movements during shift changes
- No historical data for optimization
"How might we enable fast, reliable, and low-cost indoor observability of assets in facilities, such that staff can identify the exact asset location within seconds without relying on manual searching or expensive sensing systems?"
ArgusLink provides automated, real-time tracking with:
- Deterministic positioning using QR code as primary detection
- Automatic WiFi fallback when QR scan fails (30-second timeout)
- Real-time updates every 5 seconds
- Mobile-responsive dashboard accessible from any device
- Departure detection with automatic state transitions
- Dual-Mode Operation
- 🔴 Departure Mode (Ignition ON): Sends departure intent, enters deep sleep
- 🟢 Parking Mode (Ignition OFF): QR scanning with 30s timeout → WiFi fallback
- QR Code Scanner
- Format:
XXX-LY-ZZZ(Location-Level-Lot) - Example:
ABC-L3-045= Amplitude Best Company, Level 3, Lot 45 - HIGH error correction (30% damage tolerance)
- Format:
- WiFi Zone Fallback
- Automatic BSSID detection when QR scan times out
- RSSI signal strength logging
- Zone mapping to facility/floor/area
- Diagnostic Mode
- Web interface via WiFi AP mode
- Live camera stream preview
- Real-time statistics dashboard
- Power Management
- Deep sleep mode after successful scan
- Wake on reset for next cycle
- Real-Time Database
- Event-driven architecture with triggers
- Automatic state machine transitions
- Historical event log with full audit trail
- Smart State Management
- PARKED → DEPARTURE_INTENT → DEPARTED flow
- 120-second confirmation timeout
- Automatic cleanup via pg_cron jobs
- Dual Location Detection
- Primary: High-confidence QR scans
- Fallback: WiFi zone mapping (BSSID→Location)
- Views & Functions
asset_current_state_view- Real-time asset locations with asset numberslot_current_state_view- Current lot occupancylot_summary_view- facility-wide occupancy statistics
- Interactive Map View
- Grid-based facility layout visualization
- Color-coded status indicators
- 🟢 Green: High confidence (QR scanned)
- 🟠Orange: Low confidence (WiFi fallback)
- 🟡 Yellow: Departing
- ⚪ Gray: Departed
- Hover tooltips with detailed information
- List View
- Sortable table with all asset data
- Real-time timestamp updates
- Export-ready format
- Advanced Filtering
- Search by asset number
- Filter by facility, floor, status
- Collapsible panel on mobile
- Responsive Design
- Optimized for desktop and mobile
- Touch-friendly controls
- Auto-refresh every 5 seconds
- Progressive Web App ready
| Component | Specification |
|---|---|
| MCU | Seeed XIAO ESP32S3 Sense |
| Camera | OV2640 5MP |
| WiFi | 802.11 b/g/n |
| Power | 3.3V via USB-C |
| Storage | 8MB PSRAM |
- Framework: Arduino Core for ESP32
- Libraries:
ESP32QRCodeReader- QR code decodingHTTPClient- API communicationWiFiClientSecure- HTTPS supportesp_camera- Camera control
- Database: Supabase (PostgreSQL 14.1)
- API: Supabase REST API
- Functions: plpgsql stored procedures
- Scheduling: pg_cron extension
- Security: Row Level Security (RLS)
- Framework: Next.js 15.1.0 (React 18)
- Language: TypeScript 5
- Styling: Tailwind CSS 3.4.1
- State: React Hooks (useState, useEffect, useMemo)
- Client: Supabase SSR v0.5.2
- Deployment: Vercel
- ESP32: PlatformIO IDE
- Python: qrcode, Pillow (QR generation)
- Database: Supabase Dashboard
- Version Control: Git
ArgusLink/Codes/
│
├── ArgusLink QR Scanner/ # ESP32-CAM firmware
│ ├── src/
│ │ ├── main.cpp # Main firmware logic
│ │ └── app_httpd.cpp # Diagnostic web server
│ ├── include/
│ │ ├── config.h # Configuration constants
│ │ ├── camera_pins.h # Hardware pin definitions
│ │ └── camera_index.h # Web interface HTML
│ └── platformio.ini # Build configuration
│
├── QR_Generator/ # QR code generation tools
│ ├── generate_qr.py # CLI batch generator
│ ├── qr_generator_gui.py # Tkinter GUI interface
│ ├── requirements.txt # Python dependencies
│ ├── supabase.ts # Database schema reference
│ └── qr_codes/ # Generated QR images
│ └── *.png
│
└── ArgusLink-dashboard/ # Next.js web dashboard
├── app/
│ ├── page.tsx # Main dashboard
│ ├── layout.tsx # App layout
│ └── globals.css # Global styles
├── package.json # NPM dependencies
├── tsconfig.json # TypeScript config
├── tailwind.config.ts # Tailwind config
├── next.config.js # Next.js config
└── .env.local.example # Environment template
- Hardware: Seeed XIAO ESP32S3 Sense with camera
- Software:
- PlatformIO IDE
- Python 3.8+
- Node.js 24.12.0+
- Supabase account
-- Event log table
CREATE TABLE parking_scans (
event_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
device_id VARCHAR(50) NOT NULL,
event_type VARCHAR(20) NOT NULL,
ts_utc TIMESTAMPTZ NOT NULL,
bssid MACADDR NOT NULL,
rssi INTEGER,
qr_success BOOLEAN,
raw VARCHAR(100),
depot VARCHAR(10),
floor INTEGER,
lot INTEGER,
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- Current state table
CREATE TABLE asset_current_state (
device_id VARCHAR(50) PRIMARY KEY,
current_event_type VARCHAR(20),
current_lot_id VARCHAR(20),
current_depot VARCHAR(10),
current_floor INTEGER,
current_lot INTEGER,
wifi_zone VARCHAR(20),
wifi_zone_letter VARCHAR(1),
wifi_level INTEGER,
last_event_time TIMESTAMPTZ,
qr_success BOOLEAN,
last_rssi INTEGER
);
-- Device to asset mapping
CREATE TABLE device_asset_mapping (
device_id VARCHAR(50) PRIMARY KEY,
asset_number VARCHAR(20) UNIQUE NOT NULL
);
-- WiFi BSSID to location mapping
CREATE TABLE bssid_zone_mapping (
bssid MACADDR PRIMARY KEY,
zone VARCHAR(20),
level INTEGER,
zone_letter VARCHAR(1),
depot VARCHAR(10)
);
-- layout master data
CREATE TABLE lots_master (
id SERIAL PRIMARY KEY,
depot VARCHAR(10) NOT NULL,
floor INTEGER NOT NULL,
lot_number INTEGER NOT NULL,
UNIQUE(depot, floor, lot_number)
);See Supabase documentation for complete SQL scripts:
update_asset_current_state()triggerupdate_lot_current_state()triggerconfirm_departures()cron job
Edit include/config.h:
// WiFi credentials
#define WIFI_STA_SSID "YourWiFiSSID"
#define WIFI_STA_PASSWORD "YourPassword"
// Supabase configuration
#define SUPABASE_URL "https://your-project.supabase.co"
#define SUPABASE_API_KEY "your-anon-key"
#define API_ENDPOINT SUPABASE_URL "/rest/v1/parking_scans"
// Device ID (unique per device)
#define DEVICE_ID "ESP32S3-001"cd ESP32_Cam_PlatformIO
pio run --target upload
pio device monitorcd QR_Generator
pip install -r requirements.txt# CLI batch generation
python generate_qr.py --depot ABC --floors 3 --lots 50
# GUI interface
python qr_generator_gui.pycd asset-dashboard
npm installCreate .env.local:
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-keynpm run dev
# Access at http://localhost:3000npm run build
# Deploy via Vercel CLI or GitHub integration- HTTPS/TLS for API communication
- API key authentication
- NTP time synchronization for accurate timestamps
- Deep sleep mode for power efficiency
- Row Level Security (RLS) policies
- Anon key with restricted permissions
- Service role key for admin operations only
- SECURITY INVOKER views for proper permission handling
- Environment variables for sensitive keys
- Client-side rate limiting
- HTTPS only in production
- CORS configuration
Stores all parking/departure events with full audit trail.
Current location and status of each asset, updated in real-time via triggers.
Maps WiFi access points to physical facility locations for fallback detection.
Joins asset state with asset numbers for dashboard display.
Shows current occupancy status of each parking lot.
Aggregated statistics per facility for capacity monitoring.
| Component | Description | Example | Range |
|---|---|---|---|
| XXX | Facility Code | ABC | 1-5 chars |
| L | Literal "L" | L | Fixed |
| Y | Floor Number | 3 | 1-9 |
| ZZZ | Lot Number | 045 | 001-999 |
ABC-L3-045 = Amplitude Best Company, Level 3, Lot 045
- Level: HIGH (30% recoverable)
- Enables scanning at various angles and lighting conditions
- Robust to partial damage or dirt
- Map View: Visual grid showing facility layout with color-coded asset markers
- List View: Table with sortable columns and search functionality
- Filters: Sidebar with facility, floor, and status filters
- Tap "Filters" button to show/hide filter panel
- Use tabs to switch between Map and List views
- Touch asset markers for details
- 🟢 Green: High confidence (QR scanned)
- 🟠Orange: Low confidence (WiFi fallback)
- 🟡 Yellow: Departing (engine ON, departure intent sent)
- ⚪ Gray: Departed (confirmed after 120s)
QR Scan Timeout
- Check camera focus and lighting
- Verify QR code format matches
XXX-LY-ZZZ - System will automatically fall back to WiFi zone detection
WiFi Connection Failed
- Verify SSID and password in
config.h - Check WiFi signal strength
- Device will retry connection automatically
API Error 400
- Check Supabase URL and API key
- Verify table structure matches schema
- Check Supabase logs for detailed error
No Data Showing
- Verify
.env.localconfiguration - Check Supabase API permissions (RLS policies)
- Open browser console for error messages
- Historical analytics dashboard
- Predictive parking availability
- Multi-facility management
- Mobile app (React Native)
- Driver mobile check-in app
- SMS/Push notifications for dispatchers
- Integration with fleet management systems
- Advanced reporting and KPIs
MIT License - See LICENSE file for details
- Gavin Tan
For issues, questions, or contributions:
- Create an issue on GitHub
- Seeed Studio for XIAO ESP32S3 platform
- Supabase for backend infrastructure

