Introduction
Smart city sensors—air quality monitors, noise meters, traffic counters—are the nervous system of modern urban infrastructure. But raw sensor data is useless without intelligent processing. ASI Biont, an AI agent that connects to any device through chat, bridges the gap between IoT hardware and actionable insights. In this article, we walk through real-world integrations of Smart City sensors with ASI Biont using MQTT, COM ports, and SSH, showing how cities and enterprises automate environmental monitoring without writing a single line of boilerplate code.
Why Connect Smart City Sensors to an AI Agent?
Traditional IoT setups require dedicated dashboards, custom scripts, and constant maintenance. ASI Biont eliminates that. You describe the sensor and your goal in plain English—the AI writes the integration code on the fly. Whether you need to alert the administration when PM2.5 exceeds 50 µg/m³ or log noise levels every minute, the AI handles connection, parsing, and logic. The result: faster deployment, lower costs, and real-time responsiveness.
Connection Methods Supported by ASI Biont
| Protocol | Use Case | Example Device |
|---|---|---|
| MQTT | Wireless sensor networks | ESP32 + DHT22 / PMS5003 |
| COM port (via Hardware Bridge) | Wired sensors on a PC | Arduino with gas sensor |
| SSH | Linux-based gateways | Raspberry Pi with camera |
| HTTP API | Cloud-connected sensors | Airthings Wave Plus |
ASI Biont does not require a dashboard or 'add device' button. You simply chat with the AI: "Connect to my MQTT broker at 192.168.1.100:1883, subscribe to 'city/air/quality', and alert me when PM2.5 > 50." The AI generates the Python code using paho-mqtt and runs it in a sandbox.
Use Case 1: Air Quality Monitoring with MQTT
Problem: A city needs to monitor PM2.5, PM10, and CO2 from 20 ESP32-based stations and notify the environmental department when thresholds are exceeded.
Solution: Each ESP32 publishes sensor data via MQTT to a Mosquitto broker. ASI Biont subscribes to the topic and runs analysis.
Step-by-step:
1. Deploy ESP32 with PMS5003 sensor, publishing JSON: {"pm25": 45, "pm10": 70} to topic city/air/quality.
2. In ASI Biont chat, type: "Connect to MQTT broker at broker.city.org:1883, subscribe to city/air/quality, log all data to CSV, and send a Telegram message to @admin if pm25 > 50."
3. AI generates and executes the following Python script in execute_python:
import paho.mqtt.client as mqtt
import json
from datetime import datetime
import csv
def on_message(client, userdata, msg):
data = json.loads(msg.payload)
pm25 = data.get('pm25', 0)
timestamp = datetime.now().isoformat()
# Log to CSV
with open('/tmp/air_quality.csv', 'a', newline='') as f:
writer = csv.writer(f)
writer.writerow([timestamp, pm25, data.get('pm10', 0)])
# Alert if threshold exceeded
if pm25 > 50:
# Hypothetical Telegram integration via requests
print(f"ALERT: PM2.5 = {pm25} at {timestamp}")
client = mqtt.Client()
client.on_message = on_message
client.connect("broker.city.org", 1883, 60)
client.subscribe("city/air/quality")
client.loop_start()
# Sandbox keeps running for 30 seconds; in production, use a persistent server
Results: The city receives instant alerts, and historical data is stored for analytics. No manual coding—AI configured the MQTT client, JSON parsing, CSV logging, and threshold logic in seconds.
Use Case 2: Noise Pollution Monitoring via COM Port
Problem: A university lab uses an Arduino with a sound level meter (I2S microphone) connected to a Windows PC. They want to log noise levels and trigger a red LED when noise exceeds 85 dB.
Solution: ASI Biont connects to the Arduino through the Hardware Bridge (bridge.py) on the PC.
Step-by-step:
1. Run bridge.py on the PC: python bridge.py --token=YOUR_TOKEN --ports=COM3 --baud 115200
2. In ASI Biont chat: "Connect to Arduino on COM3, baud 115200. Read noise level every 5 seconds. If noise > 85, send command 'RED_ON' to turn on LED. Log all readings."
3. AI uses industrial_command with protocol serial:// to send and receive data:
- serial_write_and_read(data="READ_NOISE\n") returns the noise value
- If value > 85, AI sends serial_write_and_read(data="RED_ON\n")
4. The Arduino firmware responds to commands:
- READ_NOISE → returns NOISE:78
- RED_ON → sets digital pin 13 HIGH
# AI-generated logic (simplified)
import time
for _ in range(6): # 30 seconds sandbox limit
response = industrial_command(
protocol="serial://",
command="serial_write_and_read",
data="READ_NOISE\n"
)
noise = int(response.split(':')[1])
print(f"Noise: {noise} dB")
if noise > 85:
industrial_command(
protocol="serial://",
command="serial_write_and_read",
data="RED_ON\n"
)
time.sleep(5)
Results: Real-time noise monitoring with automated alerting. The AI handled COM port configuration, hex conversion, and command sequencing.
Use Case 3: Traffic Density Analysis with SSH + Camera
Problem: A smart city pilot uses a Raspberry Pi 4 with a USB camera at an intersection. They need to count vehicles and send hourly reports.
Solution: ASI Biont connects via SSH to the Pi, runs a Python script using OpenCV (installed on the Pi) for vehicle detection, and returns counts.
Step-by-step:
1. In ASI Biont chat: "SSH to 192.168.1.50 user pi, run a script that captures an image, detects cars with OpenCV, and returns the count. Do this every hour."
2. AI generates a paramiko script:
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect("192.168.1.50", username="pi", password="raspberry")
# Transfer and run detection script
sftp = ssh.open_sftp()
sftp.put("detect_cars.py", "/home/pi/detect_cars.py")
sftp.close()
stdin, stdout, stderr = ssh.exec_command("python3 /home/pi/detect_cars.py")
car_count = stdout.read().decode().strip()
print(f"Vehicles detected: {car_count}")
ssh.close()
Results: Hourly traffic counts without manual intervention. The AI wrote the SSH connection, file transfer, and execution code.
Why ASI Biont Beats Traditional IoT Platforms
- Zero coding: Describe your setup in natural language. The AI writes the integration code using pyserial, paho-mqtt, paramiko, or any of the 14 supported protocols.
- Universal connectivity: From COM ports to MQTT to Modbus—one AI agent handles them all.
- Real-time intelligence: The AI can analyze data, trigger actions (Telegram alerts, LED control, database logging), and adapt logic based on your requests.
- No vendor lock-in: You own the hardware and the broker. ASI Biont is a flexible interface, not a closed ecosystem.
Conclusion
Smart City sensors are only as valuable as the decisions they enable. With ASI Biont, you connect any sensor—air quality, noise, traffic—in minutes through a simple chat conversation. The AI handles MQTT subscriptions, COM port communication, SSH scripts, and data analysis. No dashboards, no 'add device' buttons, no waiting for developers.
Ready to transform your city monitoring? Start your first integration at asibiont.com today.
Comments