Introduction
Bluetooth Low Energy (BLE) and classic Bluetooth modules like the HM-10 and HC-05 are ubiquitous in IoT prototyping. They allow microcontrollers to communicate wirelessly with phones, computers, and other devices. But what happens when you connect them to an AI agent that can not only read sensor data but also reason, alert, and automate actions?
ASI Biont is an AI agent that connects directly to your hardware through a Hardware Bridge or via network protocols. This article shows you how to integrate HC-05/HM-10 modules with ASI Biont, turning a simple Bluetooth temperature sensor into an intelligent automation system.
HM-10 vs HC-05: Quick Comparison
| Feature | HM-10 (BLE) | HC-05 (Classic Bluetooth) |
|---|---|---|
| Protocol | Bluetooth 4.0 BLE | Bluetooth 2.0 SPP |
| Power consumption | Very low | Moderate |
| Range | ~50m | ~10m |
| Compatibility | Modern smartphones, ESP32 | Legacy devices, Arduino |
| Use case | Low-power sensors | String-based command links |
Both modules communicate over UART (serial) with the host microcontroller. The microcontroller becomes the bridge between the physical world and the AI.
How Does ASI Biont Connect to BLE Modules?
ASI Biont cannot talk directly to a BLE module – it needs an intermediary. The common architecture is:
Microcontroller (Arduino/ESP32) + BLE module → USB UART → Computer → Hardware Bridge → ASI Biont (cloud)
Alternatively, if your microcontroller has Wi-Fi (ESP32), you can bypass the USB cable and use MQTT directly from the microcontroller to an MQTT broker, which ASI Biont connects to via execute_python with paho-mqtt.
For this guide, we focus on the Hardware Bridge method – the most universal approach.
Step-by-Step Integration: Arduino + HC-05 + DHT11
Hardware Setup
- Connect HC-05 to Arduino Uno:
- HC-05 VCC → 5V
- HC-05 GND → GND
- HC-05 TX → Arduino pin 2 (SoftwareSerial RX)
- HC-05 RX → Arduino pin 3 (SoftwareSerial TX)
- Connect DHT11 data pin to Arduino pin 4 with a 10kΩ pull-up.
- Power the Arduino via USB to your computer.
Arduino Code (Upload via Arduino IDE)
#include <SoftwareSerial.h>
#include <DHT.h>
SoftwareSerial BTSerial(2, 3); // RX, TX
#define DHTPIN 4
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600); // Serial monitor
BTSerial.begin(9600); // HC-05 default baud
dht.begin();
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) { return; }
// Send sensor data over Bluetooth
BTSerial.print("TEMP:");
BTSerial.print(t);
BTSerial.print(" HUM:");
BTSerial.println(h);
// Check for incoming commands
if (BTSerial.available()) {
String cmd = BTSerial.readStringUntil('\n');
if (cmd == "LED_ON") digitalWrite(LED_BUILTIN, HIGH);
if (cmd == "LED_OFF") digitalWrite(LED_BUILTIN, LOW);
}
delay(5000); // Send every 5 seconds
}
Connect Arduino to Computer via USB
Plug the Arduino into your computer. It appears as a COM port (e.g., COM3 on Windows, /dev/ttyUSB0 on Linux).
Download and Run Hardware Bridge
- Log into the ASI Biont dashboard (asibiont.com).
- Go to Devices → Create API Key. Download
bridge.py. - Install dependencies:
pip install pyserial websockets requests - Run bridge.py with your token and COM port:
bash python bridge.py --token=YOUR_API_KEY --ports=COM3 --baud=9600 --rate=10
The bridge now connects to ASI Biont over WebSocket and listens for commands.
Talk to the AI Agent
Open the chat window on asibiont.com and describe your setup:
"I have an Arduino with HC-05 on COM3 at 9600 baud. The Arduino sends temperature and humidity every 5 seconds in the format
TEMP:24.5 HUM:65.2. I want to monitor the temperature and if it exceeds 30°C, send me a Telegram alert. Also allow me to turn the built-in LED on/off by saying 'turn LED on'."
AI Writes the Integration Code
Inside the chat, ASI Biont uses the industrial_command tool to interact with the device. The AI analyses your request and issues commands like:
# Test connection with HELP protocol
industrial_command(
protocol='serial://',
command='serial_write_and_read',
data='48454c500a' # "HELP\n" in hex
)
If the device responds, the AI proceeds to create a monitoring script. Because the bridge constantly pushes serial data upstream, the AI can use execute_python to parse incoming messages and trigger actions.
# Example: AI-generated monitoring script (runs in sandbox)
import time
import requests
# Simulate reading from bridge (real data comes via WebSocket, but we show logic)
data = "TEMP:24.5 HUM:65.2" # in production, data arrives as events
if "TEMP:" in data:
temp = float(data.split("TEMP:")[1].split()[0])
if temp > 30:
requests.post("https://api.telegram.org/botTOKEN/sendMessage",
json={"chat_id": "YOUR_CHAT", "text": f"Alert! Temperature {temp}°C"})
All commands and logic are handled in the chat – you don't need to code anything manually.
Alternative: ESP32 + HM-10 + MQTT
If your microcontroller has Wi-Fi (ESP32), you can skip the USB cable entirely. Use the ESP32 to read the HM-10 (BLE) sensor data and then publish it to an MQTT broker.
- ESP32 connects to Wi-Fi.
- ESP32 reads HM-10 UART and publishes JSON to topic
sensor/temperature. - ASI Biont uses
execute_pythonwith paho-mqtt:
import paho.mqtt.client as mqtt
def on_message(client, userdata, msg):
payload = msg.payload.decode()
print("Received:", payload)
# AI can then log, alert, or trigger actions
client = mqtt.Client()
client.on_message = on_message
client.connect("broker.emqx.io", 1883, 60)
client.subscribe("sensor/temperature")
client.loop_start()
This script runs in the cloud sandbox (timeout 30 seconds → use a single poll or short loop). For continuous monitoring, AI uses the subscribe method inside execute_python with a callback that updates state.
Why This Matters
- No coding required: You describe your device in natural language, and AI writes the integration code instantly.
- Any hardware works: Whether it's a BLE module, a serial sensor, a PLC, or a REST API – ASI Biont connects through standard protocols.
- Real intelligence: The AI doesn't just pass data; it interprets, reasons, and automates based on your goals.
Conclusion
Integrating HM-10 or HC-05 Bluetooth modules with ASI Biont unlocks a new level of IoT automation. With a simple chat conversation, you can turn a bare Arduino into an intelligent sensor node that alerts you, controls actuators, and logs data – all powered by an AI that understands your context.
Try it yourself: Visit asibiont.com, download the bridge, and tell the AI what you want to connect. No coding – just conversation.
Comments