Edge-IoT Synthetic Data Engine

Bankole Synthetic Sensor API

A FastAPI-powered synthetic data engine that streams realistic IoT sensor readings for prototyping, testing, and demonstration. Generate configurable accelerometer, gyroscope, and environmental sensor data on demand through a simple REST interface.

Sample Dataset Preview

A synthetic sensor dataset with 60 records spanning accelerometer vibration, temperature, pressure, and soil moisture readings. Some entries simulate sensor anomalies (high temperature, pressure, and moisture) for testing detection logic.

timestampvibrationtemperaturepressuresoil_moistureanomaly
00.01337890771862298319.887993997169936101.2993494073933530.275496537022644false
1-0.005127943896797125520.218571999896525101.5026434058415230.00539624923254false
20.02678852833712453219.903476405480728101.2762222349281330.086205501401068false
30.1317982365067116620.241845048629045101.1395705114210429.868081090893888false
4-0.0459994214603029419.919334812087254101.513093567311929.948828521732473false

Showing rows 0-4. The full dataset (60 rows) is available for download.

Quickstart - Python

Install the requests library and call the /stream endpoint to receive a batch of synthetic sensor readings.

python
import requests

url = "http://localhost:8000/stream"
params = {"sample_rate_hz": 10, "duration_seconds": 5}

response = requests.get(url, params=params)
data = response.json()
print(data)

Quickstart - cURL

Use cURL to fetch synthetic data directly from the command line:

bash
curl "http://localhost:8000/stream?sample_rate_hz=10&duration_seconds=5"

Live Sample Response

Fetch a live 5-second sample at 1 Hz from the running API server:

Integration Instructions

Run the FastAPI server locally to serve synthetic sensor data:

1. Install Dependencies

bash
pip install fastapi uvicorn pydantic numpy

2. Start the Server

From the directory containing sensor_synthetic_data.py, run:

bash
uvicorn sensor_synthetic_data:app --reload

The API will be available at http://localhost:8000. The --reload flag enables hot-reloading during development.

3. Calling from Other Languages

The API returns JSON, so you can call it from any language. Here is a JavaScript example using the Fetch API (browser or Node.js):

javascript
fetch("http://localhost:8000/stream?sample_rate_hz=10&duration_seconds=5")
  .then((res) => res.json())
  .then((data) => console.log(data));