This project demonstrates a mesh network solution for disaster-affected areas where traditional communication infrastructure is unavailable. The system leverages IoT devices (e.g., ESP8266), desktops, Raspberry Pi, and mobile devices to form an ad-hoc mesh network, enabling decentralized communication in emergency scenarios.
- Ad-hoc Mesh Networking: Devices form a decentralized network, automatically discovering and connecting with peers.
- UDP-based Communication: Lightweight and efficient message exchange using UDP protocol.
- Message Rebroadcasting: Ensures messages propagate through the network.
- Device Interoperability: Supports platforms like ESP8266, Raspberry Pi, laptops, desktops, and Android devices.
- Flood Protection: Prevents message duplication using unique IDs and a history log.
- Message Acknowledgment: Ensures message reliability and traceability.
Messages transmitted over the UDP protocol include the following structure: [Message ID] | [Origin Device ID] | [Message Content]
- Message ID: Unique identifier for each message, composed of the device’s
DEVICE_ID
and a random suffix (e.g.,123abc-5678
). - Origin Device ID: The unique ID of the device that originated the message.
- Message Content: The actual communication payload.
123abc-5678 | 123abc | Emergency at Location X
- Uniqueness: Prevents message duplication.
- Traceability: Identifies the source of the message.
- Data Integrity: Ensures meaningful communication.
- Language: Arduino C++
- Functionality:
- Operates as a SoftAP (Hotspot) or connects to open Wi-Fi networks.
- Sends and receives UDP messages using the specified header structure.
- Rebroadcasts messages to ensure network-wide communication.
- Tracks message history to prevent flooding.
- Platform: Java Swing
- Purpose: Provides a user-friendly interface for desktops, laptops, and Raspberry Pi.
- Functionality:
- Acts as a client node in the mesh network.
- Allows manual message input and displays received messages.
- Visualizes network activity and message propagation.
- Platform: Android
- Purpose: Extends the mesh network's functionality to mobile devices.
- Functionality:
- Provides a mobile-friendly interface for sending and receiving messages.
- Displays network activity in real-time.
- Offers push notifications for incoming messages.
- Integrates with Wi-Fi APIs for dynamic connection management.
- Connect the ESP8266 to your computer.
- Open the provided code (
ESP8266_MeshNetwork.ino
) in the Arduino IDE. - Configure the
SSID
andUDP_PORT
if required. - Upload the code to the device.
- Power the device and observe the serial monitor for network activity.
- Compile and run the
MeshNetworkClient.java
file. - Connect the device to the same Wi-Fi as the mesh network.
- Start communicating via the GUI.
- Import the project into Android Studio.
- Open
MainActivity.java
and ensure the necessary dependencies are installed. - Build and install the APK on your Android device.
- Connect the mobile device to the mesh network Wi-Fi.
- Start the app to send and receive messages.
-
Network Formation:
- Each ESP device creates an open SoftAP network.
- Devices scan for and connect to nearby open networks, forming a mesh.
-
Message Transmission:
- Messages are tagged with unique IDs (
DEVICE_ID
+ Random Suffix). - Sent messages are broadcasted over the mesh using UDP.
- Messages are tagged with unique IDs (
-
Message Handling:
- Devices receiving messages check for duplication using the
Message ID
. - Non-duplicate messages are acknowledged and rebroadcasted.
- Devices receiving messages check for duplication using the
-
Java Client:
- Connects to the mesh network.
- Allows users to view, send, and track messages in real-time.
-
Android App:
- Acts as a portable node in the mesh.
- Facilitates mobile-based interaction for disaster management.
- Real-time communication during disaster recovery.
- Ad-hoc networks for outdoor events or remote areas.
- Educational demonstrations of decentralized communication systems.
- Wi-Fi Management: Scans and connects to open networks.
- Message Handling: Displays, sends, and notifies users about messages.
- Location Integration: Tags messages with geographical context if needed.
- Permissions: Manages Android permissions for smooth functionality.
- Broadcast Receivers: Listens for network changes to maintain connection.
- Graphical Interface: Displays and allows message inputs via GUI.
- UDP Communication: Sends, receives, and rebroadcasts messages.
- Concurrency: Uses multithreading for efficient message handling.
- Network Visualization: Displays live network activity and history.
- Cross-Platform: Compatible with laptops, desktops, and Raspberry Pi.
Feel free to contribute or report issues in the GitHub repository. Happy coding! 🌐