ESP32 Mini Gateway
Trung cấp10/5/2026

ESP32 Mini Gateway

Xây dựng IoT Gateway với ESP32: nhận dữ liệu từ cảm biến GPIO, BLE node, hoặc nRF24L01 node rồi gửi lên MQTT broker.

ESP32MQTTBLEnRF24L01GatewayIoTArduino
0 lượt thích0 người đã làm2 giờ5 bước7 linh kiện
← Quay lại dự án
Hướng dẫn chi tiết

Bài 5: Xem dữ liệu trên MQTT Dashboard

Kết nối MQTTX tới mqtt.iotlabs.vn, subscribe các topic của gateway và xem dữ liệu realtime. Tùy chọn: Mosquitto local, Node-RED.

Cập nhật 10/05/2026

Công cụ: MQTTX

MQTTX là MQTT client miễn phí, tải tại mqttx.app.

Bước 1 — Tạo kết nối trong MQTTX

  1. Nhấn + New Connection
  2. Điền thông tin:
Name:     IoTLabs Gateway
Host:     mqtt.iotlabs.vn
Port:     1883
Username: [tài khoản IoTLabs]
Password: [mật khẩu IoTLabs]
  1. Nhấn Connect — thanh trạng thái xanh = kết nối thành công

Bước 2 — Subscribe nhận dữ liệu

Nhấn + Add Subscription, điền topic:

iotlabs/org_demo/gateways/gw_edu_001/#

Ký tự # nhận tất cả topic con của gateway.

Topics cụ thể

Dữ liệuTopic
Door sensoriotlabs/org_demo/gateways/gw_edu_001/devices/door_sensor_01/telemetry
BLE node n01iotlabs/org_demo/gateways/gw_edu_001/devices/n01/telemetry
NRF nodeiotlabs/org_demo/gateways/gw_edu_001/devices/nrf_soil_01/telemetry
Gateway statusiotlabs/org_demo/gateways/gw_edu_001/status

Mosquitto CLI (tùy chọn)

# Subscribe
mosquitto_sub -h mqtt.iotlabs.vn -u YOUR_USER -P YOUR_PASS \
  -t "iotlabs/org_demo/gateways/gw_edu_001/#" -v

# Test publish
mosquitto_pub -h mqtt.iotlabs.vn -u YOUR_USER -P YOUR_PASS \
  -t "iotlabs/org_demo/gateways/gw_edu_001/devices/test/telemetry" \
  -m '{"mode":"gpio","metrics":{"door_open":true}}'

Mosquitto Local (tự cài)

# macOS
brew install mosquitto && brew services start mosquitto

# Ubuntu
sudo apt install mosquitto mosquitto-clients
sudo systemctl start mosquitto

Sau đó trong config.h đổi: #define MQTT_HOST "192.168.1.100" (IP máy local).

Node-RED Dashboard (nâng cao)

  1. npm install -g node-rednode-red
  2. Mở http://localhost:1880
  3. Kéo node mqtt in → cấu hình host mqtt.iotlabs.vn + topic
  4. Kéo node jsondebug → nhấn Deploy