# Mesh Node Dashboard - README This project provides a simple **real-time monitoring dashboard** for a 5x5 grid of mesh network nodes. It consists of: - A **Node.js server** that connects to an MQTT broker - A **WebSocket** connection between the server and browser clients - A **Frontend dashboard** (HTML/JavaScript) that displays the node status grid - Two **Python scripts** for simulating and sending node data over MQTT ## Project Structure ``` / (project root) |-- server.js # Node.js server backend (Express + MQTT + WebSocket) |-- node_addresses.sh # MAC and IP mapping for nodes |-- testbedconfigsender.py # Python script for sending a static test frame via MQTT |-- testbed_simu.py # Python script for simulating dynamic node data and sending via MQTT |-- public/ | |-- index.html # Frontend dashboard HTML | |-- dashboard.js # Frontend JavaScript (WebSocket client, UI updates) | |-- styles.css # Frontend styling (optional) |-- README.md # This file ``` ## Requirements - Node.js (v16 or later recommended) - MQTT Broker (e.g., Mosquitto) running locally (`localhost`) - Python 3.8+ - `paho-mqtt` Python package (for MQTT communication) ## Installation 1. Clone the repository: ```bash git clone cd ``` 2. Install Node.js dependencies: ```bash npm install express mqtt ws ``` 3. Install Python dependencies: ```bash pip install paho-mqtt ``` ## Running the Server 1. Ensure your MQTT broker is running on `localhost`. 2. Start the Node.js server: ```bash node server.js ``` The server will start at `http://localhost:3001/`. ## Frontend (Dashboard) Open your browser and go to: ``` http://localhost:3001/ ``` You will see a 5x5 grid representing the mesh nodes. Each node: - Shows its ID, CPU temperature, memory and CPU utilization, and uptime. - Updates based on MQTT messages. - Changes color based on activity: - **Light green** = Active (last seen within 60 seconds) - **Light coral** = Inactive (no updates within 60 seconds) ## Python Scripts - **testbedconfigsender.py** - Sends a predefined static JSON frame to the MQTT broker. - Useful for simple connectivity tests. - **testbed_simu.py** - Simulates node behavior with uptime increments and randomized CPU temperature, CPU utilization, and memory utilization. - Sends live dynamic updates every 5 to 10 seconds per node (random). - Reads `node_addresses.sh` for MAC addresses and neighbor information. ## MQTT Payload Format The server expects MQTT messages on the topic: ``` apu_tb/your_subtopics ``` Each message should be a JSON array with two parts: ```json [ { "uptime": 12345, "cpu_temp": 55, "mem_util": 17, "cpu_util": 9, "XPosition": 0, "YPosition": 0, "mesh0_neighbors": ["MAC1", "MAC2"], "mesh1_neighbors": ["MAC3", "MAC4"] }, { "id": "apu00" } ] ``` ## Development Notes - The `node_addresses.sh` script defines the IPs and MAC addresses for each node. - The server parses this script at startup to resolve neighbor relationships. - `public/` folder contains all frontend resources. - The Python scripts can be used to simulate live testbed behavior without physical hardware. ## Future Improvements (Ideas) - Allow clicking on a node to see detailed neighbor info - Rudimentary function already given (click on first node -> marked as 1, click on second node -> marked as 2 / then further click lets 2 move / delete markings with click on 1). - If only 1 is clicked, their direct links should be highlighted - If 1 and 2 are marked, both paths (mesh interface 1 and 2) should be marked - Create configuration tile. - When a node is marked with 1, its configuration is displayed. - Config should be changable and sent via button (MQTT/JSON) -> orientation to “testbed_config_sender.py”. - Implement node filtering/search - Show historical graphs for each node (lightweight database needed) ## License This project is for educational and research use. Feel free to modify and extend it as needed.