一个高中生的个人博客

Research on Mesh Adaptive Routing Optimization System Based on Self-Training AI

项目总览

Jump to :Modeling Papers

Project Documentation & Study Overview

1. Research background

At present, wireless mesh networks generally have the problem of strong signal but unstable connection. Traditional Zigbee, WIFI Mesh and other protocols rely on a single signal strength factor for routing selection, and cannot fully perceive key factors such as link packet loss rate, physical occlusion, and node load. Once encountered in dynamic interference such as wall occlusion and personnel movement, the network is easily interrupted, unable to adapt to changes/complex environments, and it is difficult to meet the communication needs in special environments.
This project changes the traditional single-factor decision-making model and builds an AI intelligent decision-making architecture. By deploying the random forest algorithm to the ESP32-C6 chip, it gives each node the ability to make independent decisions without cloud participation. The system integrates multi-dimensional features such as signal quality, link hop count, node load, and link stability to realize the leap from passive connection to active optimization, ensuring that the network remains robust, efficient, and self-healing in complex and volatile environments.


2. Project Overview

This project constructs an adaptive routing optimization system based on AI algorithms.
A scenario containing several walls and communication nodes was constructed by OMNet++ wireless network physics simulation software, and 6959 simulation training data were obtained. After that, a random forest algorithm was used to fit the training set data, and a mathematical model with a better fitting effect was obtained.
The model can be approximated as a function (f approximated by a random forest

DeliveryRatio=f(RSSI,Hop,Child,Loss)DeliveryRatio = f(RSSI, Hop, Child, Loss)

After the research, the obtained prediction algorithm is deployed on the ESP32-C6 microcontroller and experiments are carried out, The results show that the model obtained in this paper can better take into account the signal strength, link hop count, node load and other information when selecting the upper node, and then choose the node with better comprehensive quality for networking.
The algorithm can be applied to scenarios such as rapid networking deployment in large and complex environments, and has certain practical prospects.


3. Core highlights

1. Multi-feature fusion routing decision-making

Breaking through the traditional routing method that only relies on signal strength, integrating multi-dimensional features such as RSSI, transmission distance, link quality, and energy consumption, improving the accuracy of path decision-making.

2. Modular intelligent networking

Each ESP32-C6 is an independent unit, and the units communicate and negotiate with each other, and the training decision-making model synthesizes various actual data to estimate the node quality indicators, and finally the optimal topology network can be formed.
After networking, whether it is ESP32, C6, S3, C3, or 8266, mobile phones, tablets, and computers, they can be accessed through these nodes. At this time, these nodes play the role of network relay routing.

3. Train a fitting prediction model based on machine learning

Data acquisition by OMNeT++ wireless physics simulation tool,Using random forest training routing model,Decision coefficients:

R2=0.965047,MSE=0.001571\mathrm{R}^2 = 0.965047, \mathrm{MSE} = 0.001571

Achieve high-precision path quality prediction.

4. AI edge deployment

Deploy models to ESP32-C6 nodes,Realize local real-time inference, No cloud participation, Improve the response speed and convenience of model decision-making.

5. 3D modeling and printing + PCB design

The terminal housing will be designed using 3D modeling and printing technology, integrated lithium batteries and charge/discharge modules, and circuit integration will be achieved by soldering individual components to the designed and proofed PCB circuit board.

6. Real-time monitoring of cloud data/structure

Combined with the Python Flask framework, the server is built and the backend is built and the server is deployed on the Linux cloud server through Docker containerization, Debian-12.0 is written, and the front-end page is written through Vue.JS to realize real-time monitoring of network topology and node information.


4. Comparison diagram with traditional network connection methods

1. Normal situation

2. Unexpected situations that may be encountered( Signal blocking or long distance Signal Weak )

Comparison Diagram 1,2: The advantages of this innovative solution are obvious, Due to the combination of the trained AI model, this project has the ability to adapt to the environment and automatically optimize the network topology structure in a changing environment, and has stronger adaptability, flexibility, and predictability.


5. Application prospects

  • Emergency communication at the scene of disasters( Base station-free environment)
  • Smart IoT Network
  • Industrial Low Power Monitoring Networks
  • Smart Home Self-Organizing Network

Research Diary

1. Topic selection

Status:
At present, wireless mesh networks generally have a strong signal but unstable phenomenon.
The problem:
Traditional protocols rely on a single signal strength for routing selection, and cannot fully perceive key factors such as link packet loss rate, physical occlusion, and node load.
Research Objectives:
Build a robust, efficient, and self-healing intelligent mesh network system.


2: Simulation environment construction and data collection

OMNet++ wireless network physical simulation software is used to build the scenario.
The simulation logic is based on the following assumptions:

  1. The scene is a two-dimensional room,Gateway, terminal, relay, and wall are randomly generated in each round.
  2. The wall is simplified into line segments, whether the link is “ through the wall, and the signal attenuation is linearly accumulated with the number of wall penetration.
  3. Networking as a tree structure , Primary gateway as the root node
  4. The number of hops is defined as the length of the path from the trunk to the gateway, the number of sub-devices is defined as the number of direct child nodes of the trunk in the tree,
  5. Weakening effect of walls on signals Calculated using a modified model of logarithmic distance path loss model
PL=PL0+10nlog10(dd0)+NwallAwallPL = PL_0 + 10n \log_{10}\left(\frac{d}{d_0}\right) + N_{\text{wall}} \cdot A_{\text{wall}}
  1. The more sub-devices a relay node has, the greater the load on the node, and the higher the probability of packet loss.
  2. There is a certain possibility of packet loss in every relay forwarding process.

Based on the above assumptions:
Writing simulation logic in C++ , Including random environment generation( Location of gateways, terminals, relay nodes, and walls, RSSI and hop calculations from terminals to each trunk and trunk to gateway path, the impact of sub-device load on link success rate, relay probability packet loss, statistical simulation packet reachability, and CSV result output (RSSI, hop count, number of sub-devices, node-to-gateway packet loss rate, reachability rate)


3: Data processing, AI model training and optimization

( One ) Data Preprocessing

The data contains a total of 6959 records,Each record consists of 5 fields:

  • Signal Strength(RSSI_dBm)
  • Hop Count
  • Number of Node Subnodes(ChildCount)
  • NodeToGatewayLossRate(NodeToGatewayLossRate)
  • Terminal Packet Reachability Rate(DeliveryRatio)
    RSSI_dBm, HopCount, ChildCount, and NodeToGatewayLossRate are the features.
    Endpoint and gateway reachability DeliveryRatio as a label for model predictions(Target variable).
    Read csv data through the pandas library in Python.

( 2 ) Divide the training set and the test set

20% of the randomized data is the test set, and the other 80% is the training set.

( Three ) Algorithm Fitting

Using the scikit-learn library in Python, linear regression, polynomial regression, and random forest algorithms are constructed separately.

( Four ) Result Analysis

(1) Linear regression

R2=0.622295,MSE=0.016977\mathrm{R}^2 = 0.622295, \mathrm{MSE} = 0.016977

The fitting effect is weak, and the linear relationship between the feature data and the label data is not obvious.

(2) Polynomial regression ( Quadratic )


According to the images, the fitting effect is slightly better than that of linear regression, but the negative value is predicted to be lower than that of the model, and there is an overfitting phenomenon.

R2=0.836970,MSE=0.007328\mathrm{R}^2 = 0.836970, \mathrm{MSE} = 0.007328

(3) Random Forest


Due to the nonlinear relationship between features and labels, and the presence of noise in the sample, the algorithm is analyzed to be a predictive method that meets the requirements.

R2=0.965047,MSE=0.001571\mathrm{R}^2 = 0.965047, \mathrm{MSE} = 0.001571

4. Hardware development and deployment

Core:
Select the ESP32-C6 microcontroller as the core control unit. Deploy the trained prediction algorithm to the ESP32-C6 node. Refine the basic logic.
Structure:
Design of terminal housings using 3D modeling and printing technology. Completion of PCB circuit board design and proofing.
Features:
Integrated lithium battery and charging and discharging module switch OLED screen.
Networking Capability:
Each ESP32-C6 is an independent unit that communicates with each other to form an optimal topological network.
It is compatible with ESP32 series(C6/S3/C3/8266) and mobile phones, tablets, computers and other terminals.


5: Cloud monitoring system construction

Backend:
Combine the Python Flask framework to build a server.
Deploy on Linux cloud server via Docker containerization(Debian-12.0).
Front:
Write a front-end page using Vue.JS.
Real-time monitoring of network topology and node information is realized, including node number, number of sub-devices, packet loss rate, RSSI and other data display.
The back-end log can record data receipt in real time, such as POST /api/data request processing.


6: Optimize the system and fix problems

Organize the parts of the program, find and fix logic and detail errors, optimize the system, and add some meaningful features.