EdgeModelKit: Sensor Data Acquisition and Logging Library

EdgeModelKit is a Python library developed by EdgeNeuron, designed to simplify sensor data acquisition, logging, and real-time processing for IoT devices. It works seamlessly with the DataLogger script from the EdgeNeuron Arduino libraryarrow-up-right, and now supports HTTP-based acquisition for devices that expose REST APIs.


Features

  • Serial Communication: Supports data acquisition over serial ports with robust error handling.

  • Flexible Data Fetching: Retrieve sensor data as Python lists or NumPy arrays.

  • Customizable Logging: Log sensor data into CSV files with optional timestamps and counters.

  • Class-Based Organization: Log data with class labels to prepare datasets for machine learning tasks.

  • Error Handling: Gracefully handles data decoding errors and missing keys in sensor data packets.


Usage Prerequisites

This library is designed to work with the DataLogger script available in the EdgeNeuron Arduino libraryarrow-up-right. The DataLogger script configures your Arduino-based IoT device to send structured JSON sensor data over a serial connection.

Before using EdgeModelKit, ensure:

  1. Your Arduino device is programmed with the DataLogger script from the EdgeNeuron Arduino libraryarrow-up-right.

  2. The device is connected to your system via a serial interface.


Installation

Install EdgeModelKit using pip:


Quick Start

1. Initialize the DataFetcher

2. Fetch Sensor Data

3. Log Sensor Data


CSV Logging Details

The CSV file is generated automatically based on the sensor name (e.g., TemperatureSensor_data_log.csv) and contains the following:

  • Timestamp: (Optional) Records the time when the data was logged.

  • Sample Count: (Optional) A sequential counter for each data sample.

  • Data Columns: Each element in the sensor data array is stored in separate columns (e.g., data_value_1, data_value_2, ...).

The data is saved under a folder named Dataset, with subfolders organized by class_label (if specified).


Real-Time Data Processing Example


Dependencies

EdgeModelKit requires the following Python packages:

  • numpy

  • pandas

  • pyserial

  • json

Install dependencies with:


Contributing

We welcome contributions to EdgeModelKit! Feel free to submit bug reports, feature requests, or pull requests on our GitHub repositoryarrow-up-right.


License

EdgeModelKit is licensed under the MIT License. See the LICENSE file for details.


Support

For support and inquiries, contact us at [email protected] or visit our GitHub repositoryarrow-up-right.


About EdgeNeuron

EdgeNeuron is a pioneer in edge computing solutions, enabling developers to build intelligent IoT applications with state-of-the-art tools and libraries. Learn more at edgeneuronai.comarrow-up-right.


Last updated