From BLE Sensor to Cloud Database: How Telematics Data Actually Flows

Diagram of telematics data flowing from a BLE sensor through a gateway to a cloud database

Most teams get the first and last pieces right. They pick a BLE sensor that reads temperature. They spin up a PostgreSQL instance. Then they stare at the gap in between, the part where a tiny radio signal somehow needs to become a queryable row in a database, and realize nobody on the team has built that middle part before.

The gap isn’t one thing. It’s five distinct handoffs, each with its own failure modes, protocol quirks, and design tradeoffs. Miss one and your data either never arrives, arrives late, arrives garbled, or arrives so disorganized it’s useless for the dashboards you promised stakeholders.

I’m going to walk you through exactly how a BLE telematics data pipeline works, end to end, the same way I’d whiteboard it for a client. We’ll use a concrete example throughout: a fleet of refrigerated shipping containers, each fitted with BLE sensors reporting temperature and vibration every five seconds. The goal is to get that data into a cloud database where an operations team can query it, visualize it, and act on it.

Here’s the full pipeline:

┌─────────────┐   BLE Radio    ┌─────────────┐   MQTT/TLS    ┌─────────────┐
│  BLE Sensor  │ ──────────── │   Gateway    │ ────────────│ MQTT Broker  │
│ (temp, vibr) │  (~30-100m)  │ (edge device)│ (cellular/  │ (Mosquitto)  │
└─────────────┘               └──────┬──────┘  Wi-Fi)      └──────┬──────┘
                                     │                             │
                               ┌─────┴──────┐              ┌──────┴──────┐
                               │ Local       │              │ Ingestion   │
                               │ Buffering & │              │ Service     │
                               │ Edge Logic  │              └──────┬──────┘
                               └────────────┘                     │
                                                     ┌────────────┼────────────┐
                                                     ▼            ▼            ▼
                                               ┌──────────┐ ┌──────────┐ ┌──────────┐
                                               │Prometheus│ │PostgreSQL│ │ InfluxDB │
                                               │(metrics) │ │(analytic)│ │ (TSDB)   │
                                               └────┬─────┘ └──────────┘ └──────────┘
                                                    │
                                               ┌────┴─────┐
                                               │ Grafana  │
                                               └──────────┘

Five stages. BLE sensor → gateway → transport protocol → cloud ingestion → database. Let’s take them one at a time.

Stage 1: The BLE Sensor — Powerful Radio, Tiny Reach

BLE sensors are low-power, short-range radio transmitters. They broadcast or connect within roughly 30 to 100 meters. They measure something (temperature, vibration, humidity, tire pressure, battery voltage) and transmit small payloads, typically via advertising packets or GATT characteristic reads.

Here’s the critical thing newcomers miss: BLE sensors do not connect to the internet. There is no IP stack. There is no Wi-Fi radio. A BLE temperature sensor sitting in a shipping container has no idea the cloud exists.

What it does is broadcast data in structured packets. In our container fleet example, each sensor advertises a payload every five seconds containing a device ID, a temperature reading, a vibration magnitude, and a battery level. That’s maybe 20–30 bytes.

BLE 5.x extended advertising allows larger payloads and improved range, but the fundamentals haven’t changed: this is a local radio protocol. The sensor’s firmware determines the broadcast interval and data format, and both of those decisions ripple through every downstream stage. A sensor broadcasting every 100 milliseconds creates a very different pipeline load than one broadcasting every 10 seconds.

Stage 2: The Gateway — Where Local Becomes Global

If BLE sensors are the eyes and ears, the gateway is the translator. It’s the component that bridges BLE radio to an IP network (Wi-Fi, Ethernet, or cellular) and it’s the single most underappreciated piece of the entire IoT sensor data flow.

What it looks like physically: A gateway might be a dedicated IoT gateway appliance, a vehicle-mounted telematics unit, a Raspberry Pi running open-source gateway software, or even a smartphone. In our container fleet, imagine a ruggedized gateway mounted inside each reefer unit with a cellular modem and an external antenna.

What it does: The gateway scans for BLE advertisements, parses the raw payloads into structured data, and forwards that data to the cloud over an IP connection. But the interesting architectural question is: how much intelligence lives at the edge?

A “dumb pipe” gateway does nothing but forward raw bytes. A “smart edge” gateway can filter, deduplicate, aggregate, and even run threshold-based alerting locally. My recommendation in almost every engagement: put some intelligence at the edge. If a container’s temperature hasn’t changed in the last ten readings, there’s no reason to send all ten. If temperature spikes above a critical threshold, the gateway can fire a local alert immediately rather than waiting for a round-trip to the cloud.

Edge processing reduces cellular bandwidth costs, a real concern when you’re running thousands of gateways on metered connections. For a fleet of 500 containers reporting every five seconds, the difference between sending every reading and sending only meaningful changes can be an order of magnitude in monthly data costs.

Connectivity resilience matters too. Cellular connections drop. Wi-Fi goes down. A well-designed gateway implements store-and-forward: buffer messages locally during outages, then flush the backlog when connectivity returns. Without this, you get data gaps during the exact moments (a truck passing through a tunnel, a container crossing ocean) when the readings might matter most.

Stage 3: MQTT — The Transport Protocol That Earns Its Dominance

The gateway needs to send structured messages to the cloud. The protocol choice here matters, and MQTT wins for BLE-to-cloud telematics pipelines in almost every case.

Why MQTT: It’s lightweight (minimal packet overhead), uses a publish/subscribe model, and was specifically designed for unreliable networks and constrained devices. A gateway publishes messages to a topic, say fleet/container/101/telemetry, and cloud services subscribe to the topics they care about. The broker (Mosquitto is the standard open-source option) handles routing.

GATEWAY A ──publish──▶ ┌────────────────┐ ──subscribe──▶ INGESTION SERVICE
(topic: asset/101/temp)│                │
                       │  MQTT BROKER   │
GATEWAY B ──publish──▶ │  (Mosquitto)   │ ──subscribe──▶ ALERTING SERVICE
(topic: asset/202/temp)│                │
                       └────────────────┘

QoS levels control delivery guarantees. QoS 0 is fire-and-forget. QoS 2 is exactly-once but expensive. QoS 1, at-least-once delivery, is the sweet spot for most telematics. You might occasionally get a duplicate reading (easily handled with deduplication downstream), but you won’t silently lose data.

MQTT over TLS is non-negotiable in production. You’re transmitting operational data, potentially including location, asset status, and environmental conditions, over public networks. Encrypt it.

Why not alternatives? HTTP REST adds overhead per request and doesn’t handle intermittent connectivity gracefully. CoAP is designed for even more constrained devices than a gateway typically is. AMQP is heavier than needed. MQTT hits the right tradeoff for this BLE gateway-to-cloud use case.

Stage 4: Cloud Ingestion — The Validation Checkpoint

The MQTT broker, either cloud-hosted or self-managed, receives messages from hundreds or thousands of gateways. What comes next?

A lightweight ingestion service subscribes to the relevant topics, reads each message, validates the payload against the expected schema, and writes to the database. This service is your quality gate. It catches malformed messages, handles schema versioning (what happens when you deploy new sensor firmware that adds a field?), and transforms data into the format your database expects.

Schema discipline starts at the gateway. If your gateways publish consistent JSON or Protobuf payloads with predictable field names and types, ingestion is straightforward. If every gateway version produces slightly different output, your ingestion service becomes a nightmare of edge cases.

At scale (thousands of devices, millions of messages per day), insert a message queue like Redis Streams or Apache Kafka between the broker and the database. This decouples ingestion rate from write rate and enables fan-out: the same message can feed your time-series database, your alerting engine, and your analytics pipeline simultaneously. For sub-1,000 device deployments, writing directly from the ingestion service to the database works fine.

Stage 5: The Database — Where Sensor Readings Become Queryable Data

This is where the BLE sensor-to-cloud pipeline reaches its destination. The choice of database shapes everything you can do downstream.

Prometheus is excellent for real-time metrics and alerting. Its dimensional data model (labels like container_id, region, sensor_type) is a natural fit for telematics. One caveat: Prometheus uses a pull model by default, but telematics data is push-based. Use Prometheus Pushgateway for smaller deployments, or consider VictoriaMetrics, which is open-source, Prometheus-compatible, and natively push-friendly.

PostgreSQL is the analytical workhorse. It’s where you join sensor readings with asset metadata (which container belongs to which customer, which route, which carrier). For time-series queries, the TimescaleDB extension makes Postgres perform like a purpose-built TSDB while keeping full SQL capabilities.

InfluxDB is a dedicated open-source time-series database and a good fit if the team wants a focused TSDB without extending Postgres.

My default recommendation: run two stores. A time-series database (Prometheus/VictoriaMetrics or InfluxDB) for real-time metrics and alerting, and PostgreSQL for historical analysis, reporting, and joining sensor data with business context.

Data retention policies save you from drowning in storage costs. You don’t need raw five-second readings from two years ago. Downsample aggressively: keep raw data for 30 days, five-minute averages for a year, hourly averages indefinitely. Define this policy before you launch, not after your storage bill surprises you.

Downstream: Where the Pipeline Pays for Itself

Data sitting in a database is an expense. Data driving decisions is revenue.

Grafana is the open-source standard for dashboarding and natively connects to Prometheus, InfluxDB, and PostgreSQL. In our container fleet example, an operations manager opens a Grafana dashboard showing real-time temperature traces for every container. An alert rule fires when any container exceeds -15°C for more than 10 minutes. Grafana sends a Slack notification and a PagerDuty alert to the dispatch team.

That’s the basic case. The more interesting downstream value comes from combining data streams: vibration pattern changes that predict compressor failure before it happens (predictive maintenance), GPS plus temperature data that optimizes routing to minimize cold-chain risk, and automated compliance reporting that proves temperature integrity to regulators without manual effort.

Every architectural decision you made upstream directly determines what’s possible here. A sloppy schema means painful Grafana queries. The wrong database means you can’t join sensor data with asset records. Missing retention policies mean queries that take minutes instead of milliseconds.

The Decisions That Define Your Pipeline

The technology here is well-understood and largely open-source. The hard part isn’t any single stage; it’s designing clean handoffs between them. Here’s the decision checklist I walk through with every client:

Pipeline StageKey DecisionRecommended Default
BLE SensorBroadcast interval1–10s depending on use case
GatewayDumb pipe vs. smart edgeSmart edge (filter/buffer)
TransportProtocol choiceMQTT with QoS 1, TLS
Cloud IngestionDirect-to-DB vs. message queueDirect for <1K devices
DatabaseTime-series vs. relational vs. bothBoth (Prometheus + Postgres)
VisualizationDashboarding toolGrafana

Start with the recurring example that matches your use case. Trace a single sensor reading through all five stages: what format is it in, what transforms it, what could go wrong. If you can tell that story clearly for one reading, you can design the system for a million.


Hubble Network connects BLE sensors directly to satellite — eliminating gateways, edge infrastructure, and the complexity between “broadcast” and “cloud” entirely. See how it works →