diff --git a/docusaurus.config.js b/docusaurus.config.js index a2ce46c..95aab02 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -68,6 +68,16 @@ const config = { editUrl: 'https://github.com/hardwario/docs/edit/main', }), ], + [ + '@docusaurus/plugin-content-docs', + ({ + id: 'fiber', + path: 'fiber', + routeBasePath: 'fiber', + sidebarPath: require.resolve('./sidebars-fiber.js'), + editUrl: 'hhttps://github.com/hardwario/docs/edit/main', + }), + ], [ '@docusaurus/plugin-ideal-image', { @@ -115,6 +125,12 @@ const config = { position: 'left', activeBaseRegex: `/cloud/`, }, + { + to: 'fiber/', + label: 'FIBER', + position: 'left', + activeBaseRegex: `/fiber/`, + }, { href: 'https://github.com/hardwario/docs', label: 'GitHub', diff --git a/fiber/configuration.md b/fiber/configuration.md index 40d2a2f..8e4a1ba 100644 --- a/fiber/configuration.md +++ b/fiber/configuration.md @@ -2,12 +2,11 @@ slug: configuration title: FIBER Configuration File --- - import Image from '@theme/IdealImage'; # Configuration File -The configuration file is located on the FIBER device within the config directory and is named config.yaml. This file contains parameters that govern various aspects of FIBER's operation, such as network interfaces, sensor data collection intervals, MQTT communication settings, and data storage preferences. +The configuration file is located on the **FIBER** device within the config directory and is named **config.yaml**. This file contains parameters that govern various aspects of **FIBER**'s operation, such as network interfaces, sensor data collection intervals, MQTT communication settings, and data storage preferences. ## Overview of Configuration Parameters @@ -47,3 +46,4 @@ storage: ``` To modify the configuration file, you must access the FIBER device. Once you have access, navigate to the **config** directory and edit the **config.yaml** file using a text editor, command line tools, or through Docker. + diff --git a/fiber/installation-setup.md b/fiber/installation-setup.md index c6e9242..652440a 100644 --- a/fiber/installation-setup.md +++ b/fiber/installation-setup.md @@ -6,186 +6,83 @@ import Image from '@theme/IdealImage'; # FIBER Installation -This article provides instructions on bootstrap and configuring the Linux system on Compute Module 4. The instructions below assume the Linux host environment. +This article provides instructions on bootstrap and configuring the Linux system on **Compute Module 4**. The instructions below assume the Linux host environment. This article uses the term host - a Linux-based PC which configures the target (FIBER version 2 hardware). ## Install Image -- Download image -- Uncompress the image -- Install image to FIBER - - Connect the PoE adapter to the target. - - Connect the Mini USB cable between the host and the target. - - Use a jumper to short the BOOT pins on the mainboard. - - Shortly press the RESET tact switch on the rear side of the mainboard. - - Now Compute Module 4 should start in the bootloader mode. - - Remove the jumper from the BOOT pins on the mainboard. -- Flash the image -- Set up network connection +1. Download image +2. Uncompress the image -## Network Connection Setup - -To start FIBER, follow the instructions below depending on your preferred connection method: - -### Wi-Fi Connection - -If you are connecting FIBER to your network via Wi-Fi, follow these steps: - -- Connect your FIBER device to the PoE port of the PoE adapter. -- Wait for the device to establish a Wi-Fi connection with your network. -- Determine the IP address. -- Log in to the target (password *`fiber`*): - ```sh - ssh root@[ip address] - ``` -- Wait for approximately a minute for FIBER to establish a connection with your network. - -### Ethernet Connection - -If you are connecting FIBER to your network via Ethernet, follow these steps: - -- Connect one Ethernet cable from the PoE adapter's LAN port to your router or switch. -- Connect another Ethernet cable from the PoE adapter's port to the FIBER device. -- Determine the IP address. -- Log in to the target (password *`fiber`*): - ```sh - ssh root@[ip address] - ``` -- Wait for approximately a minute for FIBER to establish a connection with your network. - -### Static IP Address Connection - -If your company utilizes a static IP address for FIBER connections, follow these steps: - -- Update Configuration File (system section) - - Set static_ip to True. - - Replace the following placeholders with your network details: address (Your static IP address), netmask, gateway, dns. -- Depending on the type of Ethernet or Wi-fi connection, use the instructions for them above. - -## Development Environment Setup +3. Install image to **FIBER** -This section outlines the process of configuring the development environment to facilitate work on the FIBER project. Follow these steps to ensure a smooth and efficient development experience with FIBER. + - Connect the **PoE adapter** to the target. + + - Connect the **Mini USB cable** between the host and the target. -### 1. Clone Project Repository Locally from GitLab + - Use a jumper to short the **BOOT pins** on the mainboard. -[https://gitlab.hardwario.com/Fiber-v2/application](https://gitlab.hardwario.com/Fiber-v2/application) clone to local/path/to/project + - Shortly press the **RESET tact switch** on the rear side of the mainboard. -### 2. Create Dockerfile and Build Docker Container + - Now **Compute Module 4** should start in the bootloader mode. -#### 2.1 Install Docker + - Remove the jumper from the **BOOT pins** on the mainboard. -**For Windows and macOS:** +4. Flash the image -- Download Docker Desktop from the official Docker website. -- Start Docker Desktop and wait for Docker Engine to fully start. +5. Set up network connection -**For Ubuntu:** -```terminal -sudo apt update -sudo apt install -y docker.io -``` - -#### 2.2 Create Dockerfile - -```Dockerfile -# Specify the base image, in this case Python 3.10 slim -FROM python:3.10-slim - -# Update the package list and install necessary dependencies -RUN apt-get update && apt-get install -y \ - build-essential \ - libffi-dev \ - libgpiod-dev \ - python3-dev \ - gcc \ - libc-dev \ - libncurses5-dev \ - libncursesw5-dev \ - ansible \ # Install Ansible for automating configuration management - sshpass \ # Install sshpass for passing SSH password in scripts - sudo # Install sudo for executing commands with superuser privileges - -# Install Poetry - a tool for managing Python dependencies -RUN pip install poetry - -# Set the working directory to /app -WORKDIR /app +## Network Connection Setup -# Create a volume to persist data inside the container -VOLUME /app +To start **FIBER**, follow the instructions below depending on your preferred connection method: -# Disable virtual environment creation for Poetry, as we are using a container -RUN poetry config virtualenvs.create false -``` +### Wi-Fi Connection -#### 2.3 Start Docker Container +If you are connecting **FIBER** to your network via **Wi-Fi**, follow these steps: -1. Navigate to the project directory: +1. Connect your **FIBER** device to the PoE port of the PoE adapter. - ```sh - cd local/path/to/project - ``` +2. Wait for the device to establish a Wi-Fi connection with your network. -2. Build the Docker image: +3. Determine the IP address. - ```sh - docker build -t image-name . - ``` +4. Log in to the target (password *`fiber`*): -3. Run the Docker container: + ```bash + ssh root@[ip address] + ``` - ```sh - docker run -it -v ${PWD}:/app --name container-name image-name bash - ``` +5. Wait for approximately a minute for **FIBER** to establish a connection with your network. -4. If the container is stopped, start it and open a bash session: +### Ethernet Connection - ```sh - docker start container-name ; docker exec -it container-name bash - ``` +If you are connecting **FIBER** to your network via **Ethernet**, follow these steps: - _Please replace image-name and container-name with the desired names. Ensure that you execute docker build and docker run commands with administrator privileges if Docker Desktop is running without administrator rights (Windows and macOS)._ You'll be able to work with the project inside this container, and any changes you make will be reflected immediately in the local file system. -### 3. Put the project in the FIBER +1. Connect one Ethernet cable from the PoE adapter's LAN port to your router or switch. -1. You need to copy the local project to your target: +2. Connect another Ethernet cable from the PoE adapter's port to the **FIBER** device. - ```sh - scp -r local/path/to/project/* root@[ip address]:/app/ - ``` +3. Determine the IP address. -2. Log in to the target +4. Log in to the target (password *`fiber`*): - ```sh + ```bash ssh root@[ip address] ``` -3. Run the installation script using the following command: - - ```sh - /app/scripts/install.sh - ``` +5. Wait for approximately a minute for **FIBER** to establish a connection with your network. - The program must be running. -#### Additional information - -1. View logs journal - - ```sh - journalctl -u fiber-core.service - ``` +### Static IP Address Connection -2. Restart the service +If you utilize a **static IP** address for **FIBER** connections, follow these steps: - ```sh - systemctl restart fiber-core.service - ``` +1. Update Configuration File (system section) -3. Stop the service + - Set `static_ip` to `True`. + - Replace the following placeholders with your network details: `address` (Your static IP address), `netmask`, `gateway`, `dns`. - ```sh - systemctl stop fiber-core.service - ``` \ No newline at end of file +2. Depending on the type of Ethernet or Wi-fi connection, use the instructions for them above. diff --git a/fiber/introduction.md b/fiber/introduction.md index 0d0e509..eb913ad 100644 --- a/fiber/introduction.md +++ b/fiber/introduction.md @@ -7,15 +7,18 @@ import Image from '@theme/IdealImage'; # Introduction -FIBER is an IoT device designed to provide precise temperature measurements in industrial settings. It connects to various sensors via cables and computes temperature data which is displayed to the user. The product supports connectivity through WiFi or Ethernet and enables extensive device networking. Data from connected sensors is aggregated and displayed, showing detailed metrics such as average, median, minimum, and maximum values at given timestamps. +**FIBER** is an IoT device designed to provide precise temperature measurements in industrial settings. It connects to various sensors via cables and computes temperature data which is displayed to the user. The product supports connectivity through WiFi or Ethernet and enables extensive device networking. Data from connected sensors is aggregated and displayed, showing detailed metrics such as average, median, minimum, and maximum values at given timestamps. ## Key Highlights ### Advanced Temperature Monitoring: -FIBER boasts the capability to interface with up to eight temperature sensors concurrently. Through meticulous data processing, users gain access to comprehensive metrics including averages, medians, and extrema, facilitating nuanced environmental analysis. + +**FIBER** boasts the capability to interface with up to eight temperature sensors concurrently. Through meticulous data processing, users gain access to comprehensive metrics including averages, medians, and extrema, facilitating nuanced environmental analysis. ### Versatile Connectivity: -Seamlessly integrating into diverse network architectures, FIBER supports both WiFi and Ethernet connectivity options. This versatility ensures effortless deployment and integration within existing infrastructures, delivering a robust and adaptable solution. + +Seamlessly integrating into diverse network architectures, **FIBER** supports both **WiFi** and **Ethernet** connectivity options. This versatility ensures effortless deployment and integration within existing infrastructures, delivering a robust and adaptable solution. ### Intuitive User Interface: -Driven by user-centric design principles, FIBER features an intuitive interface that grants users direct access to critical temperature data. Displayed on an screen adorned with LED indicators, information is presented in a clear and accessible manner, enabling swift decision-making. + +Driven by user-centric design principles, **FIBER** features an intuitive interface that grants users direct access to critical temperature data. Displayed on an screen adorned with LED indicators, information is presented in a clear and accessible manner, enabling swift decision-making. diff --git a/fiber/mqtt-broker.md b/fiber/mqtt-broker.md index 811447d..35f7b21 100644 --- a/fiber/mqtt-broker.md +++ b/fiber/mqtt-broker.md @@ -4,25 +4,40 @@ title: MQTT Broker Integration --- import Image from '@theme/IdealImage'; -# MQTT +# MQTT BROKER MQTT is an open, simple and low overhead communication protocol for sending messages between many clients which are connected to the central MQTT broker. The FIBER system integrates an MQTT (Message Queuing Telemetry Transport) broker to facilitate seamless communication and interaction with the device or system. MQTT offers users a versatile platform for exchanging data, configuring system parameters, retrieving system information, and executing remote commands. + - Every **message** consists of two parts - **topic** and **payload** + - The **Topic** describes the content of the message and identifies it + - The **Topic** name has a **directory structure** - each level is divided with a symbol `/` + - Topic can be `bedroom/temperature`, `kitchen/light/set`, etc. + - MQTT server is called the **broker** and clients can **publish messages** and **subscribe to topics** + - The task of the MQTT broker is to **deliver messages** from **publishers** to **subscribers** + - You can use two so-called **wildcards** while subscribing to the MQTT topic + - `+` wildcard will subscribe to all topics in the specified topic + - e.g. `+/light/set` will subscribe to `bedroom/light/set`, `kitchen/light/set`, etc. + - `#` wildcard will subscribe to all sub-topics of a specified topic + - e.g. `kitchen/#` will subscribe to `kitchen/light/set`, `kitchen/light/get`, `kitchen/temperature/get`, etc. - caution - - The wildcard **#** can be used only at the **end of the topic** name -> You can read [**more about the MQTT topics and how to use them**](https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/). + > The wildcard **#** can be used only at the **end of the topic** name + + +:::tip + +You can read [**more about the MQTT topics and how to use them**](https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/). + +::: ## FIBER Topics @@ -65,20 +80,22 @@ Ensure that the Mosquitto MQTT broker is installed and running on your system. Use the following command to subscribe to all topics (#) and display incoming messages: -``` +```bash mosquitto_sub -t "#" -v ``` -``` +```bash fiber/2158512345/beacon {"uptime": 11111.11, "ip_address": "10.0.0.111", "mac_address": "d1:1a:dd:11:1d:11"} + fiber/2158512345/measurement {"5": {"28-00000dc9cd6b": [{"timestamp": 1717581574, "value": {"minimum": 22.5, "maximum": 25.19, "average": 23.4, "median": 22.5, "last": 25.11}, "sample_count": 3}]}} ``` To retrieve information from the system via MQTT, you can use the following command: -``` +```bash mosquitto_pub -h localhost -t fiber/2158512345/system/ip/get -m "" ``` -``` + +```bash fiber/2158512345/system/ip "10.0.0.111" -``` +``` \ No newline at end of file diff --git a/fiber/project-structure.md b/fiber/project-structure.md index 9db6323..853602c 100644 --- a/fiber/project-structure.md +++ b/fiber/project-structure.md @@ -14,7 +14,11 @@ The root directory of the project contains files and folders related to core asp This directory holds project configuration files, such as **config.yaml**, as well as files defining network settings. -> For more information, see chapter [**Configuration File**](./configuration) +:::tip + +For more information, see chapter [**Configuration File**](./configuration) + +::: ## 3. Source Code (fiber/) @@ -56,29 +60,39 @@ This is the main directory of the project, containing the source code of the FIB > This module manages communication between the interface and system components, executing various operations based on incoming requests. Its functionality is driven by configuration variables, where **network interface** specifies the network interface used for communication. The system listens for interface requests via a queue manager, processing requests such as **setting indicator states and colors, retrieving MAC and IP addresses, system uptime, and rebooting the system**. It utilizes handlers to execute specific operations corresponding to each request type. Additionally, the module handles network interface initialization, ensuring availability for communication. This system-side module plays a pivotal role in facilitating seamless interaction between interface and system components within the FIBER application. -## 4. Installation and Configuration Scripts (install/ and scripts/) +## 4. Installation and Configuration Scripts -These directories contain scripts for installing and configuring the project. +**install/ & scripts/** -## 5. Dependency and Configuration Files (pyproject.toml and poetry.lock) +> These directories contain scripts for installing and configuring the project. -These files are used for managing project dependencies with Poetry. +## 5. Dependency and Configuration Files -## 6. Tests (tests/) +**pyproject.toml & poetry.lock** -This directory contains tests for verifying the functionality of various project components. +> These files are used for managing project dependencies with Poetry. # FIBER Architecture Diagram -This diagram shows the operation of the software part of FIBER. + +This diagram shows the operation of the software part of **FIBER**. ![FIBER Architecture Diagram](architecture-diagram.png) - Sensors (**Sensor 1-8**) collect temperature data and send it at each iteration. + - If a sensor is active, its data is forwarded to the broker (**Sensor Broker**) via the queue (**sensor broker queue**). + - The data is filtered, and then the sensor broker sends it either to the MQTT broker (**MQTT Broker**) or directly to the database (**Database**). + - Additionally, regardless of whether the sensor is active or not, data is sent to the system (**System**) for real-time display and visualization of the sensor's status (**Display Handler**). + - The display handler updates the monitor (**Monitor**) with information such as port numbers, temperature, PoE power, and battery power. It also manages the indicators (**LEDs**) for each sensor: green indicates an active sensor, and red indicates an inactive sensor. + - Users can interact with the monitor (**Monitor**) using buttons (**Buttons**) to adjust the brightness or to pause the display updates for 30 seconds. + - Through MQTT, various information can also be requested and retrieved from the system network handler (**Network Handler**). + - The network handler manages network settings and status, providing information such as MAC address, IP address, and uptime to the system. It also allows for the retrieval and modification of configuration files and the rebooting of FIBER. + - The interface (**Interface**) handles external communications by managing requests from MQTT and sensors, and it forwards them to the system (**System**) for processing and response generation as necessary. -- The interface (**Interface**) and the system (**System**) communicate and coordinate data and command flows via queues (**interface request, system response**). These queues ensure the necessary requests and responses are sent and received between different components of the program. \ No newline at end of file + +- The interface (**Interface**) and the system (**System**) communicate and coordinate data and command flows via queues (**interface request, system response**). These queues ensure the necessary requests and responses are sent and received between different components of the program. diff --git a/fiber/troubleshouting.md b/fiber/troubleshouting.md index 33c02f5..0331a02 100644 --- a/fiber/troubleshouting.md +++ b/fiber/troubleshouting.md @@ -6,36 +6,51 @@ import Image from '@theme/IdealImage'; # Troubleshooting -## 1. Reboot the system using MQTT broker -- **/system/reboot**: Initiates a system reboot. -> You can read [**more about rebooting a system using MQTT here.**](./mqtt-broker) +## 1. Reboot the system + +- **sudo reboot**: Initiates a system reboot using the command line. + +- **/system/reboot**: Initiates a system reboot using MQTT broker + + :::tip + + You can read [**more about rebooting a system using MQTT here.**](./mqtt-broker) + + ::: ## 2. Restart the Device -- Press the reset button on the back of the FIBER -- Wait up to a minute. +1. Press the reset button on the back of the **FIBER** + +2. Wait up to a minute. ## 3. Check Power Supply and Network Connectivity If restarting the device via the button does not resolve the issue, please check the power supply: -- Ensure that the power adapter is securely plugged into both the FIBER device and the power outlet. -- Check the network cables to ensure they are securely connected to the FIBER device and the router. -- If everything is working, then disconnect power to the FIBER device by turning it off. -- Wait for a few minutes. -- Turn on the FIBER device again and allow it some time to fully boot up. +1. Ensure that the power adapter is securely plugged into both the **FIBER** device and the power outlet. + +2. Check the network cables to ensure they are securely connected to the **FIBER** device and the router. + +3. If everything is working, then disconnect power to the **FIBER** device by turning it off. + +4. Wait for a few minutes. + +5. Turn on the **FIBER** device again and allow it some time to fully boot up. + ## 4. Reinstall image and run the FIBER -- Follow the installation instructions outlined in section [**FIBER Installation**](./installation-setup) of this documentation. -- Log in to the target +1. Follow the installation instructions outlined in section [**FIBER Installation**](./installation-setup) of this documentation. + +2. Log in to the target - ```sh - ssh root@[ip address] - ``` + ```bash + ssh root@[ip address] + ``` -- Run the installation script using the following command: +3. Run the installation script using the following command: - ```sh - /app/scripts/install.sh - ``` \ No newline at end of file + ```bash + /app/scripts/install.sh + ``` \ No newline at end of file diff --git a/sidebars-fiber.js b/sidebars-fiber.js new file mode 100644 index 0000000..4098287 --- /dev/null +++ b/sidebars-fiber.js @@ -0,0 +1,16 @@ +// @ts-check + +/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ +const sidebars = { + docs: [ + 'introduction', + 'installation-setup', + 'configuration', + 'mqtt-broker', + 'project-structure', + 'troubleshouting', + ], + }; + + module.exports = sidebars; + diff --git a/src/components/HomepageFeatures.js b/src/components/HomepageFeatures.js index f6ed449..1fbd782 100644 --- a/src/components/HomepageFeatures.js +++ b/src/components/HomepageFeatures.js @@ -43,6 +43,19 @@ const FeatureList = [ ), }, + { + title: 'FIBER', + subtitle: 'Sensor IoT Monitor', + link: '/fiber/', + src: '/img/fiber.png', + width: 300, + height: 200, + description: ( + <> + FIBER is an IoT device for precise industrial temperature monitoring, offering seamless connectivity and intuitive interfaces. + + ), + }, { title: 'CLOUD', subtitle: 'Middleware IoT Service', diff --git a/static/img/fiber.png b/static/img/fiber.png new file mode 100644 index 0000000..99ee648 Binary files /dev/null and b/static/img/fiber.png differ