This repository contains a serverless IoT platform project designed for simulation, ingestion, and processing of IoT sensor data using Azure Functions and a local sensor emulator.
IOT-Serverless-Platform/
├── iot-lab-functions/ # Azure Functions project
│ ├── GetSensorHistory/ # Function to retrieve sensor history
│ ├── IngestSensorData/ # Function to ingest sensor data into Event Hub
│ ├── ProcessSensorEvent/ # Function to process Event Hub events and store in Cosmos DB
│ ├── requirements.txt
│ ├── host.json
│ └── ... # Configuration and VS Code metadata files
└── sensor-emulator/ # Local sensor emulator
├── template/ # CSS/JS assets for the web UI + Jinja2 UI templates
├── docs/ # Screenshots, diagrams, documentation assets
│ └── ui-preview.png # Screenshot of the emulator web interface
├── emulator.py # Main FastAPI application
└── simulator.py # Sensor simulation engine
- Purpose: Simulates multiple types of IoT sensors with configurable frequency and endpoints.
- Features:
- Supports temperature, weight, voltage sensors and "bad" sensors generating invalid data for DLQ testing.
- Configurable transmission frequency (20–100 ms).
- Web UI for starting/stopping sensors and viewing last values.
- Usage:
uvicorn emulator:app --reload --host 0.0.0.0 --port 8000Open http://localhost:8000 in a browser.
-
Purpose: Serverless backend for ingesting, processing, and retrieving IoT sensor data.
-
Functions:
- IngestSensorData – HTTP endpoint for receiving sensor events and forwarding them to Event Hub.
- ProcessSensorEvent – Event Hub triggered function that validates, stores events in Cosmos DB, and sends invalid events to DLQ.
- GetSensorHistory – Retrieves sensor history from Cosmos DB.
-
Deployment: Deploy using VS Code or Azure CLI.
All sensor events follow a standard structure:
{
"id": "uuid",
"sensorId": "temp1",
"sensorType": "temperature",
"value": 23.5,
"unit": "C",
"timestamp": 1733929200,
"location": {
"lat": х.х,
"lon": х.х
},
"raw": { ... } // original sensor payload
}- Allows uniform handling of different sensor types.
- Easy to extend with new fields without breaking existing functions.
- Supports routing and analytics.
- Run the sensor emulator locally.
- Start Azure Functions locally:
func start- Use web UI to start sensors and monitor logs.
- Verify DLQ handling by enabling "bad" sensors.
- Authenticate with Azure:
az login- Deploy
iot-lab-functionsusing VS Code: Deploy to Azure Function App - Verify functionality with real Event Hub and Cosmos DB endpoints.