← all projects
Embedded / Distributed Systems

ESP32 Multi-WAN Load Balancer

Distributed network load balancer using 5 ESP32 microcontrollers to manage traffic across multiple internet connections (Starlink, MTN 5G, Airtel 5G). Real-world load balancing, failover, health monitoring, and distributed-systems concepts on bare metal.

A 5-board ESP32 mesh that load-balances and fails over across Starlink + MTN 5G + Airtel 5G with five algorithms, sub-10s failover, ESP-NOW inter-board communication, SD-card logging, and a web admin dashboard.

Problem Statement

In places where no single internet link is reliable (e.g. Nigeria — Starlink + MTN 5G + Airtel 5G each drop intermittently), you want to bond multiple WANs: spread traffic across them, detect when one degrades, and fail over fast — ideally without an expensive enterprise SD-WAN appliance. Doing this on cheap microcontrollers is a genuine distributed-systems exercise on constrained hardware.

Proposed Solution

A distributed load balancer built from 5 ESP32 boards that collectively manage traffic across multiple internet connections. It implements several load-balancing algorithms, automatic failover, real-time health monitoring (latency, bandwidth, packet loss), an ESP-NOW mesh for inter-board communication, SD-card logging with rotation, and a web admin dashboard for monitoring and control.

Full Solution Details

  • Multiple algorithms — Round Robin, Weighted, Least Connections, Latency-Based, and Adaptive.
  • Automatic failover — sub-10-second failover when a connection fails.
  • Real-time health monitoring — latency, bandwidth, and packet-loss tracking per link.
  • ESP-NOW mesh — reliable inter-module communication between the 5 boards.
  • Web admin interface — responsive dashboard to monitor and control the cluster.
  • Logging — SD-card logging with rotation and alerting.
  • Traffic analytics — real-time analysis and statistics.
  • Hardware — 5× ESP32 (WROOM/S3), a MicroSD for the monitor module, optional external antennas, stable 5V supply.

Technical Documentation

Written in C++ on the Arduino/ESP32 toolchain. The system is genuinely distributed: each ESP32 plays a role and they coordinate over ESP-NOW (a connectionless ESP peer-to-peer protocol), with one module acting as the monitor/logger (SD card). The balancer continuously probes each WAN's health (latency/bandwidth/loss) and the active algorithm uses those signals to route — the Adaptive strategy combining them dynamically — while the failover path swaps away from a dead link in under 10s. A web server on-device serves the admin dashboard. This is hard-mode engineering: real networking concepts (load balancing, health checks, failover, distributed coordination) implemented under tight memory/CPU/connectivity constraints on commodity microcontrollers.

Tech Stack

C++, ESP32 (WROOM/S3), ESP-NOW mesh protocol, Arduino framework, SD-card logging, on-device web server; WiFi/5G/Starlink WAN links.

System Design

  Starlink   MTN 5G   Airtel 5G   (WAN links)
     │         │          │
     ▼         ▼          ▼
  ESP32-1   ESP32-2    ESP32-3   ...   (per-link nodes)
     └──────── ESP-NOW mesh ─────────┘
                  │ health: latency / bandwidth / loss
                  ▼
  Balancer (RoundRobin | Weighted | LeastConn | Latency | Adaptive)
     │  failover <10s on link death
     ▼
  Monitor module → SD-card logging (rotation, alerts) + web admin dashboard

Smart Architectural Decisions

  • Distributed-by-design on microcontrollers. Splitting the job across 5 boards coordinated over ESP-NOW (instead of one overloaded board) is the distributed-systems heart of the project — and ESP-NOW is the right low-overhead choice for board-to-board comms.
  • Health-signal-driven routing. Routing on measured latency/bandwidth/loss (not just round-robin) — culminating in an Adaptive algorithm — is exactly how real SD-WAN works, recreated on bare metal.
  • Sub-10s failover prioritizes the user-visible failure mode (a dead link) and proves the health-monitoring loop actually drives action.
  • On-device web dashboard + SD logging give observability without external infrastructure — pragmatic for a standalone appliance.
  • Commodity-hardware framing (cheap ESP32s vs. enterprise SD-WAN) is a clever cost story for unreliable-connectivity regions.

Impacts

Demonstrates real networking and distributed-systems engineering — load balancing, failover, health monitoring, and inter-node coordination — on $5 microcontrollers, bonding multiple unreliable WANs into a more dependable connection.

Demonstrated Skills

Embedded C++/ESP32 firmware; distributed-systems coordination (ESP-NOW mesh, multi-node roles); networking fundamentals (load-balancing algorithms, health checks, failover, packet-loss/latency measurement); on-device web server + SD logging; hardware bring-up and constraint-aware engineering.

Notes

  • Breadth into hardware + networking: firmware on 5 coordinated ESP32s implementing real load-balancing/failover is a dramatic departure from web work and signals genuine range and curiosity.
  • Real CS fundamentals, not framework glue: load-balancing algorithms, health-driven adaptive routing, sub-10s failover, and distributed coordination over ESP-NOW are exactly the concepts senior interviewers love to probe — here implemented from scratch.
  • Constraint engineering: doing distributed systems on memory/CPU-limited microcontrollers shows he can reason about resources, not just call APIs.
  • Great story: bonding Starlink + 5G with cheap microcontrollers for unreliable-connectivity regions is memorable and practically motivated.
Ask me anything