DWG-001 RTLS — LoRaWAN Positioning System

IoT Real-Time
Location System

Engineering specification for a distributed LoRaWAN signal processing platform. Converts RSSI radio signals into real-time indoor positioning coordinates through an event-driven microservices architecture.

CONFIDENTIAL — PRIVATE PROJECT
Detail A — Overview

System Overview

The system receives radio signals from LoRaWAN tracking devices via relay beacons and a network gateway. These signals are ingested from a RabbitMQ message broker, filtered, and processed through RSSI-based positioning algorithms to determine the indoor coordinates of each tracker.


Computed positions are streamed in real time to connected clients via Server-Sent Events (SSE), enabling live visualization of device movement on interactive floor plan interfaces. The entire pipeline operates as a set of loosely-coupled microservices communicating through Redis Pub/Sub.

Detail B — Architecture

System Architecture

Input
LoRaWAN Trackers
Broadcast radio packets with RSSI payloads at regular intervals
Bridge
Gateway
Demodulates radio signals and forwards via MQTT to message broker
Broker
RabbitMQ
AMQP exchange distributing device payloads to subscribed consumers
▼ AMQP Subscribe
Service A
Consumer
Filters, validates, and routes packets to Redis Pub/Sub channels
Service B
Calculations
RSSI → distance conversion, trilateration, coordinate generation
Service C
SSE Manager
Manages client sessions and streams live position updates via SSE
▼ Redis Pub/Sub + REST
Service D
API Gateway
REST API for auth, CRUD, floor plans, and database operations
Storage
PostgreSQL
Persistent data store for devices, beacons, floor plans, and users
Client
React Frontend
Interactive floor plan UI with real-time device position rendering
Detail C — Services

Microservices Breakdown

SVC-01
Consumer Service

Subscribes to the RabbitMQ exchange to ingest raw LoRaWAN payloads. Performs packet filtering — discarding malformed or duplicate frames — validates RSSI readings, and routes cleaned messages to their respective Redis Pub/Sub channels based on payload type.

Node.js RabbitMQ Redis AMQP
SVC-02
Calculations Engine

Subscribes to Redis channels with calculation payloads containing RSSI values from multiple relay beacons. Converts RSSI to distances via path-loss models, then applies trilateration to compute (x, y) positioning coordinates. Results are published to post-calculation channels.

Node.js Redis Pub/Sub Mathematics
SVC-03
API Gateway

RESTful API managing all client-facing operations: authentication via JWT, CRUD for devices, beacons, floor plans, workspace management, and PostgreSQL database interactions. Serves as the primary bridge between the frontend client and persistent storage.

NestJS PostgreSQL REST JWT Auth
SVC-04
SSE Connection Manager

Manages persistent Server-Sent Event connections with frontend clients. When a user starts a live tracking session, this service opens an SSE stream and dispatches real-time position updates, enabling smooth, animated device movement on floor plan visualizations.

NestJS SSE Redis Sub EventSource
Detail D — Calculations

Positioning Algorithms

RSSI → Distance (Path Loss Model)

Each relay beacon reports an RSSI value (dBm) for the tracker's signal. The log-distance path loss model converts this to an estimated distance:

d = 10 ^ ((RSSI_ref − RSSI_measured) / (10 × n))

d = estimated distance · RSSI_ref = reference RSSI at 1m · n = path loss exponent (2–4, environment-dependent)

Trilateration

With distances from ≥3 beacons at known positions (x₁,y₁), (x₂,y₂), (x₃,y₃) with distances d₁, d₂, d₃:

(x − xᵢ)² + (y − yᵢ)² = dᵢ² → linearize and solve for (x, y)

Equations are linearized by subtracting pairs. With >3 beacons, least-squares estimation improves accuracy through redundancy.

Weighted Centroid Fallback

When fewer than 3 reliable readings are available, the system uses a weighted centroid approach:

pos = Σ(wᵢ × posᵢ) / Σ(wᵢ) where wᵢ = 1 / dᵢ²

Beacon positions are weighted inversely by distance, providing a reasonable estimate while degrading gracefully.

Detail E — Pipeline

End-to-End Data Flow

01
Signal Transmission
LoRaWAN trackers broadcast radio packets at regular intervals. Each payload contains the device ID and RSSI values as received by nearby relay beacons.
02
Gateway Processing
The LoRaWAN gateway demodulates radio signals and forwards structured packets to RabbitMQ via the MQTT bridge.
03
Consumer Filtering
Consumer validates packets, filters duplicates and malformed data, then publishes cleaned RSSI payloads to Redis Pub/Sub channels.
04
Position Calculation
Calculation service applies path-loss models and trilateration, publishing resulting (x, y) coordinates to post-calculation Redis channels.
05
SSE Streaming
SSE Manager matches results to active sessions and pushes position updates via persistent EventSource connections to browsers.
06
Front-End Rendering
React client animates device markers to new coordinates on the floor plan using CSS transitions, creating fluid real-time tracking.
Detail F — Live Feed

SSE Data Stream

The front end connects via the browser's native EventSource API. Each event carries updated device coordinates. The UI applies transition: transform 0.3s ease to tracker markers, enabling smooth animated movement as positions update every ~1–2 seconds.

LIVE — EVENT STREAM ACTIVE
Detail G — Specifications

Technical Specifications

Communication Protocol
LoRaWAN (Long Range Wide Area Network)
Message Broker
RabbitMQ (AMQP 0-9-1)
Inter-Service Comm.
Redis Pub/Sub
Positioning Method
RSSI Trilateration + Weighted Centroid
Backend Framework
NestJS (TypeScript)
Frontend Framework
React (TypeScript)
Database
PostgreSQL
Client Streaming
Server-Sent Events (SSE / EventSource)
Deployment
Docker Compose / Multi-container
Update Frequency
~1–2 second intervals
Architecture Style
Event-driven Microservices
Authentication
JWT (httpOnly cookies)