Asset Tracking Meets AI: How to Integrate GPS Trackers and BLE Tags with ASI Biont for Smarter Logistics

Introduction

Asset tracking is the backbone of modern logistics, warehouse management, and field service operations. Whether you're monitoring a fleet of delivery vehicles, keeping tabs on high-value equipment, or ensuring temperature-sensitive goods stay within range, real-time location and condition data is critical. But raw GPS coordinates or BLE beacon signals are just numbers — they only become valuable when an intelligent system can interpret them, detect anomalies, and trigger actions automatically.

That’s where ASI Biont comes in. ASI Biont is an AI agent that can connect to virtually any IoT device or industrial system through a chat conversation. You describe your device (ESP32 with GPS, BLE tag gateway, or a dedicated GPS tracker), provide connection parameters, and the AI writes the integration code on the fly. No dashboards, no drag-and-drop editors — just a natural dialogue that turns raw asset data into actionable intelligence.

In this article, we’ll walk through a concrete scenario: integrating a GPS tracker with ASI Biont via MQTT, parsing location and environmental data, and automating alerts and reports. We’ll also cover alternative connection methods (COM port, HTTP API) and discuss which AI models can run on edge devices for offline tracking.

Why Connect Asset Tracking to an AI Agent?

Traditional asset tracking systems generate massive volumes of telemetry: lat/lon coordinates, timestamps, battery levels, temperature, humidity, and sometimes acceleration. Human operators can monitor a handful of assets, but scaling to hundreds or thousands requires automation.

An AI agent like ASI Biont can:
- Parse NMEA sentences (GPS data) or BLE advertisement packets in real time.
- Detect geofence violations — when an asset leaves a defined area, the AI can send a Telegram or email alert.
- Correlate sensor data — if a refrigerated truck’s temperature rises above a threshold while the engine is off, the AI can flag a potential failure.
- Generate periodic reports — daily movement summaries, idle time analysis, or route optimization suggestions.
- Trigger actions — lock/unlock a container, turn on a beacon, or adjust a thermostat via Modbus or HTTP.

All this happens without a single line of manual Python code. You just tell ASI Biont what you want, and it writes the script.

Connection Methods for Asset Tracking Devices

ASI Biont supports multiple protocols to connect to asset tracking hardware. The choice depends on your device’s capabilities:

Device Type Typical Interface Recommended ASI Biont Method Why
GPS tracker with UART output COM port (RS-232) Hardware Bridge (bridge.py) Reads NMEA sentences directly via serial; AI uses serial_write_and_read with hex commands.
ESP32 with GPS module (NEO-6M, u-blox) MQTT or CoAP MQTT (via execute_python with paho-mqtt) ESP32 publishes GPS data to a broker; AI subscribes and processes.
BLE tag gateway (e.g., Raspberry Pi + BLE dongle) MQTT or HTTP MQTT or HTTP API Gateway collects BLE beacon RSSI and forwards to broker or REST endpoint.
Cellular-based asset tracker with cloud API HTTP API HTTP API (via execute_python with aiohttp) AI pulls data from the tracker’s cloud platform (e.g., AWS IoT Core, Azure IoT Hub).
Industrial RFID reader Modbus/TCP Modbus/TCP Reader exposes tag reads as Modbus registers.

If your device has a COM port, you run bridge.py on a local PC. For network-connected devices, AI uses execute_python in the cloud sandbox.

Concrete Use Case: ESP32 GPS Tracker + MQTT + ASI Biont

Scenario

You have an ESP32 with a GPS module (NEO-6M) and a DHT22 temperature/humidity sensor. The ESP32 publishes JSON messages every 30 seconds to an MQTT broker (Mosquitto on a Raspberry Pi). You want ASI Biont to:
- Subscribe to the topic assets/truck1.
- Parse the JSON payload (lat, lon, temp, humidity).
- Check if the truck is within a geofence (a circular area around the warehouse).
- If outside geofence, send a Telegram alert.
- Generate a daily CSV report of all positions.

Step 1: ESP32 Code (Arduino IDE)

The ESP32 publishes data via MQTT. Here’s a simplified sketch:

#include <WiFi.h>
#include <PubSubClient.h>
#include <TinyGPS++.h>
#include <DHT.h>

#define DHTPIN 4
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);

TinyGPSPlus gps;
WiFiClient espClient;
PubSubClient client(espClient);

const char* mqtt_server = "192.168.1.100";
const char* topic = "assets/truck1";

void setup() {
  Serial.begin(9600);
  WiFi.begin("SSID", "password");
  client.setServer(mqtt_server, 1883);
  dht.begin();
}

void loop() {
  while (Serial.available() > 0) gps.encode(Serial.read());

  if (gps.location.isValid() && gps.location.age() < 2000) {
    float temp = dht.readTemperature();
    float hum = dht.readHumidity();

    char buffer[256];
    snprintf(buffer, 256, 
      "{\"lat\":%.6f,\"lon\":%.6f,\"temp\":%.1f,\"hum\":%.1f,\"alt\":%.1f}",
      gps.location.lat(), gps.location.lng(), temp, hum, gps.altitude.meters());

    if (client.connected()) {
      client.publish(topic, buffer);
    }
  }
  delay(30000);
}

Step 2: User Describes Integration in ASI Biont Chat

You open ASI Biont and type:

“Connect to MQTT broker at 192.168.1.100:1883. Subscribe to topic assets/truck1. Parse JSON with lat, lon, temp, hum. If the distance from warehouse (40.7128, -74.0060) exceeds 500 meters, send a Telegram alert to @mybot with token 123456:ABC. Also append each reading to a CSV file named truck1_log.csv.”

Step 3: AI Generates and Executes the Python Script

ASI Biont writes a Python script using paho-mqtt and runs it in the sandbox. Here’s what it looks like:

import paho.mqtt.client as mqtt
import json
import csv
import math
from datetime import datetime
import requests

WAREHOUSE_LAT = 40.7128
WAREHOUSE_LON = -74.0060
MAX_DISTANCE_M = 500
TELEGRAM_TOKEN = "123456:ABC"
CHAT_ID = "@mybot"
CSV_FILE = "truck1_log.csv"

def haversine(lat1, lon1, lat2, lon2):
    R = 6371000
    phi1, phi2 = math.radians(lat1), math.radians(lat2)
    dphi = math.radians(lat2 - lat1)
    dlambda = math.radians(lon2 - lon1)
    a = math.sin(dphi/2)**2 + math.cos(phi1)*math.cos(phi2)*math.sin(dlambda/2)**2
    return 2 * R * math.atan2(math.sqrt(a), math.sqrt(1-a))

def on_message(client, userdata, msg):
    data = json.loads(msg.payload.decode())
    lat, lon = data['lat'], data['lon']
    dist = haversine(lat, lon, WAREHOUSE_LAT, WAREHOUSE_LON)

    # Write to CSV
    with open(CSV_FILE, 'a', newline='') as f:
        writer = csv.writer(f)
        writer.writerow([datetime.now(), lat, lon, data['temp'], data['hum'], dist])

    # Geofence check
    if dist > MAX_DISTANCE_M:
        msg_text = f"ALERT: Truck1 is {dist:.0f}m from warehouse!"
        requests.post(f"https://api.telegram.org/bot{TELEGRAM_TOKEN}/sendMessage",
                      json={"chat_id": CHAT_ID, "text": msg_text})

client = mqtt.Client()
client.on_message = on_message
client.connect("192.168.1.100", 1883, 60)
client.subscribe("assets/truck1")
client.loop_forever()

The script runs continuously (within the sandbox timeout limits for long-lived MQTT listeners). Every 30 seconds, it processes a new reading.

Step 4: AI Creates a Daily Report

You can ask: “Generate a PDF report of yesterday’s positions with a map plot.” The AI will use matplotlib to plot coordinates on a map and fpdf2 to create a PDF.

Alternative: Hardware Bridge for Serial GPS Trackers

If your tracker outputs NMEA sentences over a COM port (e.g., a u-blox NEO-M8N connected to a PC via USB), you use the Hardware Bridge. Run:

pip install pyserial requests websockets
python bridge.py --token=YOUR_API_KEY --ports=COM3 --baud=9600

Then in the chat:

“Connect to COM3 at 9600 baud. Read NMEA sentences, parse $GPGGA for lat/lon, and log to a CSV. If altitude exceeds 1000m, send an email alert.”

ASI Biont uses the industrial_command tool with serial_write_and_read to communicate. The bridge sends the command to the serial port and returns the response.

What AI Models Can Run on the Edge?

For asset tracking, edge AI is useful for:
- Anomaly detection — detect unusual vibration patterns (e.g., a package being dropped) using a small TensorFlow Lite model on an ESP32 or Raspberry Pi.
- Predictive maintenance — forecast battery depletion or motor failure based on sensor trends.
- Computer vision — if using a camera (e.g., ESP32-CAM), run MobileNet to identify package labels or barcodes.

ASI Biont can deploy a TensorFlow Lite model via MQTT or SSH to the edge device, collect inference results, and act on them.

Real-World Scenarios

Scenario Devices AI Actions
Cold chain monitoring ESP32 + GPS + DHT22 Alert if temperature exceeds 4°C for 10 minutes; generate compliance reports.
Fleet management Cellular GPS tracker (HTTP API) Geofence alerts, idle time detection, route optimization suggestions.
Warehouse inventory BLE tags + gateway Detect tag movement between zones; update inventory database.
Tool tracking BLE beacon + ESP32 gateway Notify when a tool leaves the workshop; log last seen location.

Why ASI Biont Changes the Game

Traditional integration requires:
- Writing and debugging MQTT client code.
- Setting up database connections.
- Building alerting logic.
- Deploying and monitoring scripts.

With ASI Biont, you skip all that. You describe the device and the desired behavior in plain English, and the AI writes production-ready Python code that runs in the sandbox. No need to wait for developers — connect any asset tracking device in minutes.

Conclusion

Asset tracking becomes truly powerful when combined with an intelligent agent that can interpret data, enforce rules, and communicate with other systems. ASI Biont makes this integration accessible to anyone — logistics managers, warehouse operators, or IoT enthusiasts — by replacing manual coding with a simple chat conversation.

Ready to connect your GPS tracker or BLE tags? Go to asibiont.com, create an API key, and start talking to your assets today.

← All posts

Comments