Pavoorchatram, Tenkasi, Tamil Nadu 93459 14230  |  info@thartekinnovations.in
Illustrative configuration guide

From a coin-cell BLE sensor to a live dashboard.

An illustrative end-to-end configuration: a BLE sensor designed for 5+ years on one battery, a BLE gateway on Ethernet or Wi-Fi, an MQTT broker, and web and mobile dashboards that update as each message arrives.

The scenario

One sensor, one gateway, one dashboard

A temperature and humidity sensor sits in a cold room, a plant or a field enclosure where changing batteries is expensive. It must run for five years or more, report regularly, and show up live on a dashboard.

Note: All values on this page are illustrative starting points for a design discussion. Real figures are measured on your hardware and finalised during development.

ItemIllustrative target
Sensor deviceBLE 5 SoC, temperature and humidity sensor, non-connectable advertising
Power sourceSingle CR2032 coin cell (225 mAh nominal); alternatives: CR2450, Li-SOCl2 (e.g. 1/2 AA)
Battery-life target5 years or more at the configured reporting interval
Reporting interval10 s advertising of the latest reading (tunable 5 to 60 s)
GatewayBLE scanner with Ethernet and Wi-Fi uplink, local buffering, mains powered
TransportMQTT 3.1.1 / 5 over TLS (port 8883); WebSockets over TLS for browsers
ConsumersWeb dashboard, mobile app, alerts, long-term storage
Step-by-step data flow

BLE Device → BLE Gateway → Ethernet/Wi-Fi → MQTT Broker → Dashboard / App

Select a step to see what happens there and how we configure it. Press Replay to watch a reading travel the whole path.

1BLE Sensor Device

Wakes on an RTC timer, measures temperature and humidity, packs a compact reading into a BLE advertising packet, then returns to deep sleep.

Key configuration

  • Non-connectable (broadcast-only) advertising: no connection setup, lowest energy per message
  • Advertising interval 10 s (tunable); all three advertising channels
  • Transmit power 0 dBm, reduced (-4 dBm or lower) if the range allows
  • Payload of about 10 bytes in manufacturer-specific data: device type, sequence number, temperature, humidity, battery millivolts
  • Connectable mode only on button press for commissioning (short connection interval, then back to broadcast)
Key configuration points

What we set, and why

Five decisions determine battery life, reliability and how easily the data scales to more devices.

1. Low-power advertising and connection intervals

Every radio event costs energy, so the interval is the single biggest lever on battery life. For periodic sensor data, broadcast-only advertising avoids connection overhead entirely. Connections are kept for the rare moments they are needed, such as commissioning or configuration.

Rule of thumb: halving the interval roughly doubles the radio share of the energy budget. Use the calculator below to see the effect.

ParameterIllustrative valueWhy
Advertising typeNon-connectable, undirectedNo connection setup or acknowledgements
Advertising interval10 s (range 5 to 60 s)Radio event rate sets average current
Advertising channelsAll three (37, 38, 39)Robustness against Wi-Fi interference
TX power0 dBm, lower if range allowsLower TX power means less charge per event
Config-mode connection interval100 ms during commissioning onlyQuick parameter transfer, then return to broadcast
Config-mode timeoutShort (e.g. 60 s), then sleepPrevents a forgotten connection draining the cell
Gateway scanContinuous passive scanMains powered, so it never misses an advert

2. Battery-life budget (interactive)

Average current = sleep current + sensor average + (charge per advertising event / interval). Change any input to see the estimated life.

Derates for temperature, pulse loads and self-discharge
Measure on your hardware
--years estimated
--
Average current
--
Radio share
--
Usable energy
--
Advertising intervalAverage currentEstimated lifeMeets 5 years?

Defaults are illustrative: 225 mAh nominal CR2032, 80% usable, 6 µC per three-channel advertising event. Coin-cell capacity falls with pulse current, low temperature and age, so we verify the real result with current profiling and a battery model before committing to a life claim.

3. MQTT topic structure

A predictable hierarchy lets dashboards subscribe with wildcards, lets the broker enforce per-gateway access rules, and lets you add sites and devices without code changes.

  • Lowercase, no spaces, no leading slash, stable IDs
  • Hierarchy goes from broad to specific: owner / site / gateway / device / message type
  • Data never goes in the topic, only in the payload
  • One message type per topic (telemetry, alert, status, cmd)
  • Access control by prefix: a gateway may publish only under its own gateway ID
Topic tree
thartek/{site}/{gateway_id}/{device_id}/telemetry   gateway -> broker   QoS 1
thartek/{site}/{gateway_id}/{device_id}/alert       gateway -> broker   QoS 1
thartek/{site}/{gateway_id}/status                  gateway -> broker   QoS 1, retained (+ Last Will)
thartek/{site}/{gateway_id}/cmd/#                   broker  -> gateway  QoS 1

# Example
thartek/plant01/gw-7f3a/ble-a1b2c3/telemetry

# Dashboard subscriptions
thartek/plant01/+/+/telemetry      all sensors on site plant01
thartek/plant01/gw-7f3a/#          everything from one gateway

4. QoS levels

MQTT offers three delivery guarantees. Higher QoS costs extra packets, so we choose per message type. The BLE hop itself is broadcast-only and has no acknowledgement; reliability is added at the gateway-to-broker hop and by the sequence number, which lets the dashboard detect gaps and ignore duplicates.

MessageQoSRetainReason
Telemetry1NoAt-least-once delivery; duplicates removed using seq
Alerts (low battery, threshold)1NoMust arrive; duplicates harmless
Gateway status / Last Will1YesNew subscribers see online/offline state immediately
Commands and config to gateway1NoReliable delivery; commands are idempotent
High-rate, non-critical data0NoLowest overhead where loss is acceptable

QoS 2 (exactly-once) is reserved for rare cases where a duplicate would cause harm; it needs a four-step handshake. Use persistent sessions so queued messages survive short disconnects.

5. Payload format

Over the air, the sensor sends a compact binary record so each advertisement stays short, which saves energy. The gateway expands it to self-describing JSON for the broker, which is easy for dashboards, databases and third-party tools to consume.

  • Versioned schema (<code>v</code>) so fields can be added without breaking subscribers
  • UTC ISO-8601 timestamp added by the gateway from NTP time
  • Explicit units in field names (<code>temp_c</code>, <code>rh_pct</code>, <code>batt_mv</code>)
  • Sequence number for de-duplication and gap detection
  • Gateway adds <code>rssi_dbm</code> for link-quality monitoring; about 200 bytes per message
Sample JSON payload (topic: thartek/plant01/gw-7f3a/ble-a1b2c3/telemetry)
{
  "v": 1,
  "device_id": "ble-a1b2c3",
  "gateway_id": "gw-7f3a",
  "ts": "2026-11-06T11:42:10Z",
  "seq": 18452,
  "temp_c": 26.4,
  "rh_pct": 54.2,
  "batt_mv": 2950,
  "batt_pct": 88,
  "rssi_dbm": -71,
  "fw": "1.2.0"
}
Live data visualisation

How the data looks on the dashboard and the app

Both screens below are driven by one simulated MQTT feed. Each time a message arrives, the gauges, charts, status indicators and device table update in place. Nothing is refreshed or reloaded.

Simulated feed running Demo speed: one message every 2.5 s. A real sensor reports every 10 to 60 s.
Incoming MQTT messages (simulated) newest first
dashboard.example.com / plant01
Cold Room MonitorGateway onlineBroker connectedRSSI -- dBmUpdated --
--°C
Temperature
--% RH
Humidity
--%
Battery
Temperature and humidityTemp °C RH %
30 °C alert 34168030oldernow
DeviceTempBatteryStatus
ble-a1b2c3-- °C--%Online
ble-d4e5f6-- °C76%Online
ble-90ab12--9% (low)Stale · 6 min
Thartek SenseLive
Cold Room · ble-a1b2c3
--°C
Humidity
--%
Battery
--%
Last update -- · RSSI -- dBm

1. A message arrives

The gateway publishes a reading to the broker. Every subscribed screen receives it through its open WebSocket connection.

2. Widgets update in place

The app parses the JSON and moves the gauge needles, extends the chart line and refreshes the status chips, with no page reload.

3. Rules raise alerts

A reading above the threshold shows an alert banner. A device that stops sending is flagged as stale after a set time.

How a browser subscribes

A web dashboard connects to the broker over secure WebSockets and subscribes to the site's telemetry topics. Production systems usually also store every message in a time-series database, so history, reports and alerts do not depend on a browser being open.

Browser subscription (MQTT.js)
const client = mqtt.connect('wss://broker.example.com:8084/mqtt', {
  username: 'dashboard-plant01', password: TOKEN
});
client.on('connect', () =>
  client.subscribe('thartek/plant01/+/+/telemetry', { qos: 1 }));
client.on('message', (topic, payload) => {
  const d = JSON.parse(payload.toString());
  updateGauges(d);   // temp_c, rh_pct, batt_pct
  appendToChart(d);  // ts, temp_c, rh_pct
});

Need a connected device like this?

We design the sensor, gateway, firmware, broker integration and dashboards as one system.