{"id":15064134,"url":"https://github.com/serdaraltin/fusion-sens","last_synced_at":"2026-01-02T22:38:46.059Z","repository":{"id":256251981,"uuid":"854708540","full_name":"serdaraltin/fusion-sens","owner":"serdaraltin","description":" Handles the data acquisition and processing from IMU sensors, providing orientation and motion data to enhance the tracking capabilities of the system.","archived":false,"fork":false,"pushed_at":"2024-12-10T21:12:03.000Z","size":644,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2025-01-22T09:28:18.097Z","etag":null,"topics":["esp32","imu-sensor","motion-tracking","sensor-fusion","telemetry-data"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serdaraltin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-09T16:35:31.000Z","updated_at":"2024-12-10T21:12:07.000Z","dependencies_parsed_at":"2024-09-09T21:37:20.871Z","dependency_job_id":"1b90ca7e-f9cc-4a4a-8bb5-2b0915dc76cf","html_url":"https://github.com/serdaraltin/fusion-sens","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"95fbbc3759308f657c03af9f844898dd2e181d7e"},"previous_names":["serdaraltin/fusion-sens"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serdaraltin%2Ffusion-sens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serdaraltin%2Ffusion-sens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serdaraltin%2Ffusion-sens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serdaraltin%2Ffusion-sens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serdaraltin","download_url":"https://codeload.github.com/serdaraltin/fusion-sens/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243786232,"owners_count":20347603,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esp32","imu-sensor","motion-tracking","sensor-fusion","telemetry-data"],"created_at":"2024-09-25T00:12:03.306Z","updated_at":"2026-01-02T22:38:46.053Z","avatar_url":"https://github.com/serdaraltin.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fusion Sens\n\nFusion Sens is a versatile C++ software framework designed for working with I2C-based sensors on microcontroller platforms, such as the **ESP32**. It abstracts the complexities of managing multiple sensors and streamlines the process of interacting with I2C devices like **MPU6050**, **BMP180**, **SSD1306**, and more. The project is built with flexibility and extensibility in mind, enabling developers to manage sensor data, perform device configuration, and log sensor readings seamlessly.\n\n## Table of Contents\n\n1. [Features](#features)\n2. [Architecture](#architecture)\n3. [Getting Started](#getting-started)\n4. [Installation](#installation)\n5. [Configuration](#configuration)\n6. [Usage](#usage)\n    - [Device Class](#device-class)\n    - [DeviceManager Class](#devicemanager-class)\n    - [I2C Class](#i2c-class)\n    - [Logger and SerialLogger Classes](#logger-and-seriallogger-classes)\n    - [Adding a New Device](#adding-a-new-device)\n    - [Unit Tests](#unit-tests)\n7. [Contribution](#contribution)\n8. [License](#license)\n9. [API Reference](#api-reference)\n10. [Changelog](#changelog)\n\n## Features\n\n- **Device Management:** Provides a `DeviceManager` class that manages a list of I2C devices and allows adding, retrieving, and removing devices dynamically.\n- **I2C Communication:** A robust system for managing I2C bus communication, with features like automatic device scanning, connection checking, and communication retries.\n- **Logging:** Includes a logging system with multiple verbosity levels (None, Error, Warning, Info, Debug), along with a `SerialLogger` for sending logs over the serial port for debugging.\n- **Sensor Abstraction:** Abstracts sensor details such as addresses and properties, providing a simple interface for developers to interact with the sensors.\n- **Unit Testing Support:** Integrated with Google Test for unit testing, ensuring that the framework is reliable and bug-free.\n\n## Architecture\n\nThe Fusion Sens framework follows a modular and extensible architecture:\n\n- **Device Class:** Represents individual I2C devices with properties like name, address, and parent device.\n- **DeviceManager Class:** A singleton pattern manager for handling multiple devices. It stores, retrieves, and removes devices dynamically.\n- **I2C Class:** Encapsulates the I2C bus operations, including initialization, scanning for connected devices, and communication with the devices.\n- **Logger and SerialLogger Classes:** Used for logging various levels of information and sending those logs over a serial connection.\n\n### Key Components:\n\n- **Device**: Represents an individual device in the I2C bus. Each device has properties like name, address, and a reference to its parent device.\n- **DeviceManager**: Handles a collection of devices. Provides an API to add, remove, or retrieve devices from the list.\n- **I2C**: Manages the communication between the microcontroller and I2C sensors. Handles device scanning, addressing, and data exchange.\n- **Logger**: Provides logging functionality, with options to log messages at different severity levels.\n\n## Getting Started\n\nFollow the instructions below to set up and start using the **Fusion Sens** framework.\n\n### Prerequisites\n\n1. **C++11 or later** compiler support\n2. **ESP32 or another compatible microcontroller** (Alternatively, other platforms like ESP8266 are supported)\n3. **CLion** or any other C++ IDE for development\n4. **I2C-compatible sensors** like **MPU6050**, **BMP180**, **SSD1306** (These can be connected to the microcontroller using the I2C protocol)\n\n### Supported Platforms\n\n- **ESP32**\n- **ESP8266**\n- **Arduino (via PlatformIO)**\n\n### Hardware Requirements\n\n- **MPU6050** (Accelerometer, Gyroscope)\n- **BMP180** (Barometer)\n- **SSD1306** (OLED display)\n\nYou can add more I2C sensors by creating new `Device` objects or modifying the `DeviceManager` class.\n\n### Installation\n\nTo get started, clone the project to your local machine using Git:\n\n```bash\ngit clone https://github.com/serdaraltin/fusion-sens.git\n```\n\nAfter cloning, open the project in your preferred C++ IDE (**CLion** is recommended, but **Visual Studio Code** with PlatformIO is also supported).\n\n```bash\ncd fusion-sens\n```\n\nInstall dependencies via **PlatformIO** (if using PlatformIO as the IDE):\n\n```bash\nplatformio lib install\n```\n\nAlternatively, if using **Arduino IDE**, install the following libraries:\n\n- **Wire** (for I2C communication)\n- **Adafruit_SSD1306** (for OLED display support)\n- **Adafruit_GFX** (for graphics rendering on displays)\n\n### Dependencies\n\nThe project requires the following libraries to work:\n\n- **Wire**: Standard library for I2C communication.\n- **Adafruit_SSD1306**: Used for controlling OLED displays over I2C.\n- **Adafruit_GFX**: Provides graphics functions for the OLED display.\n- **Google Test**: For unit testing (optional).\n\nThese dependencies can be installed through the PlatformIO IDE or Arduino IDE.\n\n## Configuration\n\nThe configuration files are located in the `config` folder. These files are designed to make it easy to configure the microcontroller and sensors.\n\n### Example Configuration File (`config/config.h`)\n\n```cpp\n// I2C Configuration\n#define SDA_PIN 21\n#define SCL_PIN 22\n\n// Screen Configuration\n#define SCREEN_I2C 0x3C\n\n// Sensor Configuration\n#define SENSOR_NAME \"MPU6050\"\n#define SENSOR_I2C 0x68\n```\n\nIn the above configuration:\n\n- **SDA_PIN** and **SCL_PIN** define the I2C data and clock pins.\n- **SCREEN_I2C** specifies the I2C address of the OLED screen.\n- **SENSOR_I2C** defines the I2C address of the sensor (MPU6050 in this case).\n\n### Customizing the Device List\n\nYou can modify the device list by editing the `DeviceManager` class or directly using the `addDevice()` method to add devices dynamically.\n\n## Usage\n\n### Device Class\n\nThe `Device` class represents an I2C device and provides methods for interacting with it.\n\n#### Example Usage:\n\n```cpp\nDeviceManagerI.addDevice({\"NewDevice\", 0xAB});\nDevice *device = DeviceManagerI.getDevice(0xAB);\n```\n\n### DeviceManager Class\n\nThe `DeviceManager` class manages all devices. It allows you to add, remove, and retrieve devices from a list.\n\n#### Example Usage:\n\n```cpp\n// Add a device to the manager\nDeviceManagerI.addDevice({\"NewDevice\", 0xAB});\n\n// Retrieve a device from the manager\nDevice *device = DeviceManagerI.getDevice(0xAB);\n```\n\n### I2C Class\n\nThe `I2C` class encapsulates I2C communication functions.\n\n#### Example Usage:\n\n```cpp\nI2CI.wireBegin();  // Start the I2C bus\nI2CI.scan();       // Scan the I2C bus for connected devices\n```\n\n### Logger and SerialLogger Classes\n\nThe `Logger` class logs messages at different levels of severity. The `SerialLogger` extends this class and sends logs over a serial connection.\n\n#### Example Usage:\n\n```cpp\nISerialLog.Info(\"Device initialized.\");\nISerialLog.Debug(\"I2C device communication successful.\");\n```\n\n### Adding a New Device\n\nTo add a new device, create an instance of the `Device` class and add it to the `DeviceManager`.\n\n#### Example:\n\n```cpp\nDevice newDevice(\"NewDevice\", 0xAB);\nDeviceManagerI.addDevice(newDevice);\n```\n\n### Unit Tests\n\nUnit tests are implemented using **Google Test**. To run the tests, you can execute the following command using PlatformIO:\n\n```bash\npio test -e esp32-Test\n```\n\nThe tests will ensure that the framework works as expected and that all components are functioning correctly.\n\n## Contribution\n\nContributions are welcome! Please feel free to fork the repository, make your changes, and submit a pull request. Here's how you can contribute:\n\n1. Fork the repository\n2. Create a new branch\n3. Make your changes and test them\n4. Submit a pull request with a detailed description of your changes\n\n## License\n\nThis project is licensed under the **GPL-3.0 License**. See the [LICENSE](LICENSE) file for more information.\n\n## API Reference\n\n### Device Class\n\n- **`Device(String name, uint8_t address, uint8_t parentAddress = 0)`**: Constructor that creates a device with the given name, address, and optional parent address.\n- **`String getName()`**: Returns the name of the device.\n- **`uint8_t getAddress()`**: Returns the I2C address of the device.\n- **`uint8_t getParentDevice()`**: Returns the I2C address of the parent device (if any).\n\n### DeviceManager Class\n\n- **`void addDevice(Device device)`**: Adds a device to the manager.\n- **`Device* getDevice(uint8_t address)`**: Retrieves a device by its I2C address.\n\n### I2C Class\n\n- **`void wireBegin()`**: Initializes the I2C communication.\n- **`void scan()`**:\n\nScans the I2C bus for connected devices.\n\n### Logger Class\n\n- **`void Info(String message)`**: Logs an informational message.\n- **`void Error(String message)`**: Logs an error message.\n- **`void Debug(String message)`**: Logs a debug message.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserdaraltin%2Ffusion-sens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserdaraltin%2Ffusion-sens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserdaraltin%2Ffusion-sens/lists"}