Skip to content

Latest commit

 

History

History
171 lines (110 loc) · 7.27 KB

README.md

File metadata and controls

171 lines (110 loc) · 7.27 KB

Edge computing models for IoT Analytics

This repository contains a collection of edge computing models for IoT analytics. The models are designed to help organizations understand the benefits of edge computing and how it can be used to process data from IoT devices more efficiently. Each model provides an overview of the architecture, advantages, and use cases for edge computing in IoT analytics.

The code supports the research paper's writing process. The code is written in Python. Raspberry Pi is used as nodes in the edge computing network to simulate the edge computing environment. The code is written in Python and uses the socketio library to communicate between the nodes.

Models

Edge Computing with Multiple Edge Servers

Overview

This model leverages multiple edge servers connected to the cloud. The edge servers handle data processing from IoT devices, sending processed results to the cloud for further analysis. This setup is ideal for scenarios requiring low latency and when the cloud cannot manage the large volume of data generated by IoT devices. Geographically distributed edge servers reduce latency and enhance reliability.

Model 1

Current Implementation

  • IoT Devices: Raspberry Pi 3
  • Edge Servers: Raspberry Pi 4

Advantages

  • Low Latency: Proximity of data processing to the source shortens the time to results, critical for real-time applications.
  • Scalability: Easily scale edge servers up or down according to data volume.
  • Reliability: Multiple edge servers ensure no single point of failure, enhancing reliability.

IoT Devices Architecture

Overview

This model emphasizes the architecture of IoT devices for data collection and local processing before sending it to the cloud for further analysis. It is suitable for scenarios with resource-constrained IoT devices that cannot perform real-time processing.

Model 2

Implementation Details

  • IoT Devices: Raspberry Pi 3
  • Cloud Server: Laptop

Benefits

  • Cost-effective: IoT devices are generally cheaper than edge servers, providing an economical solution for data collection and processing.
  • Low Power Consumption: Designed for energy efficiency, IoT devices are suitable where power consumption is a concern.
  • Scalability: IoT devices can be scaled up or down easily based on the data volume.

Cloud Computing Architecture

Overview

This model highlights cloud computing architecture for processing data from IoT devices. The cloud server collects and processes data in real-time, making it ideal for scenarios with a large volume of data that cannot be processed locally.

Model 3

Implementation Strategy

  • IoT Devices: Raspberry Pi 3
  • Cloud Server: Laptop

Key Advantages

  • Scalability: Cloud servers can be scaled up or down effortlessly based on the data volume.
  • High Performance: Cloud servers are designed to manage large data volumes efficiently and quickly.
  • Reliability: High reliability with built-in redundancy ensures data safety.

Usage

Requirements

Set up environment variables

Create a .env file in the root directory and follow the template created in the .env.example file.

EDGE_TARGET=
NUM_IOT_TARGETS=
IOT_TARGET_1=
IOT_TARGET_2=
IOT_TARGET_3=

Note: The NUM_IOT_TARGETS variable is used to specify the number of server nodes in the edge computing network which receive data/results from the IoT devices. The IOT_TARGET_1, IOT_TARGET_2, IOT_TARGET_3 variables are used to specify the IP addresses of the those server nodes. Depending on the model architecture, you may need to update the number of IoT devices and target server variables.

Run the code

To run the code, you need to start the servers in the following order:

  1. Start the cloud server
  2. Start the edge servers
  3. Start the IoT devices

For all the servers, you can run the following command:

python iot-edge-cloud <role> <id> --algo-code <algo-code> --size-option <size-option> --iterations <iterations> --arch-name <--arch-name>

This will require your input to specify the following parameters:

  • The role of the device (IoT device, edge server or cloud)
    • Valid roles: iot, edge, cloud
  • The device ID
  • The algorithm code See the list of available algorithms
  • The size of the data
  • Number of iterations
  • The model architecture [See the enum ModelArch in the enums.py file]

Input format


================
Available roles:
iot <id> <algo_code> <size_option> <iterations>
edge <id>
cloud <id>
Set up device parameters: ...
================


Set up model architecture ['IOT', 'EDGE', 'CLOUD']: ...

Available algorithms

Algorithm Code Description
Smith-Waterman sw A dynamic programming algorithm for sequence alignment
Sentiment Analysis sa An algorithm for analyzing the sentiment of text data
Tesseract OCR ocr An optical character recognition algorithm for text recognition
YOLOv8 yolo An object detection algorithm for image recognition

Adding new algorithms

The helper functions for the algorithms should be placed in the /helpers module. For each algorithm, you need at least two functions: preprocess and process.

  • The preprocess function is used to prepare the input data for the algorithm in the IoT device. This function should take the data_dir as input and return the processed data.
  • The process function is used to run the algorithm on the input data and return the result in the edge server. This function should take the data as input and return the result. The signature of the function should be as follows:
from typing import Any

def process_name(data: Any) -> Any:
 """
 Run the algorithm on the input data and return the result.

 Args:
  data (str): The input data to process.

 Returns:
  str: The result of the algorithm.
 """
 pass
  • Update the DATA_CONFIG dictionary in the config.py file to include the new algorithm.

  • Update the Algorithm enum in the enums.py file to include the new algorithm.

Contributors

  • Minh Tran: Research Assistant, Grand Valley State University
  • Dr. Xiang Cao: Associate Professor, Grand Valley State University