Skip to content

MrudulaSatya/gRPC_gateway_Sim

Repository files navigation

Embedded Gateway Simulator using gRPC & Protobuf

Python gRPC Protobuf License: MIT

This project simulates a realistic embedded system gateway using Python, gRPC, and Protocol Buffers. It models how a mobile/cloud application communicates with a connected embedded product through a gateway — a pattern commonly used in IoT systems (e.g., smart homes, industrial sensors).


Features

  • gRPC Server simulating an embedded gateway
  • gRPC Client simulating a cloud or mobile app
  • Protobuf messages for structured, binary-compatible communication
  • Supports RPCs for:
    • Setting configuration (e.g., sample rate, WiFi)
    • Controlling hardware (e.g., light on/off)
    • Getting status
    • Streaming telemetry (temperature, humidity)
  • Conversion to serialized binary data (e.g., for UART transmission)

Architecture

        +---------------------+
        |   gRPC Client (Pi)  |     ← Simulates mobile/cloud
        +---------------------+
                  │
                  ▼
        +---------------------+
        |  gRPC Server (PC)   |     ← Simulates embedded gateway
        |  (Logs + Streaming) |
        +---------------------+
                  │
                  ▼
        [ Protobuf Binary (UART) ]

Folder Structure

.
├── client.py              # gRPC client script
├── server.py              # gRPC server script
├── protos/
│   └── gateway.proto      # Protobuf schema
├── gateway_pb2.py         # Auto-generated from .proto (after build)
├── gateway_pb2_grpc.py    # Auto-generated from .proto (after build)
├── logs/
│   └── gateway.log        # Runtime logs
├── LICENSE                # MIT license
├── .gitignore             # Git ignored files
└── README.md              # You're here!

Getting Started

Install Dependencies

python -m venv venv
source venv/bin/activate
pip install grpcio grpcio-tools

Compile Protobuf

python -m grpc_tools.protoc \
  -I protos \
  --python_out=. \
  --grpc_python_out=. \
  protos/gateway.proto

▶ Run the Server

python server.py

▶ Run the Client

In a new terminal (while server is running):

python client.py

License

This project is licensed under the MIT License - see the LICENSE file for details.


Questions or Ideas?

Feel free to fork, open issues, or submit pull requests!

About

A lightweight, real-time simulation of an embedded IoT gateway using Python, gRPC, and Protobuf.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •