Files
2nd/10_Wiki/Topics/Domain_Programming/AI_and_ML/IoT-and-AI-Integration.md
T
Antigravity Agent c24165b8bc refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 11:05:56 +09:00

5.3 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-iot-and-ai-integration IoT and AI Integration 10_Wiki/Topics verified self
Edge AI
TinyML
IoT AI
AIoT
none A 0.9 applied
iot
edge-ai
tinyml
embedded
mqtt
sensor-fusion
2026-05-10 pending
language framework
cpp tflite-micro

IoT and AI Integration

매 한 줄

"매 센서 옆에서 즉시 추론". 수 KB-수 MB 모델을 ESP32/Cortex-M/Coral 같은 edge 기기에 올려 latency, privacy, bandwidth 를 동시에 잡는다. 2026 현재 TinyML + MQTT 가 표준.

매 핵심

매 3 layer 아키텍처

  1. Edge (sensor): TinyML 추론, 이상 감지, 게이팅.
  2. Fog (gateway): 다중 센서 통합, heavier 모델, 로컬 의사결정.
  3. Cloud: 학습, fleet 모니터링, OTA 모델 업데이트.

매 모델 압축

  • Quantization: float32 → int8/int4, 4-8x 작아짐.
  • Pruning: weight magnitude 기준 sparsify.
  • Knowledge distillation: large teacher → tiny student.
  • NAS for edge: MCUNet, MobileNet.

매 통신

  • MQTT: pub/sub, QoS 0/1/2.
  • CoAP: REST-over-UDP, 더 가벼움.
  • LoRaWAN: km 단위, 수백 byte/min.
  • BLE: 근거리, 저전력.

매 응용

  1. Predictive maintenance (vibration anomaly).
  2. Vision: door cam person detection, defect inspection.
  3. Voice wakeword (Alexa, "OK Google").
  4. Smart agriculture (soil moisture + weather).
  5. Health wearable (HRV, fall detection).

💻 패턴

TFLite Micro 추론 (ESP32, C++)

#include "tensorflow/lite/micro/micro_interpreter.h"

const tflite::Model* model = tflite::GetModel(g_model_data);
static tflite::MicroMutableOpResolver<5> resolver;
resolver.AddConv2D(); resolver.AddMaxPool2D();
resolver.AddReshape(); resolver.AddFullyConnected(); resolver.AddSoftmax();

constexpr int kArena = 60 * 1024;
uint8_t arena[kArena];
tflite::MicroInterpreter interp(model, resolver, arena, kArena);
interp.AllocateTensors();
TfLiteTensor* in = interp.input(0);
memcpy(in->data.int8, sensor_buf, in->bytes);
interp.Invoke();
int8_t* out = interp.output(0)->data.int8;

Post-training quantization (Python)

import tensorflow as tf

conv = tf.lite.TFLiteConverter.from_saved_model("model")
conv.optimizations = [tf.lite.Optimize.DEFAULT]
conv.target_spec.supported_types = [tf.int8]
conv.representative_dataset = lambda: (
    [x.astype("float32")] for x in calib_samples[:200]
)
open("model_int8.tflite", "wb").write(conv.convert())

MQTT publish 추론 결과 (MicroPython)

from umqtt.simple import MQTTClient

c = MQTTClient("esp32-01", "broker.local")
c.connect()
while True:
    feat = read_imu()
    label = tinyml_infer(feat)
    if label != "normal":
        c.publish(b"factory/line1/anomaly",
                  ujson.dumps({"label": label, "ts": time.time()}))
    time.sleep(0.1)

Sensor fusion (Kalman, complementary)

// 6DOF IMU complementary filter
float alpha = 0.98f;
roll  = alpha * (roll + gyro_x * dt) + (1 - alpha) * accel_roll;
pitch = alpha * (pitch + gyro_y * dt) + (1 - alpha) * accel_pitch;

Edge Impulse SDK (anomaly)

ei_impulse_result_t result;
signal_t signal;
numpy::signal_from_buffer(features, EI_FEATURE_COUNT, &signal);
run_classifier(&signal, &result, false);
if (result.anomaly > 0.5) trigger_alert();

OTA 모델 업데이트

HTTPClient http;
http.begin("https://cdn/model_v3.tflite");
if (http.GET() == 200) {
  File f = SPIFFS.open("/model.tflite", "w");
  http.writeToStream(&f); f.close();
  ESP.restart();
}

Coral Edge TPU (Python)

from pycoral.utils.edgetpu import make_interpreter
from pycoral.adapters import classify

it = make_interpreter("model_edgetpu.tflite")
it.allocate_tensors()
it.set_tensor(it.get_input_details()[0]["index"], img)
it.invoke()
print(classify.get_classes(it, top_k=1))

매 결정 기준

제약 권장
MCU < 1MB RAM TFLite Micro int8, MCUNet
배터리 1년+ LoRaWAN + duty cycle
Vision realtime Coral / Jetson Nano
Privacy critical edge inference, no cloud raw
Fleet 수만+ MQTT broker cluster, OTA

기본값: ESP32 + TFLite Micro int8 + MQTT QoS 1.

🔗 Graph

🤖 LLM 활용

언제: latency 100ms 이하 필요, 네트워크 불안정, privacy 규제, bandwidth 비싼 환경. 언제 X: 모델 100MB+, 잦은 재학습 필요, 입력이 크고 다양한 multimodal.

안티패턴

  • Cloud 의존 edge: 인터넷 끊기면 동작 안 함 → fallback 필수.
  • Float32 모델 그대로 배포: RAM 부족, 발열.
  • OTA 미고려: 모델 버그 fix 불가.
  • Sensor 단일: 노이즈에 취약, fusion 으로 견고화.
  • MQTT QoS 0 + 중요 alert: 패킷 유실 가능.

🧪 검증 / 중복

  • TFLite Micro, Edge Impulse, MQTT 5.0 spec, Coral docs.
  • Warden & Situnayake "TinyML" (O'Reilly).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — 3-layer 구조, TFLite Micro/Edge Impulse/MQTT/OTA 패턴