Mesh network enables devices in your network to have faster speeds, greater coverage, and a more reliable connection.  The units (called “nodes”) will capture and rebroadcast the router’s signal. If nodes are removed from the network, it should self-heal, and route around the damage. The result is an efficient wireless network that provides a strong signal no matter where you are. 

I started with this project by configuring a serial communication with just two ESP32 micro-controllers using Arduino IDE and "painlessmesh" library. The two devices sent hello packets to each other every 5 seconds. The packets were analysed on the serial monitor. 

The next ting I was able to achieve was serial communication between five ESP32 thus forming a mesh network. I used Tera term to capture and analyse the packets. 

This mesh network is then connect to the home Wi-Fi in order to have the network connect to the Internet. During this milestone I faced a couple of challenges. For this to work you need a Wi-Fi router. In my case, I was using the xfinity hotspot which caused problems. Hence, I decided to create an external webpage server. 

The nodes (ESP32s) are configured with an IP address such as 192.168.4.1. When a mobile device is connected to the mesh network and when it enters the configured IP address, a webpage opens with a "message received" header. 

I wanted to figure out a way on how IoT devices would communicate with each other without the interference of a routing device. The devices should be able to form its own lookup table and route data between nodes. I tried a couple of protocols such as ESP-NOW and ESP- MQTT. I also looked at ways on how routers and switches work and I came across ARP (address resolution protocol) lookup table. 

I did code an ARP table in python. Whenever a router receives an ARP request, it makes an entry in its ARP table, assigning  local IP address of the client with its associated MAC address. I was not able to execute this in Arduino.

Looking at how google mesh network actually works, I realized that I need to configure multiple access points in order to have a robust Wi-Fi connection. With the bits and pieces of code I had done earlier, I was able to configure ESP32 as an AP as well as be connected to other nearby mesh nodes.

For testing purpose, I used my mobile device which would automatically connect to the nearest AP. I then tried to open the webpage from the device and it worked. 

A wireless mesh network (WMN) is a particular type of mobile ad hoc network (MANET). A pure MANET is dynamically formed by mobile devices without the requirement of any existing infrastructure or prior network configuration. Similar to WMN, a MANET also has the ability of self-organization, self-discovering, self-healing, and self-configuration. However, a WMN is typically a collection of stationary mesh routers (MRs) with each employing multiple radios. 

Future directions - Expanding this project by configuring ESP32 as a node in the mesh using Dynamic source routing protocol which is used in a MANET. 

Reference Links to get started with

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/mesh.html

https://www.espressif.com/en/products/software/esp-now/overview (using ESP-NOW protocol)

#include "painlessMesh.h"
#include <WiFi.h>

#define   MESH_PREFIX     "whateverYouLike"
#define   MESH_PASSWORD   "somethingSneaky"
#define   MESH_PORT       5555


// Replace with your network credentials
const char* ssid     = "ESP32-Access-Point";
const char* password = "123456789";


Scheduler userScheduler; // to control your personal task
painlessMesh  mesh;
// User stub
void sendMessage() ; // Prototype so PlatformIO doesn't complain

Task taskSendMessage( TASK_SECOND * 1 , TASK_FOREVER, &sendMessage );

void sendMessage() {
  String msg = "Hello from node ";
 msg...
Read more »