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.
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.
- IoT Devices: Raspberry Pi 3
- Edge Servers: Raspberry Pi 4
- 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.
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.
- IoT Devices: Raspberry Pi 3
- Cloud Server: Laptop
- 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.
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.
- IoT Devices: Raspberry Pi 3
- Cloud Server: Laptop
- 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.
- Python 3.8
- Raspberry Pi with Raspbian OS installed
- SocketIO
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. TheIOT_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.
To run the code, you need to start the servers in the following order:
- Start the cloud server
- Start the edge servers
- 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
- Valid roles:
- 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 theenums.py
file]
================
Available roles:
iot <id> <algo_code> <size_option> <iterations>
edge <id>
cloud <id>
Set up device parameters: ...
================
Set up model architecture ['IOT', 'EDGE', 'CLOUD']: ...
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 |
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 thedata_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 thedata
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 theconfig.py
file to include the new algorithm. -
Update the
Algorithm
enum in theenums.py
file to include the new algorithm.
- Minh Tran: Research Assistant, Grand Valley State University
- Dr. Xiang Cao: Associate Professor, Grand Valley State University