https://github.com/minhtran241/edge-computing-models
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.
https://github.com/minhtran241/edge-computing-models
benchmark edge-computing raspberry-pi research-paper
Last synced: 2 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/minhtran241/edge-computing-models
- Owner: minhtran241
- License: gpl-3.0
- Created: 2024-05-05T07:07:54.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-15T19:00:37.000Z (over 1 year ago)
- Last Synced: 2024-11-15T20:17:51.838Z (over 1 year ago)
- Topics: benchmark, edge-computing, raspberry-pi, research-paper
- Language: Python
- Homepage:
- Size: 57.8 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A Distributed Edge Computing Prototype Using Raspberry PIs
## Publication
**Conference:** 2025 IEEE World AI IoT Congress (AIIoT)
**DOI:** [10.1109/AIIoT65859.2025.11105362](https://doi.org/10.1109/AIIoT65859.2025.11105362)
**ResearchGate:** [https://www.researchgate.net/publication/394657478_A_Distributed_Edge_Computing_Prototype_Using_Raspberry_PIs](https://www.researchgate.net/publication/394657478_A_Distributed_Edge_Computing_Prototype_Using_Raspberry_PIs)
### Abstract
Edge computing has recently become a widely used computing model. In edge computing, people deploy edge servers at locations closer to devices, which generate large amounts of data. Hence, edge computing can improve application performances by reducing the server latency and response time. Nowadays, Raspberry Pi is a small device for many Internet of Things (IoT) applications. In this paper, we investigate the concept of distributed edge computing, design a prototype, and implement that using Raspberry Pi devices. We utilize the parallel computing feature offered by our prototype and Raspberry Pis to show the benefits of distributed edge computing. We conduct extensive hands-on experiments for multiple applications and compare the performances among different computing models. Our evaluation results show that our distributed edge computing prototype can improve the performance with multiple edge servers.
## Overview
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 our published research and demonstrates the practical implementation of distributed edge computing. The implementation is written in Python and uses [Raspberry Pi](https://www.raspberrypi.org/) devices as nodes in the edge computing network to simulate real-world edge computing environments. Communication between nodes is handled using the [socketio](https://python-socketio.readthedocs.io/en/latest/) library.
## Models
### Edge Computing with Multiple Edge Servers
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.

#### Implementation
- **IoT Devices**: Raspberry Pi 3
- **Edge Servers**: Raspberry Pi 4
#### Key Benefits
- **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
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.

#### Implementation
- **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
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.

#### Setup
- **IoT Devices**: Raspberry Pi 3
- **Cloud Server**: Laptop
#### 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
- [Python 3.8](https://www.python.org/downloads/release/python-380/)
- [Raspberry Pi](https://www.raspberrypi.org/) with Raspbian OS installed
- [SocketIO](https://python-socketio.readthedocs.io/en/latest/)
### Set up environment variables
Create a `.env` file in the root directory and follow the template created in the [`.env.example`](https://github.com/minhtran241/edge-computing-models/blob/main/.env.example) file.
```bash
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:
```bash
python iot-edge-cloud --algo-code --size-option --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](#available-algorithms)
- The size of the data
- Number of iterations
- The model architecture [See the enum `ModelArch` in the [`enums.py`](https://github.com/minhtran241/edge-computing-models/blob/main/models/enums.py) file]
#### Input format
```
================
Available roles:
iot
edge
cloud
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`](https://github.com/minhtran241/edge-computing-models/tree/main/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:
```python
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`](https://github.com/minhtran241/edge-computing-models/blob/main/config.py) file to include the new algorithm.
- Update the `Algorithm` enum in the [`enums.py`](https://github.com/minhtran241/edge-computing-models/blob/main/models/enums.py) file to include the new algorithm.
## Contributors
- [Minh Tran](https://minhtran-nine.vercel.app): Research Assistant, Grand Valley State University
- [Dr. Xiang Cao](https://www.linkedin.com/in/xiang-cao-15183570/): Associate Professor, Grand Valley State University