Technology

Ais Nb IOT คืออะไร

ais nb iot คอ
Ais Nb IOT คืออะไร | SiamCafe Blog
2025-09-16· อ. บอม — SiamCafe.net· 1,649 คำ

AIS NB-IoT คืออะไร

AIS NB-IoT (Narrowband Internet of Things) คือเทคโนโลยีเครือข่ายสำหรับ IoT ที่ AIS ให้บริการในประเทศไทย NB-IoT เป็นมาตรฐาน 3GPP ที่ออกแบบมาเฉพาะสำหรับอุปกรณ์ IoT ที่ต้องการส่งข้อมูลปริมาณน้อย ใช้พลังงานต่ำ และครอบคลุมพื้นที่กว้าง (LPWAN — Low Power Wide Area Network) เหมาะสำหรับ smart city, smart agriculture, smart meter, asset tracking และ environmental monitoring AIS เป็นผู้ให้บริการ NB-IoT รายแรกในไทยที่ครอบคลุมทั่วประเทศ

NB-IoT Technology

# nbiot_basics.py — NB-IoT technology fundamentals
import json

class NBIoTBasics:
    SPECS = {
        "bandwidth": "200 kHz (narrowband)",
        "data_rate": "Up to 250 kbps (DL), 20 kbps (UL typical)",
        "range": "15-20 km (rural), 1-5 km (urban, deep indoor)",
        "battery": "10+ years (ด้วยแบตเตอรี่ AA 2 ก้อน)",
        "latency": "1-10 seconds (ไม่เหมาะ real-time)",
        "standard": "3GPP Release 13+ (LTE-based)",
        "frequency": "Band 8 (900 MHz) ในไทย",
        "devices_per_cell": "50,000-100,000 อุปกรณ์ต่อ cell",
    }

    COMPARISON = {
        "nbiot": {
            "name": "NB-IoT",
            "range": "15+ km",
            "battery": "10+ years",
            "data_rate": "250 kbps",
            "cost": "ต่ำ",
            "use": "Meter reading, sensors, tracking",
        },
        "lora": {
            "name": "LoRa/LoRaWAN",
            "range": "10-15 km",
            "battery": "10+ years",
            "data_rate": "50 kbps",
            "cost": "ต่ำ (ต้องสร้าง gateway เอง)",
            "use": "Agriculture, environment, campus IoT",
        },
        "4g_lte": {
            "name": "4G LTE-M",
            "range": "5-10 km",
            "battery": "5-10 years",
            "data_rate": "1 Mbps",
            "cost": "ปานกลาง",
            "use": "Vehicle tracking, wearables",
        },
        "wifi": {
            "name": "WiFi",
            "range": "50-100m",
            "battery": "ต่ำ (กิน battery)",
            "data_rate": "100+ Mbps",
            "cost": "ต่ำ",
            "use": "Smart home, indoor IoT",
        },
        "5g": {
            "name": "5G mMTC",
            "range": "1-5 km",
            "battery": "ปานกลาง",
            "data_rate": "10+ Gbps",
            "cost": "สูง",
            "use": "Massive IoT, autonomous vehicles",
        },
    }

    def show_specs(self):
        print("=== NB-IoT Specifications ===\n")
        for key, value in self.SPECS.items():
            print(f"  {key}: {value}")

    def show_comparison(self):
        print(f"\n=== IoT Technology Comparison ===")
        for key, tech in self.COMPARISON.items():
            print(f"  [{tech['name']}] Range: {tech['range']} | Battery: {tech['battery']} | Use: {tech['use']}")

nbiot = NBIoTBasics()
nbiot.show_specs()
nbiot.show_comparison()

AIS NB-IoT Services

# ais_services.py — AIS NB-IoT services
import json

class AISNBIoT:
    SERVICES = {
        "sim": {
            "name": "AIS NB-IoT SIM",
            "description": "SIM card เฉพาะสำหรับ NB-IoT ขนาดเล็ก (MFF2)",
            "plans": ["แพ็กเกจ 10 บาท/เดือน (ข้อมูล 1MB)", "แพ็กเกจ 30 บาท/เดือน (ข้อมูล 5MB)", "Enterprise plan (custom)"],
        },
        "platform": {
            "name": "AIS IoT Platform (Magellan)",
            "description": "Cloud platform สำหรับจัดการอุปกรณ์ IoT, dashboard, API",
            "features": ["Device management", "Data visualization", "Rule engine", "API integration"],
        },
        "devkit": {
            "name": "AIS NB-IoT Development Kit",
            "description": "บอร์ด development สำหรับทดลองและ prototype",
            "boards": ["Quectel BC95/BC66 module", "AIS NB-IoT Shield for Arduino", "ESP32 + NB-IoT module"],
        },
        "coverage": {
            "name": "Coverage (พื้นที่ให้บริการ)",
            "description": "ครอบคลุมทั่วประเทศไทย 97%+",
            "band": "Band 8 (900 MHz) — ทะลุอาคารได้ดี",
        },
    }

    USE_CASES = {
        "smart_meter": {
            "name": "Smart Meter (มิเตอร์อัจฉริยะ)",
            "description": "อ่านค่ามิเตอร์ไฟฟ้า/น้ำ/แก๊สอัตโนมัติ ส่งข้อมูลทุก 15-60 นาที",
            "benefit": "ลดคน อ่านมิเตอร์, ตรวจจับการใช้งานผิดปกติ, billing อัตโนมัติ",
        },
        "smart_agriculture": {
            "name": "Smart Agriculture (เกษตรอัจฉริยะ)",
            "description": "วัดความชื้นดิน, อุณหภูมิ, ปริมาณน้ำฝน ส่งข้อมูลทุก 1-6 ชั่วโมง",
            "benefit": "ประหยัดน้ำ 30-50%, เพิ่มผลผลิต, แจ้งเตือนโรคพืช",
        },
        "asset_tracking": {
            "name": "Asset Tracking (ติดตามทรัพย์สิน)",
            "description": "ติดตามตำแหน่ง GPS ของ container, รถขนส่ง, อุปกรณ์",
            "benefit": "ลดการสูญหาย, optimize logistics, geofencing alerts",
        },
        "environment": {
            "name": "Environmental Monitoring (ตรวจวัดสิ่งแวดล้อม)",
            "description": "วัดคุณภาพอากาศ (PM2.5), ระดับน้ำ, สภาพอากาศ",
            "benefit": "Early warning system, ข้อมูล real-time สำหรับวิเคราะห์",
        },
        "smart_parking": {
            "name": "Smart Parking (ที่จอดรถอัจฉริยะ)",
            "description": "sensor ตรวจจับว่ามีรถจอดหรือไม่ ส่งข้อมูลไป app",
            "benefit": "ลดเวลาหาที่จอด, เพิ่มรายได้ค่าจอดรถ",
        },
    }

    def show_services(self):
        print("=== AIS NB-IoT Services ===\n")
        for key, svc in self.SERVICES.items():
            print(f"[{svc['name']}]")
            print(f"  {svc['description']}")
            print()

    def show_use_cases(self):
        print("=== Use Cases ===")
        for key, uc in self.USE_CASES.items():
            print(f"  [{uc['name']}]")
            print(f"    {uc['description']}")
            print()

ais = AISNBIoT()
ais.show_services()
ais.show_use_cases()

การพัฒนา NB-IoT Application

# development.py — NB-IoT application development
import json

class NBIoTDevelopment:
    ARDUINO_CODE = """
// nb_iot_sensor.ino — Arduino NB-IoT sensor example
#include <SoftwareSerial.h>

SoftwareSerial nbiot(10, 11);  // RX, TX to NB-IoT module

void setup() {
  Serial.begin(9600);
  nbiot.begin(9600);
  
  // Initialize NB-IoT module
  sendAT("AT");
  sendAT("AT+CFUN=1");           // Full functionality
  sendAT("AT+CGDCONT=1,\\"IP\\",\\"ais.nb\\"");  // AIS APN
  sendAT("AT+COPS=1,2,\\"52001\\"");  // AIS operator
  
  Serial.println("NB-IoT initialized");
}

void loop() {
  float temperature = readTemperature();
  float humidity = readHumidity();
  
  // Send data via CoAP/UDP
  String payload = String(temperature) + "," + String(humidity);
  sendData(payload);
  
  // Deep sleep 15 minutes (save battery)
  delay(900000);
}

void sendAT(String cmd) {
  nbiot.println(cmd);
  delay(1000);
  while (nbiot.available()) {
    Serial.write(nbiot.read());
  }
}

void sendData(String data) {
  // Create UDP socket
  sendAT("AT+NSOCR=\\"DGRAM\\",17,0,1");
  // Send to server
  String cmd = "AT+NSOST=0,\\"your-server-ip\\",5683," + 
               String(data.length()) + "," + stringToHex(data);
  sendAT(cmd);
}
"""

    PYTHON_SERVER = """
# iot_server.py — Python IoT data receiver
from flask import Flask, request, jsonify
import sqlite3
from datetime import datetime

app = Flask(__name__)

def init_db():
    conn = sqlite3.connect('iot_data.db')
    conn.execute('''
        CREATE TABLE IF NOT EXISTS sensor_data (
            id INTEGER PRIMARY KEY AUTOINCREMENT,
            device_id TEXT NOT NULL,
            temperature REAL,
            humidity REAL,
            battery REAL,
            timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
        )
    ''')
    conn.commit()
    conn.close()

@app.route('/api/data', methods=['POST'])
def receive_data():
    data = request.json
    conn = sqlite3.connect('iot_data.db')
    conn.execute(
        'INSERT INTO sensor_data (device_id, temperature, humidity, battery) VALUES (?, ?, ?, ?)',
        (data['device_id'], data['temperature'], data['humidity'], data.get('battery', 100))
    )
    conn.commit()
    conn.close()
    return jsonify({"status": "ok", "timestamp": datetime.now().isoformat()})

@app.route('/api/data/', methods=['GET'])
def get_data(device_id):
    conn = sqlite3.connect('iot_data.db')
    cursor = conn.execute(
        'SELECT * FROM sensor_data WHERE device_id = ? ORDER BY timestamp DESC LIMIT 100',
        (device_id,)
    )
    rows = [dict(zip(['id', 'device_id', 'temperature', 'humidity', 'battery', 'timestamp'], row))
            for row in cursor.fetchall()]
    conn.close()
    return jsonify(rows)

init_db()
app.run(host='0.0.0.0', port=5000)
"""

    def show_arduino(self):
        print("=== Arduino NB-IoT Code ===")
        print(self.ARDUINO_CODE[:500])

    def show_server(self):
        print(f"\n=== Python IoT Server ===")
        print(self.PYTHON_SERVER[:500])

dev = NBIoTDevelopment()
dev.show_arduino()
dev.show_server()

Dashboard & Analytics

# dashboard.py — IoT dashboard and analytics
import json
import random

class IoTDashboard:
    def sensor_dashboard(self):
        print("=== IoT Sensor Dashboard ===\n")
        devices = [
            {"id": "FARM-001", "type": "Agriculture", "temp": random.uniform(25, 38), "humidity": random.uniform(40, 80), "battery": random.randint(60, 100)},
            {"id": "METER-042", "type": "Smart Meter", "reading": random.uniform(100, 500), "battery": random.randint(70, 100)},
            {"id": "PARK-015", "type": "Parking", "occupied": random.choice([True, False]), "battery": random.randint(80, 100)},
            {"id": "AIR-007", "type": "Air Quality", "pm25": random.uniform(10, 80), "battery": random.randint(50, 95)},
        ]
        for d in devices:
            print(f"  [{d['id']}] {d['type']} | Battery: {d['battery']}%")
            if 'temp' in d:
                print(f"    Temp: {d['temp']:.1f}°C | Humidity: {d['humidity']:.0f}%")
            if 'reading' in d:
                print(f"    Reading: {d['reading']:.1f} kWh")
            if 'pm25' in d:
                level = "Good" if d['pm25'] < 25 else "Moderate" if d['pm25'] < 50 else "Unhealthy"
                print(f"    PM2.5: {d['pm25']:.1f} µg/m³ ({level})")
            print()

    def cost_analysis(self):
        print("=== NB-IoT Cost Analysis ===")
        costs = {
            "SIM card": "ฟรี (AIS จัดให้)",
            "Monthly plan": "10-30 บาท/เดือน/SIM",
            "Hardware (sensor + module)": "500-3,000 บาท/อุปกรณ์",
            "Platform (AIS Magellan)": "ฟรี tier มี / Enterprise custom",
            "Battery (AA × 2)": "~50 บาท (ใช้ได้ 10+ ปี)",
        }
        total_per_device = "~70-200 บาท/เดือน (รวมทุกอย่าง)"
        print(f"  Per device/month:")
        for item, cost in costs.items():
            print(f"    {item}: {cost}")
        print(f"  Total estimate: {total_per_device}")

dash = IoTDashboard()
dash.sensor_dashboard()
dash.cost_analysis()

Best Practices & Tips

# best_practices.py — NB-IoT best practices
import json

class NBIoTBestPractices:
    TIPS = {
        "battery": {
            "name": "Battery Optimization",
            "tips": [
                "ใช้ PSM (Power Saving Mode) — module หลับลึก, ตื่นเมื่อถึงเวลาส่ง",
                "ใช้ eDRX (Extended Discontinuous Reception) — ลด wake-up frequency",
                "ส่งข้อมูลน้อยที่สุดเท่าที่จำเป็น (compact format)",
                "ใช้ CBOR/Protobuf แทน JSON (ลดขนาด payload)",
            ],
        },
        "connectivity": {
            "name": "Connectivity",
            "tips": [
                "ตรวจสอบ signal strength ก่อนติดตั้ง (RSRP > -110 dBm)",
                "ใช้ antenna ภายนอกถ้าติดตั้งในอาคาร/ใต้ดิน",
                "ตั้ง retry mechanism สำหรับ failed transmissions",
                "ใช้ CoAP แทน HTTP (lightweight protocol สำหรับ IoT)",
            ],
        },
        "security": {
            "name": "Security",
            "tips": [
                "ใช้ DTLS encryption สำหรับ data in transit",
                "ไม่ hardcode credentials ในอุปกรณ์",
                "ใช้ device provisioning อัตโนมัติ",
                "Update firmware OTA (Over-The-Air) เมื่อมี security patch",
            ],
        },
        "data": {
            "name": "Data Management",
            "tips": [
                "ส่งข้อมูลเฉพาะที่เปลี่ยนแปลง (delta encoding)",
                "Batch ข้อมูลหลายตัวในการส่งครั้งเดียว",
                "ใช้ timestamps ที่อุปกรณ์ (ไม่ใช่ server time เท่านั้น)",
                "วาง buffer ที่อุปกรณ์สำหรับ offline storage",
            ],
        },
    }

    def show_tips(self):
        print("=== NB-IoT Best Practices ===\n")
        for key, category in self.TIPS.items():
            print(f"[{category['name']}]")
            for tip in category["tips"][:3]:
                print(f"  • {tip}")
            print()

bp = NBIoTBestPractices()
bp.show_tips()

FAQ - คำถามที่พบบ่อย

Q: NB-IoT กับ LoRa อันไหนดี?

A: NB-IoT (AIS): ครอบคลุมทั่วประเทศ ไม่ต้องสร้าง gateway เอง จ่าย monthly SIM LoRa: ต้องสร้าง gateway เอง (ค่า gateway 5,000-20,000 บาท) แต่ไม่มีค่า monthly ใช้ NB-IoT: deploy ทั่วประเทศ, ไม่มี infrastructure เอง, ต้องการ licensed spectrum ใช้ LoRa: campus/farm ขนาดใหญ่, ต้องการควบคุม network เอง, ไม่มี cellular coverage

Q: AIS NB-IoT ค่าใช้จ่ายเท่าไหร่?

A: SIM card: ฟรี (สั่งผ่าน AIS Business) แพ็กเกจ: เริ่ม 10 บาท/เดือน (1MB data) Hardware: 500-3,000 บาท/อุปกรณ์ (ขึ้นกับ sensor) Platform: AIS Magellan มี free tier Enterprise: ติดต่อ AIS Business สำหรับราคาพิเศษ

Q: NB-IoT ส่งข้อมูลได้เร็วแค่ไหน?

A: Data rate: สูงสุด ~250 kbps (ใช้จริงประมาณ 20-60 kbps) Latency: 1-10 วินาที (ไม่เหมาะ real-time) Payload: แนะนำ < 512 bytes ต่อครั้ง เหมาะสำหรับ: ส่งค่า sensor ทุก 15 นาที - 6 ชั่วโมง ไม่เหมาะ: video streaming, voice, real-time control

Q: เริ่มพัฒนา NB-IoT อย่างไร?

A: 1. สั่ง AIS NB-IoT SIM + Dev Kit (ais.th/business/iot) 2. เลือก module: Quectel BC66/BC95 หรือ AIS shield 3. เชื่อมต่อ sensor (temperature, humidity, GPS, etc.) 4. เขียน firmware ส่งข้อมูลไป server/platform 5. สร้าง dashboard บน AIS Magellan หรือ custom server Documentation: ais.th/business/iot/nbiot

📖 บทความที่เกี่ยวข้อง

nb-iot ais คืออ่านบทความ → A/B Testing ML IoT Gatewayอ่านบทความ → Monte Carlo Observability IoT Gatewayอ่านบทความ → Netlify Edge IoT Gatewayอ่านบทความ → Neon Serverless Postgres IoT Gatewayอ่านบทความ →

📚 ดูบทความทั้งหมด →