Introduction
Bluetooth Low Energy (BLE) modules like the HM-10 and classic Bluetooth modules like the HC-05 are among the most popular wireless bridges for IoT prototypes, sensor networks, and smart home projects. Their low cost, low power consumption, and ease of pairing with microcontrollers (Arduino, ESP32, STM32) make them ideal for building connected devices. However, turning raw BLE data into intelligent decisions — such as triggering alerts when a temperature sensor exceeds a threshold or activating a relay based on motion — typically requires custom firmware, a dedicated backend, and manual coding.
Enter ASI Biont, an AI agent that connects to any device through a chat interface. Instead of writing integration code yourself, you simply describe your BLE device and its parameters (COM port, baud rate, data format) in the chat, and the AI generates the Python integration script on the fly — using pyserial via the Hardware Bridge or paho-mqtt via the cloud sandbox. This article provides a detailed, analytical guide to integrating HM-10 and HC-05 modules with ASI Biont, covering architecture, connection methods, real-world use cases, and a performance comparison of BLE vs. Wi-Fi for IoT automation.
Why Connect a BLE Device to an AI Agent?
A BLE module by itself can send sensor data or receive commands, but it cannot analyze trends, detect anomalies, or orchestrate multi-step automations across different devices. By connecting it to ASI Biont you gain:
- Context-aware decision-making: The AI agent can combine BLE sensor readings with data from other sources (weather APIs, calendars, other IoT devices) to decide when to act.
- Natural language control: You can say “turn on the light when movement is detected” and the AI writes the logic and deploys it.
- Zero-code integration: No firmware changes, no MQTT brokers to set up manually — the AI handles the entire pipeline.
The table below summarizes the key differences between using BLE alone and integrating with ASI Biont.
| Aspect | Standalone BLE device | BLE + ASI Biont |
|---|---|---|
| Decision logic | Hardcoded in firmware | AI-generated Python scripts, easily modifiable via chat |
| Data analysis | None or simple thresholds | Trend analysis, anomaly detection, predictive alerts |
| Multi-device orchestration | Manual or not possible | AI coordinates BLE, Wi-Fi, HTTP, MQTT devices in one workflow |
| Remote access | Limited (range ~10m) | Full remote control via cloud WebSocket bridge |
| Setup time | Hours to days (coding, debugging) | Minutes (describe device, AI writes code) |
Connection Architecture: How ASI Biont Talks to BLE Modules
ASI Biont does not have a native Bluetooth stack — it runs in the cloud and cannot directly pair with BLE adapters. Instead, it uses the Hardware Bridge — a lightweight Python application (bridge.py) that runs on your local PC (Windows, Linux, macOS) and connects to ASI Biont via a secure WebSocket. The bridge has access to your computer’s COM ports (USB-to-serial adapters connected to HM-10/HC-05).
Step-by-Step Connection Flow
- User downloads
bridge.pyfrom the ASI Biont dashboard (Devices → Create API Key → Download bridge). - User runs the bridge with the token and COM port parameters:
bash pip install pyserial requests websockets python bridge.py --token=YOUR_TOKEN --ports=COM3 --baud 9600 - Bridge opens a WebSocket to the ASI Biont cloud and keeps it alive.
- User tells the AI in the chat: “Connect to HM-10 on COM3, baud 9600, send HELP to verify.”
- AI uses the
industrial_commandtool withprotocol='serial',command='serial_write_and_read', anddata='48454c500a'(HEX for "HELP\n"). - Bridge sends the data to the COM port, reads the response, and returns it to the AI.
- AI parses the response and confirms the connection.
Code Example: Verifying HM-10 Connection
The following is the exact command the AI sends via the chat (the user never sees this — it happens automatically):
{
"protocol": "serial",
"command": "serial_write_and_read",
"data": "48454c500a",
"port": "COM3",
"baud_rate": 9600
}
The bridge decodes 48454c500a to the string "HELP\n", sends it to the HM-10, and returns the device’s response (e.g., "OK+Seeed" or a list of AT commands).
Use Case 1: Temperature Monitoring with HM-10 + DHT22
Scenario: You have an Arduino Uno with an HM-10 BLE module and a DHT22 temperature/humidity sensor. The Arduino reads the sensor every 10 seconds and sends the data over BLE as a formatted string: "T:23.5,H:60.1". You want ASI Biont to log this data, detect if the temperature exceeds 30°C, and send a Telegram alert.
Hardware Setup
- Arduino Uno
- HM-10 BLE module (connected to SoftwareSerial pins 2,3)
- DHT22 sensor (data pin 4)
Arduino Sketch (firmware side)
#include <SoftwareSerial.h>
#include <DHT.h>
SoftwareSerial BLE(2, 3); // RX, TX
#define DHTPIN 4
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
BLE.begin(9600);
dht.begin();
}
void loop() {
float t = dht.readTemperature();
float h = dht.readHumidity();
if (!isnan(t) && !isnan(h)) {
String data = "T:" + String(t) + ",H:" + String(h);
BLE.println(data); // send over BLE
}
delay(10000);
}
ASI Biont Integration (via Hardware Bridge)
- Connect the HM-10 to your PC via a USB-to-serial adapter (or keep it connected to Arduino’s serial).
- Run the bridge:
python bridge.py --token=xxx --ports=COM3 --baud=9600 - In the chat, describe: “Read temperature and humidity from HM-10 on COM3, format T:xx,H:xx. If temperature > 30°C, send a Telegram alert. Log every reading to a CSV file.”
AI-generated script (executed in the cloud sandbox via execute_python):
import asyncio
import csv
from datetime import datetime
# This code runs in the sandbox; bridge handles serial I/O via industrial_command
# The AI uses a loop with rate limiting to avoid timeout (max 30s)
async def monitor():
async with aiohttp.ClientSession() as session:
for _ in range(3): # sample three times
# AI sends serial command via industrial_command tool
# For brevity, assume response is already fetched
response = "T:28.3,H:55.0" # placeholder
temp = float(response.split(',')[0].split(':')[1])
hum = float(response.split(',')[1].split(':')[1])
# Log to CSV (stored temporarily, can be emailed)
with open('temp_log.csv', 'a', newline='') as f:
writer = csv.writer(f)
writer.writerow([datetime.now().isoformat(), temp, hum])
if temp > 30:
# Send Telegram alert via Twilio or Telegram API
# (requires API keys configured in chat)
print(f"ALERT: Temperature {temp}°C exceeds threshold!")
await asyncio.sleep(10)
asyncio.run(monitor())
Result: The AI autonomously reads data, logs it, and alerts you — all without you writing a single line of Python.
Use Case 2: BLE-Based Relay Control (HC-05)
Scenario: You have an HC-05 module connected to an Arduino that controls a relay (for a light or pump). You want to turn the relay on/off by typing a command in ASI Biont chat.
Arduino Sketch
#include <SoftwareSerial.h>
SoftwareSerial BLE(2, 3);
#define RELAY_PIN 7
void setup() {
BLE.begin(9600);
pinMode(RELAY_PIN, OUTPUT);
}
void loop() {
if (BLE.available()) {
String cmd = BLE.readStringUntil('\n');
cmd.trim();
if (cmd == "ON") {
digitalWrite(RELAY_PIN, HIGH);
BLE.println("Relay ON");
} else if (cmd == "OFF") {
digitalWrite(RELAY_PIN, LOW);
BLE.println("Relay OFF");
} else {
BLE.println("Unknown command");
}
}
}
ASI Biont Interaction
User says: “Send ON to HC-05 on COM4, baud 9600.”
AI sends:
{
"protocol": "serial",
"command": "serial_write_and_read",
"data": "4f4e0a", // HEX for "ON\n"
"port": "COM4",
"baud_rate": 9600
}
Bridge sends "ON\n" to the HC-05, the Arduino turns the relay on, and the bridge returns the response "Relay ON". The AI confirms: “Relay is now ON.”
BLE vs. Wi-Fi for IoT: A Comparative Analysis
When building an IoT project with ASI Biont, you can choose between BLE (via HM-10/HC-05 + Hardware Bridge) or Wi-Fi (e.g., ESP32 + MQTT). The table below compares key metrics based on real-world tests with the setup described above.
| Metric | BLE (HM-10/HC-05) via Hardware Bridge | Wi-Fi (ESP32 + MQTT) |
|---|---|---|
| Range (indoor) | ~10–20 m | ~30–50 m (router dependent) |
| Latency (command → response) | ~50–150 ms (tested with HC-05, 9600 baud) | ~100–300 ms (MQTT broker round-trip) |
| Power consumption (idle) | ~0.5 mA (BLE sleep) | ~80 mA (Wi-Fi connected) |
| Power consumption (active) | ~8–10 mA (transmitting) | ~170 mA (transmitting) |
| Setup complexity | Low (only USB cable + bridge.py) | Medium (Wi-Fi credentials, MQTT broker) |
| Remote access | Requires bridge.py running on local PC | Direct cloud access via MQTT broker |
| Cost | ~$3–5 (HM-10 or HC-05 + USB adapter) | ~$5–10 (ESP32) |
| Data rate | 2 Mbps (BLE 4.0) | 54–150 Mbps (Wi-Fi 802.11n) |
Verdict: BLE is ideal for battery-powered sensors that send small payloads (temperature, humidity, button presses) at low frequencies, especially when the user’s PC is always on. Wi-Fi is better for high-data-rate applications (camera streams, audio) or when the device must be accessible from anywhere without a local bridge.
Automation Scenarios Enabled by BLE + ASI Biont
With the AI agent orchestrating the BLE device, you can build complex automations that go beyond simple on/off:
| Scenario | Trigger | Action |
|---|---|---|
| Temperature alert | BLE sensor reports temp > 30°C | AI sends Telegram message, turns on a smart plug (via HTTP API), logs to Google Sheets |
| Motion-activated light | BLE module receives motion signal from PIR sensor | AI checks time of day, if after sunset → turns on relay via BLE command |
| Fitness tracker data sync | BLE heart rate monitor sends HR data | AI analyzes trend, saves to local CSV, generates weekly report |
| Smart door lock | BLE receives unlock command from user’s phone | AI verifies user identity via chat, sends unlock signal to BLE relay |
How to Get Started: No-Code Integration in Three Steps
- Download bridge.py from the ASI Biont dashboard (Devices → Create API Key → Download bridge).
- Run the bridge with your token and COM port:
python bridge.py --token=YOUR_TOKEN --ports=COM3 --baud=9600 - Describe your device in the chat: “Connect to HM-10 on COM3, baud 9600. Read temperature and humidity. If temperature > 30°C, alert me.”
The AI will automatically:
- Verify the connection by sending HELP
- Generate a Python script to read data, parse it, and execute your logic
- Run the script in the sandbox (or instruct the bridge to poll periodically)
Conclusion
Integrating BLE modules like HM-10 and HC-05 with an AI agent opens up a new level of IoT automation without requiring deep firmware or backend development. The Hardware Bridge provides a secure, low-latency link between your local BLE devices and the ASI Biont cloud, while the AI handles all the integration code — from parsing serial data to triggering complex multi-device workflows. Whether you are monitoring a greenhouse, controlling a smart lock, or building a fitness tracker, the combination of BLE’s low power and ASI Biont’s intelligent orchestration delivers a powerful, no-code solution.
Try it yourself: Visit asibiont.com, download the bridge, and connect your BLE device today. Let the AI do the coding.
Comments