Skip to content

gillemta/indoor-position-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Indoor Position Tracker

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.

Table of Contents

Overview

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.

Features

Hardware System (ESP32)

  • 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

Web Visualization App

  • 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

Tech Stack

Hardware

  • Microcontroller: ESP32
  • Communication Protocol: ESP-NOW (for low-latency peer-to-peer communication)
  • Programming Language: Arduino C++ (.ino files)

Web Application

  • 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

System Architecture

Anchor Network

Anchor 1 (Blue) ────────── Anchor 2 (Green)
      \                      /
       \                    /
        \                  /
         \                /
          \              /
           \            /
            Anchor 3 (Amber)

The three anchors form a coordinate system within which tags can determine their positions.

Tag Communication Flow

  1. Tag → Anchors: Each tag requests distance measurements from all 3 anchors
  2. Tag Position Calculation: Tag uses trilateration to calculate its (x, y) position
  3. Tag 1 → Tag 2: Tag 1 sends its position to Tag 2
  4. Proximity Detection: Tag 2 calculates distance between itself and Tag 1
  5. Alarm Trigger: If distance < safety radius × 2, both tags sound alarms

Installation & Setup

Hardware Setup (ESP32)

  1. Flash Anchor Firmware:

    • Open anchor/anchor.ino in Arduino IDE
    • Configure ESP32 board settings
    • Upload to 3 ESP32 devices
    • Position anchors in a triangle formation
  2. Flash Tag Firmware:

    • Open tag/tag.ino in Arduino IDE
    • Configure ESP32 board settings
    • Upload to 2 ESP32 devices
    • Attach tags to mobile objects (workers/vehicles)

Web App Setup

  1. Navigate to Web App Directory:

    cd webapp
  2. Install Dependencies:

    npm install
  3. Run Development Server:

    npm run dev
  4. Open Browser: Navigate to http://localhost:5173

Build for Production

npm run build

Usage

Hardware System

  1. Power on the 3 anchor devices and position them in a triangle
  2. Power on the tag devices
  3. Tags will automatically begin calculating positions and monitoring proximity
  4. Alarms will sound when tags get too close to each other

Web Demonstration

  1. Set Anchor Positions: Drag the colored squares to position your anchors
  2. Choose Mode:
    • Manual Mode: Drag tags to specific positions to test scenarios
    • Auto Mode: Tags move automatically to simulate warehouse activity
  3. Adjust Safety Bubble: Use the slider to set the collision threshold
  4. Start Simulation: Click "Start" to begin auto movement
  5. Observe Collision Detection: Watch as tags turn red and alarms sound when they get too close
  6. Reset: Click "Reset" to restart with new random movement patterns

Web App Demo

🚀 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

Demo GIF

Hardware Setup

ESP32 Capstone Project

This system was developed as a Capstone project demonstrating practical IoT applications for industrial safety.

Concept System:

Concept System

Complete System:

Full System

Hardware Components

  • 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)

Screenshots

Web Application Interface

Main Dashboard: Main Dashboard

Collision Detection: Collision Alert

Simulation Controls: Controls Panel

Project Structure

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

Future Enhancements

  • 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

Contributing

This project was developed as a Capstone demonstration. Feel free to fork and adapt for your own use cases.

License

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.

About

An ESP32-based indoor positioning system using trilateration for real-time collision prevention in warehouses. Includes a React web app with interactive simulation, distance visualization, and audio alarms for crash prevention demonstrations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors