BLE / Bluetooth (HM-10, HC-05) Meets AI: How ASI Biont Automates IoT Devices with Proximity, Sensor Fusion, and Predictive Logic

Introduction

Bluetooth Low Energy (BLE) modules like HM-10 and HC-05 have become the backbone of countless IoT prototypes, smart home sensors, and wearable devices. These tiny transceivers cost under $5, draw microamps in sleep mode, and can communicate with any smartphone or PC. But their real potential remains untapped: raw sensor data from a BLE thermometer or a motion detector is just noise unless an intelligent agent can analyze patterns, trigger actions, and adapt over time.

This is where ASI Biont changes the game. Instead of writing custom firmware, configuring MQTT brokers, or building dashboards, you simply describe your BLE device in a chat conversation with the AI agent. ASI Biont connects to your HM-10 or HC-05 through Hardware Bridge (via COM port) or execute_python (for PC-side Bluetooth stacks) and begins reasoning about the data. The AI can forecast temperature trends, detect occupancy anomalies, or send Telegram alerts when a door sensor triggers — all without a single line of manual integration code.

In this article, we’ll explore how ASI Biont talks to BLE modules, which connection method to choose for different scenarios, and walk through a concrete use case: a smart environment monitor that predicts comfort levels and saves energy.


1. Why Connect a BLE Module to an AI Agent?

BLE modules are traditionally used as wireless UART bridges: an Arduino reads a sensor and sends the value over Bluetooth to a phone app. That app displays the number, but it doesn’t learn, predict, or automate. With ASI Biont, the same data stream becomes the input for a continuously running AI pipeline:

  • Pattern recognition: detect when a room’s temperature rises unusually fast (e.g., HVAC failure).
  • Predictive maintenance: analyze vibration data from a BLE accelerometer to forecast bearing wear.
  • Contextual automation: turn on lights only when occupancy is detected AND ambient light is below a threshold.
  • Multi-device orchestration: a BLE door sensor triggers the AI to check a smart plug (via HTTP API) and turn off the iron if the user left.

The AI doesn’t just react — it learns normal baselines and alerts on deviations, making your BLE device part of a self-optimizing system.


2. How ASI Biont Connects to BLE / Bluetooth (HM-10, HC-05)

ASI Biont offers two primary connection paths for BLE modules, depending on whether the module is wired to a PC or embedded in a standalone device.

Method A: Hardware Bridge (COM Port) – Best for HM-10 / HC-05 connected to a PC via USB-UART

The most common setup: an HM-10 module is connected to a USB-to-UART adapter (e.g., CP2102, CH340) and plugged into a Windows/Linux/macOS PC. The user runs bridge.py (downloaded from the ASI Biont dashboard) on that PC. Bridge.py opens a WebSocket to the ASI Biont cloud and exposes the COM port (e.g., COM3, /dev/ttyUSB0) to the AI.

How it works:
1. User configures bridge.py with --token=YOUR_TOKEN --ports=COM3 --baud 9600.
2. In the ASI Biont chat, the user types: “Connect to HM-10 on COM3 at 9600 baud, send AT to verify, then read sensor data every 10 seconds.”
3. AI uses the industrial_command tool with protocol serial:// and command serial_write_and_read(data="41540d0a") (AT command in hex).
4. Bridge.py writes the bytes to the COM port and returns the response (e.g., OK).
5. AI then sets up a periodic read loop (via schedule_task) that queries the BLE module for sensor values.

Real-world example (shown as a Python snippet that AI executes in the sandbox for background tasks, not for real-time COM access – the actual COM writes always go through industrial_command):

# This code runs in execute_python on the ASI Biont server
# It does NOT access COM directly – it uses industrial_command
# But the AI logs the plan and then calls the tool.

# AI generates this plan:
# 1. Send "AT" to HM-10 → expect "OK"
# 2. Send "AT+UART?" → read current baud rate
# 3. Send "AT+ROLE0" → set slave mode
# 4. Read temperature every 30 seconds

# The user sees the AI executing each step via industrial_command in the chat.

Method B: execute_python (Bluetooth on PC) – Best for HC-05 built into a laptop or Raspberry Pi

If the BLE device is already paired with a PC (e.g., a Raspberry Pi with built-in Bluetooth), the AI can use execute_python to run a Python script that uses the socket library (RFCOMM) or bleak (for BLE) to communicate. The script runs in the sandbox with a 30-second timeout, so it’s ideal for one-shot reads or commands.

Example: Query an HC-05 connected to an Arduino with a DHT22 sensor.

import socket

# Connect to the paired HC-05 (RFCOMM)
# Address and port obtained via user description
sock = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)
sock.connect(("00:11:22:33:44:55", 1))
sock.send(b"GET_TEMP\n")
response = sock.recv(1024).decode().strip()
sock.close()

# Return the temperature for AI analysis
print(f"Temperature: {response}°C")

Important: The user provides the MAC address and channel. The AI writes the script, executes it, and parses the result. For long-running monitoring, the AI uses schedule_task to re-run the script every N seconds.


3. Use Case: Smart Environment Monitor with Predictive Alerts

Let’s build a complete scenario: an HM-10 module connected to an Arduino Uno with a DHT22 temperature/humidity sensor and a PIR motion sensor. The Arduino sends a CSV string every 5 seconds over BLE UART:

25.3,58.2,1

Where 25.3 is temperature (°C), 58.2 is humidity (%), and 1 means motion detected.

Step 1: Hardware Setup

Component Connection
Arduino Uno DHT22 data → pin 7, PIR out → pin 8
HM-10 TX → RX (Arduino), RX → TX, VCC → 3.3V, GND → GND
PC HM-10 via USB-UART on COM3

Step 2: User Describes the Task in ASI Biont Chat

“Connect to HM-10 on COM3 at 9600 baud. Every 5 seconds, read a line like 25.3,58.2,1. Parse temperature, humidity, motion. If motion detected and temperature > 28°C, turn on a smart plug (HTTP API at 192.168.1.100:8080). If no motion for 10 minutes, turn off the plug. Also, predict when temperature will exceed 30°C based on the last 10 readings and send a Telegram alert.”

Step 3: AI Agent Takes Over

The AI interprets the request and performs the following actions:

  1. Verifies connection via industrial_command(protocol='serial', command='serial_write_and_read', data='41540d0a') → expects OK.
  2. Sets up a scheduled task to read the COM port every 5 seconds.
  3. Parses the CSV and stores the last 10 values in memory.
  4. Implements logic:
  5. If motion == 1 and temp > 28 → publish MQTT or HTTP POST to smart plug ON.
  6. If no motion for 10 minutes (tracked via timestamps) → smart plug OFF.
  7. Compute linear regression slope of temperature over last 10 readings. If projected to exceed 30°C within 30 minutes → send Telegram alert.

Code that AI writes (background task, runs in sandbox):

import requests
from datetime import datetime, timedelta

# Simulated data – in reality, AI stores data from industrial_command calls
readings = [
    {"temp": 25.3, "hum": 58.2, "motion": 1, "ts": datetime.now() - timedelta(seconds=30)},
    {"temp": 26.1, "hum": 57.8, "motion": 0, "ts": datetime.now() - timedelta(seconds=25)},
    # ... more readings
]

latest = readings[-1]
motion_detected = latest["motion"] == 1
temp_now = latest["temp"]

# Smart plug control
PLUG_URL = "http://192.168.1.100:8080/relay"
if motion_detected and temp_now > 28:
    requests.post(PLUG_URL, json={"state": "on"})
    print("Plug turned ON")

# No-motion timeout
if not any(r["motion"] for r in readings if r["ts"] > datetime.now() - timedelta(minutes=10)):
    requests.post(PLUG_URL, json={"state": "off"})
    print("Plug turned OFF due to inactivity")

# Temperature prediction (simple linear)
temps = [r["temp"] for r in readings[-10:]]
slope = (temps[-1] - temps[0]) / len(temps)  # rough estimate
if temp_now + slope * 6 > 30:  # 6 steps = 30 seconds, but real time is 5 sec/step
    # Send Telegram alert
    requests.post(f"https://api.telegram.org/bot{TOKEN}/sendMessage",
                  json={"chat_id": CHAT_ID, "text": f"Temperature may exceed 30°C soon! Current: {temp_now}"})
    print("Alert sent")

print("Monitor cycle complete")

Step 4: Result

  • The AI now runs this logic every 5 seconds without user intervention.
  • If the user wants to change thresholds (e.g., 26°C instead of 28°C), they just say: “Change the temperature threshold to 26°C.” The AI updates the logic instantly.
  • No firmware change, no new deployment – just a chat message.

4. Comparison: BLE Integration Methods

Method Best For Latency Complexity
Hardware Bridge (COM) HM-10/HC-05 wired to PC Low (~10 ms) User runs bridge.py once
execute_python (RFCOMM) HC-05 paired to Raspberry Pi Medium (~100 ms) User provides MAC address
execute_python (BLE via bleak) BLE HM-10 with no pairing Medium (~200 ms) Requires bleak library

All methods work through the same chat interface. The AI selects the appropriate one based on the user’s description.


5. Why This Matters: The AI Does the Integration Work

Traditional IoT development requires:
- Writing a Python script with pyserial and error handling
- Setting up a database to store readings
- Coding a rule engine for alerts
- Deploying and debugging on the target machine

With ASI Biont, all of that happens automatically. The user describes the device, the desired behavior, and the AI generates and runs the code in seconds. If the device changes (e.g., new sensor), the user just updates the description.

Key benefits:
- No coding skills required – the AI writes the integration code.
- Instant adaptation – change logic via chat, no firmware update.
- Predictive capabilities – built-in ML libraries (scikit-learn, numpy) allow trend analysis without extra setup.
- Multi-protocol – the same AI can control BLE, MQTT, HTTP, and Modbus devices in one workflow.


Conclusion

BLE modules like HM-10 and HC-05 are no longer just wireless serial bridges. When connected to ASI Biont via Hardware Bridge or execute_python, they become intelligent edge nodes that can predict, adapt, and automate. The AI handles the entire integration – from parsing sensor data to triggering cross-device actions – all through a natural chat conversation.

Whether you’re building a smart greenhouse, a home security system, or an industrial vibration monitor, the combination of BLE hardware and a reasoning AI agent unlocks a new level of automation without the traditional engineering overhead.

Ready to give your BLE device a brain? Go to asibiont.com, download bridge.py from the dashboard, and tell the AI agent what you want to monitor. No code, no waiting – just results.

← All posts

Comments