Skip to content

Latest commit

 

History

41 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenIPS:RSSI-Based Indoor Localization Using Custom compact 2.4 GHz Microstrip Patch Antenna

A custom microstrip patch antenna and ESP32-based RSSI trilateration system for indoor positioning of GPS-denied mobile nodes

MATLAB ESP32 ESP-NOW FR4 License Status ESP32-S3


📖 Table of Contents


🎯 Overview

OpenIPS is a low-cost indoor positioning system built around a custom-designed 2.4 GHz microstrip patch antenna. The system combines five ESP32 nodes, ESP-NOW communication, RSSI ranging, trilateration, Kalman filtering, and a browser dashboard for GPS-denied indoor positioning.

The system targets GPS-denied environments such as collapsed structures, underground passages, and terrain-blocked zones, with disaster-response scenarios (e.g. earthquake rescue robotics) as the primary motivating use case.

A hybrid antenna architecture underpins the design: the custom patch antenna is evaluated on the mobile node, while the three fixed anchors use ESP32 built-in trace antennas. This makes it possible to compare antenna effects under the same anchor layout.

Project completed and evaluated. The antenna was designed in MATLAB, fabricated on FR4, measured with a LiteVNA, corrected with a lumped L-network, and evaluated in the OpenIPS positioning system. The final report records room-level and zone-level performance rather than metre-level accuracy.

System architecture overview
Figure 1. OpenIPS system architecture overview

MATLAB ESP32 FR4


✨ Features

Feature Description
📡 Custom Patch Antenna Inset-fed rectangular microstrip patch; fabrication was corrected with a lumped L-network
🎯 Compact Design Optimized for FR4 substrate (εr = 4.4, h = 1.6 mm), fabricable with locally available materials
🔀 Hybrid Antenna Strategy Custom patch on the mobile node + built-in ESP32 trace antennas on fixed anchors
📶 ESP-NOW Communication Low-latency, WiFi-independent link between anchors and rover
📍 RSSI Trilateration Position estimation from three fixed anchor nodes
🧮 Kalman Filtering Smooths noisy RSSI-derived position estimates for stable tracking
🚗 Rover Navigation L298N motor driver integration for autonomous indoor movement
🔬 Simulation-Validated Electromagnetic simulation in MATLAB before physical fabrication
💻 ESP32-S3 Support Updated firmware with ESP32-S3 microcontroller optimization for improved performance

🔬 Technical Specifications

Antenna Design Parameters

Microstrip patch antenna geometry
Figure 2. Custom inset-fed patch antenna geometry

Parameter Value Purpose
Resonant Frequency 2.4 GHz Target operating frequency (ISM band)
Substrate FR4 (εr = 4.4) Low-cost, locally available dielectric
Substrate Thickness (h) 1.6 mm Standard FR4 board thickness
Patch Width 28.507 mm MATLAB design output
Patch Length 26.369 mm MATLAB design output
Stripline width 1.629 mm MATLAB design output
Notch length 3.801 mm MATLAB design output
Notch width 2.851 mm MATLAB design output
Ground plane 57.015 mm × 57.015 mm MATLAB design output
Copper thickness 0.03556 mm MATLAB design output
Reference impedance 50 Ω S-parameter reference

System Components

Component Quantity Role
ESP32-WROOM-32U / ESP32-S3 3 fixed anchors, 1 mobile node, and 1 gateway
Custom Patch Antenna 1× or more Tested on the mobile node
ESP32 built-in trace antenna Used by the fixed anchors
U.FL-to-SMA Pigtail (RG-178/RG-316) 1× or more Connects the patch to the mobile ESP32
L298N Motor Driver Drives rover motors based on trilaterated position
NanoVNA Fabricated antenna impedance/S11 verification
FR4 Copper-Clad Board Antenna fabrication substrate

Performance Targets

Parameter Specification
Evaluated Area 18 m × 18 m
Positioning Dataset 416 out-of-sample fixes
Median Position Error 2.84 m
RMSE 4.80 m
Simulated Return Loss (S11) < −15 dB at 2.4 GHz
Communication Protocol ESP-NOW on channel 1; gateway USB serial output
Filtering Kalman filter on trilaterated position estimates

🏗️ System Architecture

Core System Flow

Core system flow diagram
Figure 3. Complete system flow from beacon transmission to position output

Antenna Design Flow

TLM Equations (W, L, y₀) → MATLAB Antenna Toolbox Simulation
    → S11 / Impedance Validation → Fabrication (FR4 etching)
    → NanoVNA Measurement → RSSI Field Comparison vs Built-in Antenna

Hybrid Antenna Rationale

  • The mobile node uses the custom patch antenna during the antenna comparison, connected through a U.FL-to-SMA pigtail.
  • The three fixed anchors use their built-in ESP32 trace antennas, matching the final report's tested configuration.
  • The two antenna configurations are compared under the same anchor layout to quantify their effect on RSSI positioning.

⚡ Installation & Setup

Prerequisites

Requirement Description
MATLAB + Antenna Toolbox Required for patchMicrostripInsetfed simulation
Arduino IDE / PlatformIO For ESP32 firmware (anchor + rover)
ESP32-WROOM-32U / ESP32-S3 ×5 total: mobile node, gateway, and three anchors
NanoVNA For post-fabrication antenna verification
Fabrication Tools FR4 copper-clad board, ferric chloride etchant, SMA connectors

Step-by-Step Setup

1. Clone the Repository

git clone https://github.com/sarpharaj-09/OpenIPS.git
cd OpenIPS

2. Run the Antenna Simulation (MATLAB)

% From Antenna_Simulations/
run BestResultEver03_30.m

This derives base dimensions (W, L, Wf, y₀, NotchWidth) from the transmission line model and feeds them into the patchMicrostripInsetfed simulation.

3. Flash ESP32 Firmware

cd code
pio run -e gateway -t upload
pio run -e anchor0 -t upload
pio run -e anchor1 -t upload
pio run -e anchor2 -t upload
pio run -e mobile -t upload

4. Hardware Assembly

  • Solder SMA female connector at each patch antenna's feed point.
  • Connect the custom patch antenna to the mobile ESP32-WROOM-32U through a U.FL-to-SMA pigtail (RG-178 or RG-316).
  • Keep the three anchor ESP32 built-in trace antennas exposed; wire the mobile node to the L298N motor driver if rover control is used.

Vector network analyzer
Figure 4. LiteVNA used for post-fabrication antenna verification


🎮 Usage & Operation

Completed Operation

The completed workflow combines the antenna measurement pipeline with the ESP-NOW positioning system:

% Run the antenna model from Antenna_Simulations/
run BestResultEver03_30.m
  1. Power On — The mobile node broadcasts via ESP-NOW; the anchors begin RSSI sampling.
  2. Trilateration — Rover computes position estimate from three anchor RSSI readings.
  3. Kalman Filtering — Smooths position estimate over time.
  4. Serial Output — The gateway sends synchronized readings to the computer for visualization.

📊 Simulation Results & Progress

Latest Antenna Simulation (Validation: 2026-04-16)

The antenna was simulated in MATLAB Antenna Toolbox, fabricated on FR4, measured with a LiteVNA, and evaluated in the positioning system. The report records the following results.

1. Built-in ESP32 Antenna Radiation Pattern

The built-in ESP32 antenna is the baseline used by the fixed anchors in the reported configuration.

ESP32 built-in antenna radiation pattern
Figure 5. ESP32 built-in trace-antenna radiation pattern

Why the Custom Antenna Is Needed

  • The built-in antenna pattern changes with board orientation, enclosure, cables, nearby metal, and the human body.
  • Fixed anchor measurements require a stable and repeatable antenna reference.
  • The custom 2.4 GHz patch provides a controlled and measurable alternative for the mobile node.
  • Comparing both antennas under the same anchor layout shows their effect on RSSI and position error.
  • The patch was designed for a direct 50 ohm match in simulation and later tested with lumped matching after fabrication.

2. Custom Antenna Simulation Results

Radiation Pattern Analysis

3D Radiation Pattern
Figure 6. Simulated 3D radiation pattern of the custom patch antenna

S11 (Return Loss) - Impedance Matching Validation

S11 Return Loss Plot
Figure 7. Simulated S11: −24.3 dB at 2.400 GHz

Impedance Characteristics

Impedance Smith Chart Impedance Exact Plot
Figure 8. Simulated impedance response for the inset-feed design

Radiation Pattern - Azimuth & Elevation Views

Azimuth Radiation Pattern Elevation Radiation Pattern
Figure 9. Simulated azimuth (left) and elevation (right) radiation patterns

Antenna Geometry & Current Distribution

Antenna Geometry Current Distribution
Figure 10. Simulated patch geometry (left) and surface current distribution (right)

3. Actual Antenna VNA Result Without Lumped Element

The fabricated antenna resonated at 2.600 GHz instead of the simulated 2.400 GHz. At 2.4 GHz, the bare antenna measured S11 of −1.41 dB and impedance of 64.62 + j22.21 Ω.

Figure 11. Bare antenna VNA S11 without lumped element Figure 12. Bare antenna VNA Smith chart without lumped element Figure 13. Bare antenna VNA SWR without lumped element

Figures 11-13. Actual fabricated antenna results without lumped element: S11, Smith chart, and SWR.

4. Actual Antenna VNA Result After Lumped-Component Matching

A series-L/shunt-C network using a 1.409 nH series inductor and 3.592 pF shunt capacitor improved S11 to approximately −12 dB with SWR of 1.61 to 1.64. The repository file is named ant_match_s11.jpeg.

Figure 14. Matched antenna VNA S11 with lumped component Figure 15. Matched antenna VNA Smith chart with lumped component Figure 16. Lumped-component matching calculation

Figures 14-16. Actual fabricated antenna results after lumped-component matching: S11, Smith chart, and matching calculation.

Configuration Resonance S11 Result
Simulation 2.400 GHz −24.3 dB Theoretical match
Fabricated without matching 2.600 GHz −1.41 dB at 2.4 GHz Poor match
Fabricated with lumped matching 2.535–2.595 GHz −12.28 to −11.97 dB Usable improvement

RSSI Calibration and Positioning Validation

Calibration used 20 measured grid positions with the log-distance model:

$$RSSI(d) = RSSI_0 - 10n\log_{10}(d)$$

Anchor RSSI0 (dBm) n R2 Residual sigma
A0 -45.2 2.08 ± 0.66 0.355 4.52 dB
A1 -46.7 2.16 ± 0.44 0.570 3.53 dB
A2 -42.0 2.26 ± 0.65 0.405 3.95 dB

The final evaluation used 416 out-of-sample fixes across an 18 m × 18 m area.

Metric OpenIPS Room-centroid baseline
Mean position error 3.81 m 7.94 m
Median position error 2.84 m
RMSE 4.80 m
90th-percentile error 8.46 m

Calibration fit plot · Position-error CDF

Visualization Software

The OpenIps/ TypeScript/Express application reads gateway serial CSV data, converts RSSI to distance, applies median filtering, performs trilateration and Kalman filtering, emits live Socket.IO updates, and stores movement history in Redis.

Feature Implementation
Serial input serialport at 115200 baud
Position processing Log-distance model, median filter, weighted trilateration, Kalman filter
Storage Redis locations and event history
Views /, /history, and /calibrate
API /api/v1/locations and /api/v1/ping

Dashboard main page
Figure 17. Live dashboard visualization

Dashboard workflow Dashboard calibration page

Figure 18. Dashboard software workflow. Figure 19. Dashboard calibration page.

Run the dashboard locally:

cd OpenIps
pnpm install
pnpm build
pnpm dev

Redis must be available before starting the server. See OpenIps/DOCUMENTATION.md, OpenIps/CALIBRATION.md, and OpenIps/KALMAN_FILTER.md.

🧪 Methodology & Project Phases

Phase Status Description
1. Design ✅ Complete TLM-derived patch dimensions (W, L, y₀, Wf)
2. Simulation ✅ Complete MATLAB Antenna Toolbox validation; S11 = −24.3 dB at 2.4 GHz
3. Fabrication ✅ Complete FR4 toner transfer, ferric-chloride etching, and SMA installation
4. Measurement ✅ Complete LiteVNA S11, impedance, SWR, and RSSI rotation testing
5. System Integration ✅ Complete ESP-NOW anchor/mobile/gateway chain with trilateration and Kalman filtering
6. Firmware Testing ✅ Complete ESP32-S3 firmware build and serial testing
7. Validation ✅ Complete 416 out-of-sample fixes compared with a room-centroid baseline

Key design principles applied throughout:

  • Change one antenna parameter at a time during tuning to avoid impedance collapse.
  • Minimize ground plane size and feed stub length, and use the coarsest acceptable mesh to keep simulation runtimes tractable.
  • Validate simulation timing on a single point before scaling to a full parametric sweep.
  • Comprehensive simulation validation before fabrication to ensure optimal antenna performance.

Project methodology
Project methodology and workflow


📁 Project Structure

OpenIPS/
├── Antenna_Simulations/             # MATLAB antenna model and result data
├── code/                            # PlatformIO ESP-NOW firmware
│   ├── include/common.h             # Shared MAC addresses and packet structures
│   ├── src/main.cpp                 # Gateway, mobile, and anchor roles
│   └── test/                        # Standalone radio test sketches
├── Media/                           # Reports, figures, measurements, and demos
│   ├── Docs/                         # Final and defence documents
│   ├── Simulation_Results/           # MATLAB plots and simulation data
│   ├── actual_antenna_result/        # VNA measurement images
│   ├── test_environment/             # Calibration and CDF results
│   └── visualization_software/       # Dashboard images and recordings
├── OpenIps/                          # TypeScript dashboard and backend
├── Test_code/                        # Earlier standalone ESP32 sketches
└── README.md

📚 Documentation & References

Key References

Reference Topic
C. A. Balanis, Antenna Theory (4th ed.) Primary antenna design reference
Cidronali et al., MIKON 2019 RSSI-based radiation pattern validation methodology
Almasi, 2024 Impact of antenna orientation on RSSI accuracy
Sadowski & Spachos, 2018 (IEEE Access) RSSI localization baseline

Institution

This project is developed as a Minor Project for the Bachelor's degree in Electronics Engineering, Tribhuvan University, Institute of Engineering (Pokhara).


📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License

Copyright (c) 2026 OpenIPS Project

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

👨‍💻 Author

Sarpharaj Dewan
💼 Embedded Systems & Robotics Enthusiast

YouTube pnpm install pnpm build pnpm dev ``` LinkedIn


⭐ Support the Project

If you found this project useful or interesting, please consider giving it a star!

GitHub Stars


"Finding your way, where satellites can't."

Made with ❤️ by OpenIPS team

About

ESP32 RSSI Based Indoor Positioning System

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages