Introduction
CNC machines – from desktop engravers running GRBL to 3D printers on Marlin – have long relied on manual G-code entry or pre-scripted jobs. But what if you could simply tell an AI agent to "mill a pocket at coordinates X10 Y20 Z-1" and have it send the exact G-code, verify the response, and even adjust feeds on the fly? That’s exactly what ASI Biont does by integrating with CNC controllers over a COM port (RS-232) using the Hardware Bridge.
In this guide, you’ll learn how ASI Biont connects to any GRBL- or Marlin-based machine, walk through a real-world use case with code, and see why this approach eliminates manual coding and accelerates your CNC workflows.
How ASI Biont Connects to GRBL / Marlin CNC
ASI Biont does not require custom firmware or a special dashboard. Instead, it uses the Hardware Bridge – a lightweight bridge.py script that you run on your PC or Raspberry Pi. The bridge opens a WebSocket connection to the ASI Biont cloud and exposes local COM ports over that secure channel.
| Component | Role |
|---|---|
| CNC Controller (Arduino + GRBL / Marlin) | Listens on a serial COM port (e.g., COM3) at 115200 baud |
Hardware Bridge (bridge.py) |
Runs on your local machine, connects to ASI Biont via WebSocket |
| ASI Biont AI Agent | Sends commands via industrial_command tool → bridge → COM port |
| You | Describe the task in natural language in the chat |
The bridge supports atomic serial_write_and_read – the AI sends a hex-encoded string (e.g., "4730300d0a" for "G00\r\n"), and the bridge immediately reads the device response. On Windows, it handles overlapped I/O issues with CancelIoEx and PurgeComm to guarantee reliability.
Step-by-Step Integration: A Real-World Use Case
Scenario: You have a GRBL-based CNC engraver connected to COM3 at 115200 baud. You want to remotely send a positioning command and confirm the machine’s status.
1. Download and Run the Bridge
From the ASI Biont dashboard (Devices → Create API Key → Download bridge), you get bridge.py. Install dependencies:
pip install pyserial requests websockets
Then run:
python bridge.py --token=YOUR_API_KEY --ports=COM3 --baud 115200
2. Describe the Task in Chat
Type into the ASI Biont chat:
"Connect to my CNC on COM3 at 115200 baud. Send G00 X10 Y10 Z0 and wait for the 'ok' response."
3. AI Generates and Executes the Command
ASI Biont’s agent interprets your request and calls the industrial_command tool:
# This is what the AI constructs internally (not visible to you):
industrial_command(
protocol='serial://',
command='serial_write_and_read',
data='4730302058313020593130205a300d0a', # hex for "G00 X10 Y10 Z0\r\n"
port='COM3',
baud=115200
)
The bridge sends the bytes to the CNC, reads back "ok\r\n" (or an error), and returns the result to the AI. The AI then informs you: "Command sent successfully. CNC responded with 'ok'. Machine is now at X10 Y10 Z0."
4. Advanced Automation (Reading Status)
You can ask the AI to continuously monitor the machine. For example:
"Ask the CNC for its current position every 10 seconds and alert me if it exceeds X=100."
The AI will create a loop (using execute_python with a timeout) that sends "?" (GRBL status request) and parses the <Idle|MPos:...> response. If limits are breached, it sends you a Telegram alert via the sendgrid integration.
Why This Changes CNC Workflows
- No Manual G-code Entry: Just describe what you want to happen – the AI translates it to the correct G-code.
- Real-time Remote Control: Control your CNC from anywhere, as long as the bridge is running.
- Automatic Error Handling: The AI parses responses and can retry or adjust commands if the machine reports an error.
- Zero Platform Lock-in: Because ASI Biont connects via
execute_python(a sandboxed Python environment), you can write integration code for any device not yet listed. The AI writes the pyserial, paramiko, or MQTT script itself. You just describe the device and parameters.
Important: ASI Biont does not require you to wait for new drivers or hardware templates. The AI agent generates the Python code on the fly using libraries like
pyserial,pymodbus,paramiko,paho-mqtt, oraiohttp. You simply say "Connect to my CNC on COM3 at 115200 baud and send G00 X0 Y0 Z0" – and it works.
Conclusion
Integrating a GRBL or Marlin CNC with AI removes the friction of manual G-code programming. With ASI Biont’s Hardware Bridge and the AI agent’s ability to generate and run code in real time, you can automate machining tasks, monitor status from your phone, and even orchestrate multi-step workflows – all through a natural language chat.
Ready to give your CNC a brain?
Start your free trial at asibiont.com – download the bridge, point it to your COM port, and tell the AI what to do. No coding required.
Comments