ASI Biont LoRaWAN: How to Read Field Sensors Over a COM Port Without a Cloud Gateway

You have a LoRa sensor in a field, a warehouse or a basement. It sends a packet once an hour to someone else's cloud, and to find out what's actually inside that packet you need a programmer, a subscription and a dashboard you don't control. Meanwhile the modem is lying next to you on the desk, plugged into USB, blinking.

The good news: ASI Biont LoRaWAN integration doesn't require a cloud gateway at all. The modem speaks AT commands over a serial port, and an AI agent can drive that port directly — parse the responses, decode the payload, and turn raw bytes into an alert, a table row, or a Telegram message. Below is how that path works, where it bites, and what it looks like in code.

From radio packet to Telegram alert — four steps, no cloud gateway
1
Sensor uplink
LoRa packet, 4 bytes, every 15 min
2
Modem over USB/COM
AT commands, +RECV: hex line
3
ASI Biont agent
parses AT chatter, decodes payload
4
Alert / log
Telegram message or timestamped row

What actually arrives on the COM port from a LoRa modem?

A LoRaWAN modem (the common modules from Semtech-based vendors, RAK, Murata, Microchip and their clones) exposes a serial interface at 115200 baud, 8N1, by default on most modules — check the datasheet, some ship at 9600. Over that port you get two kinds of traffic:

  • AT command responses. You send AT+JOIN, AT+SEND, AT+RECV (the exact command set depends on the module's firmware — RAK's RUI and Microchip's LoRaWAN stack use different verbs), and get back +EVT: lines, ok, or error codes.
  • Unsolicited uplinks. When a packet arrives from a sensor, the modem pushes it out as a line like +EVT:RXP2P:... or +RECV:... depending on firmware, often as hex or base64.

That hex blob is the whole problem. A typical temperature/humidity sensor sends something like 01 67 02 8A — four bytes that mean nothing until you know the payload format. And the payload format is not standardised by LoRaWAN. The LoRa Alliance defines the radio and MAC layer; what goes inside the application payload is up to whoever built the sensor. Some vendors follow the Cayenne Low Power Payload (LPP) format, which is documented and self-describing; many don't and just pack fields by hand.

The real bottleneck isn't the radio The hard part of LoRa integration is never the 5–10 km link. It's that the payload decoder lives in the vendor's cloud, and without it the bytes on your COM port are opaque.

So the integration job splits into three layers: talk to the modem over serial, parse the AT chatter, decode the payload. An AI agent that can write and run Python handles all three in one conversation.

Why USB/COM and not MQTT or the vendor cloud?

Because the cloud path costs you control. If the sensor's uplinks go to a vendor's network server, you get their retention policy, their API rate limits, and their downtime. You also inherit a dependency: if the vendor changes their decoder or sunsets the product line, your telemetry stops.

The COM port path is boring and durable: the modem is a serial device, the serial device is local, and the data never leaves your machine unless you send it somewhere. No gateway subscription, no cloud round-trip for the last metre.

There's a trade-off, and it's worth naming. A local COM-port setup means the machine with the modem must be running when you want data. A cloud gateway buffers uplinks for you. If your scenario is "alert me within a minute of a leak," local is fine and cheaper. If it's "archive three years of readings for analysis," you'll want to persist them yourself — the modem won't do it for you.

Path Who owns the decoder Latency to your alert Ongoing cost
Vendor cloud + API Vendor Cloud round-trip + polling Subscription, often per device
Local LoRaWAN gateway + network server You (self-hosted) Seconds, but you run the server Server hosting
Modem → USB/COM → ASI Biont You, in code Poll interval you set None beyond hardware

How does ASI Biont connect to a serial LoRa modem?

The platform reaches serial hardware through the Hardware Bridge — a small bridge.py you download from the ASI Biont dashboard (not from GitHub; there's no public repo to grab it from). The bridge runs on your machine, owns the COM port, and exposes it to the agent.

Launch looks like this:

python bridge.py --token=YOUR_TOKEN --ports=COM3 --baud 115200 --rate=10
  • --ports=COM3 — on Linux/macOS this is /dev/ttyUSB0 or /dev/ttyACM0.
  • --baud 115200 — must match the modem's configured rate.
  • --rate=10 — polling rate in Hz for the bridge loop.

Once the bridge is up, the agent talks to the port through industrial_command(). The bridge has no HTTP API — that's the function you use, not a REST endpoint.

And here's the part that matters for anything the bridge doesn't natively speak: ASI Biont connects to any device via execute_python. The AI writes the integration code itself, using pyserial for the port, paramiko for SSH, paho-mqtt, pymodbus, aiohttp, opcua-asyncio — whichever the device needs. You don't wait for a vendor to add support. You describe the device, the port and the parameters in chat, and the code appears.

Before you write a single line Open the port in a plain terminal first (PuTTY, `screen`, `minicom`) and send one AT command. If you can't get an `ok` back there, no amount of Python will help — it's a baud rate, wiring or driver problem.

What does the code look like for a leak alert?

Let's take a concrete, hypothetical setup: a water-leak sensor in a basement sends a 4-byte uplink every 15 minutes. Byte 0 is a message type, bytes 1–2 are a 16-bit value, byte 3 is a status flag. You want an alert when the flag says "wet."

First, reading the modem through the bridge:

# execute_python — runs in the ASI Biont sandbox, 30s limit
resp = industrial_command(
    protocol='serial',
    command='AT+RECV',
    port='COM3',
    baudrate=115200,
    timeout=2
)
print(resp)
# expected: '+RECV: 01 67 02 8A' or an empty response if no packet

Then the decoder. Note the while True is forbidden — the sandbox kills the script at 30 seconds, so you read one packet per call and let the agent's scheduling loop handle repetition:

import re

def decode_leak_payload(hex_str):
    raw = bytes.fromhex(hex_str.replace(' ', ''))
    if len(raw) < 4:
        return None
    msg_type = raw[0]
    value = (raw[1] << 8) | raw[2]   # 16-bit big-endian, per sensor doc
    status = raw[3]
    return {
        'type': msg_type,
        'value': value,
        'wet': bool(status & 0x01),
        'battery_low': bool(status & 0x02),
    }

resp = industrial_command(
    protocol='serial', command='AT+RECV',
    port='COM3', baudrate=115200, timeout=2
)
match = re.search(r'\+RECV:\s*([0-9A-Fa-f ]+)', resp)
if match:
    packet = decode_leak_payload(match.group(1))
    if packet and packet['wet']:
        import requests
        requests.post(
            'https://api.telegram.org/bot<TOKEN>/sendMessage',
            json={'chat_id': '<CHAT_ID>',
                  'text': f"Leak detected, value={packet['value']}"}
        )

Two things to notice. First, the byte order is a guess until you check the sensor's datasheet — big-endian vs little-endian is the single most common decoder bug, and it produces plausible-looking wrong numbers rather than an obvious crash. Second, the Telegram send uses a plain requests.post to api.telegram.org; there is no built-in send_telegram() helper to call.

For a temperature sensor following Cayenne LPP, you don't hand-roll the decoder — LPP is documented, with a type byte and a scaled value (temperature type 103, value in 0.1 °C units). A 3-byte LPP temperature record like 67 01 0F means 103, then 0x010F = 271, so 27.1 °C. If your sensor speaks LPP, say so in chat and the agent will write the LPP parser instead of guessing.

How do you actually get this running — in chat?

No "add device" button, no control panel. The flow is a conversation:

  1. Describe the hardware. "I have a RAK LoRaWAN module on COM3 at 115200. It reports uplinks as +EVT:RXP2P: lines with hex payloads. The sensor is a leak detector, 4 bytes: type, 16-bit value big-endian, status flags in byte 3."
  2. Say what you want. "Alert me on Telegram when the wet flag is set, and log every reading with a timestamp."
  3. Let the agent write and run it. It generates the industrial_command call, the parser, the alert. If the payload layout is wrong, you paste a real +RECV: line and it corrects the decoder.

That third step is where the time goes. The traditional version of this task is: read the modem's AT command reference (often a 60-page PDF), write a serial reader, discover the line endings are \r\n and not \n, fix the regex, discover the payload is little-endian, fix the decoder, then wire up alerting. The agent compresses that into a few iterations of "here's the real output, fix it."

What the agent is genuinely good at here It's not the radio physics — it's the tedium. Regex over AT chatter, hex decoding, retry logic, and reformatting a payload into an alert are exactly the kind of glue code that eats an afternoon and that an agent writes in seconds.

Where does this actually pay off, and where does it break?

Payoff: range without infrastructure. LoRa's selling point is 5–10 km line-of-sight in rural conditions (significantly less through walls and in dense urban clutter — the range claim is a best case, not a guarantee). If you have sensors scattered across a site with no Wi-Fi and no wired network, a modem plus a local machine is a complete telemetry path with no per-device cloud fee.

Payoff: multiple sensors, one decoder layer. A warehouse with ten temperature sensors across cold rooms is a classic case: each sensor's payload is decoded by the same function, the agent polls the modem, and you get a table of room temperatures plus an alert when one drifts. The integration work is written once.

Where it breaks:

  • Duty cycle. LoRaWAN in the EU is bound by the ETSI EN 300 220 duty-cycle limits (typically 1% on many sub-bands), so you cannot poll a sensor "every second" — the sensor decides when it transmits. Your COM-port reader is a receiver, not a controller. Plan around the sensor's uplink interval.
  • Line endings and framing. Some modems terminate lines with \r\n, some with \n, and some interleave unsolicited +EVT: lines with command echoes. A regex that assumes a clean single line will silently miss packets.
  • Payload drift. If the sensor firmware is updated and the payload layout changes, your decoder returns garbage that looks like data. Version your decoder against the sensor's documented format.
  • One port, one owner. Only one process can hold COM3 at a time. If PuTTY is still open, the bridge can't read.

If your modem sits behind a BLE-to-UART bridge instead of a direct USB cable, the same class of problems shows up in a different shape — framing, AT parsing and silent failures are the recurring theme.

More on the topic: “HM-10 and HC-05 with ASI Biont: Why Bluetooth UART Integration Silently Fails (and How to Wire It Right)”

The bottom line

A LoRa sensor doesn't need a cloud gateway to be useful — it needs something to read the bytes and make sense of them. The modem already hands you those bytes over a serial port; the missing piece was always the decoder and the glue, and that's the part an AI agent writes for you in a chat window.

If you have a modem, a sensor and a USB cable, describe them to the agent on asibiont.com and watch it build the reader, the decoder and the alert before your coffee goes cold.

← All posts

Ask AI about this article

Ask a question about this article — ASI Biont will answer based on its text.