A low-cost ESP32-based indoor positioning system for real-time collision prevention in warehouses and industrial environments. This project provides an affordable alternative to expensive commercial solutions by utilizing trilateration and proximity detection to prevent accidents between workers, vehicles, and equipment.
- Overview
- Features
- Tech Stack
- System Architecture
- Installation & Setup
- Usage
- Web App Demo
- Hardware Setup
- Screenshots
The Indoor Position Tracker uses a network of ESP32 microcontrollers to create a real-time positioning and collision prevention system. The system consists of:
- 3 Anchor Devices: Stationary ESP32 units positioned in a triangular formation that serve as reference points
- 2 Tag Devices: Mobile ESP32 units attached to workers, forklifts, or vehicles
- Trilateration Algorithm: Tags calculate their own position using distances measured from the anchors
- Collision Detection: Real-time proximity monitoring between tags with configurable safety zones
- Audio/Visual Alarms: Immediate warnings when tags enter each other's safety bubble
This system simulates crash prevention in warehouses at a fraction of the cost of existing commercial solutions, making safety technology accessible to smaller operations.
- Distance Measurement: Each tag communicates with the 3 nearest anchors to measure distances
- Self-Positioning: Tags calculate their own coordinates using trilateration
- Peer-to-Peer Communication: Tag 1 sends its position to Tag 2 for proximity calculation
- Collision Detection: Triggers alarms when tags are within the configured safety radius
- Low Cost: Uses affordable ESP32 microcontrollers instead of expensive commercial systems
- Interactive 2D Grid: Visual representation of the positioning system
- Draggable Anchors: Set anchor positions by dragging them on the grid
- Auto/Manual Modes: Tags can move automatically or be positioned manually
- Real-time Distance Visualization: Lines showing distances from tags to anchors
- Collision Detection: Visual and audio alarms when safety bubbles overlap
- Configurable Parameters: Adjustable safety bubble radius and simulation speed
- Responsive Design: Works on any screen size
- Microcontroller: ESP32
- Communication Protocol: ESP-NOW (for low-latency peer-to-peer communication)
- Programming Language: Arduino C++ (
.inofiles)
- Frontend: React 18
- Build Tool: Vite
- Styling: CSS3 with modern gradients and animations
- Graphics: HTML5 Canvas API
- Audio: Web Audio API
- Deployment: Vercel-ready configuration
Anchor 1 (Blue) ────────── Anchor 2 (Green)
\ /
\ /
\ /
\ /
\ /
\ /
Anchor 3 (Amber)
The three anchors form a coordinate system within which tags can determine their positions.
- Tag → Anchors: Each tag requests distance measurements from all 3 anchors
- Tag Position Calculation: Tag uses trilateration to calculate its (x, y) position
- Tag 1 → Tag 2: Tag 1 sends its position to Tag 2
- Proximity Detection: Tag 2 calculates distance between itself and Tag 1
- Alarm Trigger: If distance < safety radius × 2, both tags sound alarms
-
Flash Anchor Firmware:
- Open
anchor/anchor.inoin Arduino IDE - Configure ESP32 board settings
- Upload to 3 ESP32 devices
- Position anchors in a triangle formation
- Open
-
Flash Tag Firmware:
- Open
tag/tag.inoin Arduino IDE - Configure ESP32 board settings
- Upload to 2 ESP32 devices
- Attach tags to mobile objects (workers/vehicles)
- Open
-
Navigate to Web App Directory:
cd webapp -
Install Dependencies:
npm install
-
Run Development Server:
npm run dev
-
Open Browser: Navigate to
http://localhost:5173
npm run build- Power on the 3 anchor devices and position them in a triangle
- Power on the tag devices
- Tags will automatically begin calculating positions and monitoring proximity
- Alarms will sound when tags get too close to each other
- Set Anchor Positions: Drag the colored squares to position your anchors
- Choose Mode:
- Manual Mode: Drag tags to specific positions to test scenarios
- Auto Mode: Tags move automatically to simulate warehouse activity
- Adjust Safety Bubble: Use the slider to set the collision threshold
- Start Simulation: Click "Start" to begin auto movement
- Observe Collision Detection: Watch as tags turn red and alarms sound when they get too close
- Reset: Click "Reset" to restart with new random movement patterns
🚀 Live Demo: View on Vercel
The web application provides a complete simulation of the indoor positioning system:
- Position anchors anywhere on the grid
- Watch tags move in real-time with accurate distance calculations
- See collision detection in action with visual and audio feedback
- Adjust safety parameters to test different scenarios
- Perfect for demonstrating the system without physical hardware
This system was developed as a Capstone project demonstrating practical IoT applications for industrial safety.
Concept System:
Complete System:
- 5× ESP32 Development Boards
- USB Power supplies for each device
- Mounting hardware for anchor positioning
- Audio buzzers for tag alarms (built into ESP32 or external)
indoor-position-tracker/
├── anchor/
│ └── anchor.ino # ESP32 anchor firmware
├── tag/
│ └── tag.ino # ESP32 tag firmware
├── webapp/
│ ├── src/
│ │ ├── App.jsx # Main React component
│ │ ├── components/
│ │ │ └── Grid.jsx # Canvas-based visualization
│ │ └── ...
│ ├── package.json
│ ├── vercel.json # Vercel deployment config
│ └── README.md # Detailed web app documentation
├── assets/
│ └── project-image.jpg # Portfolio thumbnail image
├── docs/
│ ├── demo.gif # Web app demonstration
│ └── *.jpg/png # Hardware photos and screenshots
└── README.md # This file
- Add support for more than 2 tags
- Implement WebSocket connection to real ESP32 hardware
- 3D visualization for multi-floor warehouses
- Historical path tracking and replay
- Configurable alarm sounds and volumes
- Mobile app version for on-site monitoring
- Integration with warehouse management systems
This project was developed as a Capstone demonstration. Feel free to fork and adapt for your own use cases.
MIT License - feel free to use this project for educational or commercial purposes.
Note: This is a proof-of-concept system designed to demonstrate low-cost collision prevention technology. For production use in industrial environments, additional safety certifications and redundancy measures would be required.