I have always liked the idea of telemetry. Devices out in the world, quietly posting readings, and a dashboard somewhere showing what is happening right now. Temperature, pressure, vibration. Simple numbers, but they tell you a lot.
The problem was that every real telemetry stack I looked at wanted a server farm. A message broker, a time-series database, a cluster, a cloud account. I did not have any of that. I had a laptop and an evening.
So I built a small one. A local telemetry ingestion system. Devices POST sensor readings to a REST API, the readings land in SQLite, and a dashboard shows live stats, per-sensor trends, and recent readings. It is the kind of data-logging tool used in industrial operations support, just shrunk down to something one person can run.
What it does
The API takes a reading with a sensor id, a value, a unit, and a timestamp, validates it, and stores it. Bad input gets rejected with a 422, so junk never reaches the database.
The dashboard is served by the API itself. It has stats cards, a per-sensor trend chart, and a recent-readings table, and it refreshes every 3 seconds. There is a statistics endpoint too, totals, per-sensor minimum, maximum and average, and the latest value per sensor, all aggregated in SQL.
There is also a sensor simulator. It generates realistic temperature, pressure, and vibration traffic and posts it every 2 seconds, so you can watch the dashboard move without wiring up a real device. That part turned out to be the most fun. You run it in a second terminal and the whole thing comes alive.
How to run it
pip install -r requirements.txt
uvicorn app.main:app --reload
Open http://127.0.0.1:8000 for the dashboard. The API docs live at http://127.0.0.1:8000/docs, FastAPI generates them for free.
To make demo traffic, open a second terminal and run:
python simulator.py
You can also post a reading by hand:
curl -X POST http://127.0.0.1:8000/api/readings \
-H "Content-Type: application/json" \
-d '{"sensor_id": "temp-01", "value": 71.5, "unit": "C"}'
It answers with the id of the stored reading.
How it is put together
The stack is Python 3.12, FastAPI, and Pydantic validation on the API side, SQLite indexed on sensor and timestamp for storage, and plain HTML, CSS, and vanilla JavaScript with a Canvas chart on the front end. The server is Uvicorn. The simulator uses httpx.
Nothing here is clever. That was the point. A sensor posts a number, the number gets stored, the dashboard shows it. If you have ever wanted to see your own data flowing end to end, this is a good place to start.
Top comments (0)