Perfect Even Indoors Where GPS Fails! Building Your Own Indoor Positioning System with ESP32 and Wi-Fi CSI (A to Z)
We will easily and playfully teach you how to build your own indoor positioning system utilizing CSI technology that uses Wi-Fi signal reflections and the highly cost-effective ESP32 board, even indoors where GPS cannot reach.
You can build an experimental indoor location system using an ESP32 and Wi-Fi CSI even where GPS reception is poor. However, CSI does not provide coordinates directly: you must collect measurements at known locations and train a model. Here is a practical path from hardware setup to data collection, classification, and testing.
Key points before you begin
An ESP32 captures Wi-Fi channel state information (CSI).
Room-level classification is a more realistic first goal than precise indoor coordinates.
Espressif’s ESP-IDF and ESP-CSI examples provide a starting point for data collection.
Furniture, people, doors, and router placement can change the results.
How can Wi-Fi CSI work without GPS?
Channel State Information describes how wireless signals change while traveling through an environment, including variations in amplitude and phase. Signals bounce off walls, furniture, and people, producing patterns that can differ from place to place.
In a fingerprinting approach, you record CSI measurements at known reference locations and compare new measurements with those examples. The system predicts the closest matching area. Tracking a device and sensing where a person is standing are different tasks, so they require different experimental designs.
What hardware and software do you need?
Start with a CSI-capable ESP32 development board, a Wi-Fi transmitter such as a router or another ESP32, a USB cable, and a computer. Install the ESP-IDF development environment and a serial monitor. Python and data-analysis libraries can help you inspect and classify the results.
CSI features vary by chip and firmware version, so confirm support in the documentation for your exact board. Decide whether you will receive packets from an access point or use a dedicated transmitter before configuring the experiment.
Collect CSI data step by step
Install ESP-IDF and configure a project for your ESP32 target.
Start with an ESP-CSI receiver example and arrange for packets from a router or transmitting ESP32.
Enable CSI and configure its receive callback, CSI parameters, and collection mode.
Save incoming CSI measurements with timestamps and known location labels.
Repeat recordings at each location to build a dataset.
ESP-IDF exposes functions such as esp_wifi_set_csi_rx_cb(), esp_wifi_set_csi_config(), and esp_wifi_set_csi(). Avoid heavy processing inside the Wi-Fi receive callback; pass data to a queue for processing in another task.
Turn measurements into room predictions
Begin with classifying rooms rather than predicting exact map coordinates. For example, imagine dividing a test apartment into living room, bedroom, and kitchen zones. Record data in each zone while changing the sampling time and device orientation. This is an illustrative scenario, not a reported test.
Prepare the measurements by checking missing values, handling noise, and normalizing suitable features. You can then test a simple classifier such as K-nearest neighbors or random forest. Evaluate it on recordings from separate sessions, not just randomly mixed samples from the same recording.
What limits accuracy?
Opening a door, moving furniture, or having someone walk through the room may change the signal fingerprint. Keep your access point and receiver positions stable, capture diverse examples, and repeat calibration when the environment changes. Additional receiver locations may help, but performance must be measured in your own space.
Wi-Fi CSI does not automatically identify a person or guarantee accurate x–y coordinates. Presence detection and tracking a moving, instrumented device are distinct goals. If your measurements involve other people, explain the purpose and obtain appropriate consent.
Your first practical task
Check whether your exact ESP32 board supports CSI, then run an ESP-CSI receiver example and verify that measurements appear in the serial log. Once collection works reliably, label several areas and begin building the classifier.