From BLE Modules to Smart Home AI: Integrating HM-10 & HC-05 with ASI Biont

Introduction

Bluetooth Low Energy (BLE) modules like the HM-10 and classic Bluetooth modules like the HC-05 are the backbone of countless DIY smart home projects. They let microcontrollers communicate wirelessly with phones, but connecting them to an AI agent opens a new dimension: voice‑controlled automation, predictive maintenance, and adaptive environments. ASI Biont AI agent connects to these modules via a COM port using the Hardware Bridge, turning every BLE‑enabled device into a spoke of an intelligent ecosystem.

Why Integrate BLE Modules with an AI Agent?

BLE modules are simple – they expose a serial UART interface (TX/RX). Without an AI agent, controlling them means writing custom firmware or using a phone app. With ASI Biont, you can:

  • Voice‑control relays, lights, and motors using natural language.
  • Automate responses based on sensor data (e.g., turn on a fan when temperature exceeds 30°C).
  • Monitor battery levels, motion, or door status and receive alerts.

The AI agent handles the logic: you describe what you want in a chat, and it generates the integration code instantly.

How ASI Biont Connects to HM-10 / HC-05

ASI Biont does not speak Bluetooth directly (the cloud agent has no radio). Instead, it relies on the Hardware Bridge – a Python script (bridge.py) you run on your local PC. The bridge connects to the cloud via WebSocket and to your BLE module via a serial‑to‑USB adapter (e.g., CP2102, FTDI). The communication flow:

  1. You connect the HM‑10/HC‑05 to your PC via UART‑USB (TX→RX, RX→TX, GND, VCC).
  2. You run bridge.py --token=YOUR_TOKEN --ports=COM3 --baud 9600 (for HC‑05 typical baud 9600, for HM‑10 9600 or 115200).
  3. In the ASI Biont chat, you say: “Connect to COM3 at 9600 baud, send AT and show response”.
  4. The AI sends an industrial_command with serial_write_and_read(data="41540d0a") (hex for AT\r\n).
  5. The bridge writes to the COM port, reads the reply (e.g., OK), and returns it to the AI.

Protocol Details

The bridge uses atomic write+read – it sends data and immediately listens for a response. This is ideal for AT‑style commands used by HM‑10 and HC‑05.

Parameter Typical Value
Port COM3 (Windows) or /dev/ttyUSB0 (Linux)
Baud rate 9600 (HC‑05), 9600/115200 (HM‑10)
Data bits 8
Parity None
Stop bits 1

The AI automatically negotiates the AT command set of your module. For instance, to set HM‑10 as iBeacon, you’d send AT+IBEA1\r\n.

Real‑World Use Case: Voice‑Controlled Smart Light

Setup:
- HM‑10 module connected to an Arduino Nano (or directly to a relay board).
- Relay controls a 220V lamp.
- PC running bridge.py with token A and port COM3.

Step 1 – User request in chat:
“I have an HM‑10 on COM3 at 9600 baud. When I say ‘turn on the light’, send the command ‘ON\n’ to the module. Show me the response.”

Step 2 – AI generates integration:

The AI uses industrial_command with serial_write_and_read:

{
  "protocol": "serial://",
  "command": "write",
  "params": {
    "port": "COM3",
    "baud": 9600,
    "data": "4f4e0a"  // "ON\n" in hex
  }
}

But because the AI can also use escape sequences, it writes simply data="ON\n". The bridge’s _parse_data_field() converts it to bytes.

Step 3 – Automation scenario:
You can then define a rule: “When I type ‘light on’ in the chat, invoke the same command.” The AI remembers the pattern and can be triggered by natural language in future conversations.

Comparison: HM‑10 vs HC‑05 for AI Integration

Feature HM‑10 (BLE 4.0) HC‑05 (Bluetooth 2.0)
Protocol BLE (Bluetooth Low Energy) Classic Bluetooth (SPP)
Power consumption Very low (~10 mA transmitting) Moderate (~40 mA transmitting)
Range Up to 100 m (open) Up to 10 m
AT commands Rich set (iBeacon, Eddystone) Basic (master/slave, baud)
Best for Battery‑powered sensors, beacons Legacy projects, short‑range
Connection via Hardware Bridge Same – both use UART Same

Both work identically from ASI Biont’s perspective: a COM port with AT commands. The AI adapts to the command set of each module.

Beyond Basic Commands: Sensor Data Collection

You can also read sensor data through the BLE module. For example, connect an HC‑05 to an Arduino with a DHT22 temperature sensor. The Arduino sends temperature:25.4 every 5 seconds.

AI script (sandbox via execute_python):

import requests
# Not needed – AI uses industrial_command directly

Actually, the AI does not run a polling loop (sandbox timeout 30 s). Instead, it uses the bridge’s serial_write_and_read to send a request and get the latest data. For continuous monitoring, you can ask the AI to set up an MQTT bridge on the Arduino side, then use the AI’s MQTT subscription to react to sensor values. Example: “If temperature > 30, turn on the relay via BLE.” The AI will write a Python script using paho‑mqtt (via execute_python) that subscribes to the topic and issues the relay command when the threshold is exceeded.

Why This Matters: Zero‑Code Integration

You do not need to write a single line of Python, C, or Arduino code. Just describe your hardware setup in the chat:

“I have HM‑10 on COM4, baud 9600. Send the command ‘AT+NAMEAI_LIGHT’ to rename it.”

The AI understands your intention, finds the correct hex/escape representation, and executes the command. If you want a recurring automation, tell the AI once – it remembers and can be triggered again from any conversation.

Conclusion

Integrating HM‑10, HC‑05, or any BLE/Bluetooth UART module with ASI Biont transforms them from dumb wireless pipes into intelligent building blocks. There is no dashboard to configure; you just talk to the AI and it handles the serial protocol. Start your smart home AI journey today at asibiont.com. Connect your BLE module, tell the AI what to do, and see it happen in seconds.

← All posts

Comments