📶
Bluetooth คืออะไร?
มาตรฐานการสื่อสารไร้สายระยะใกล้ ที่ใช้คลื่นวิทยุ 2.4 GHz ไม่ต้องการ WiFi หรืออินเทอร์เน็ต
📶 Bluetooth เชื่อมต่ออะไรได้บ้าง?
🤝 ขั้นตอน Pairing (จับคู่)
📡 Bluetooth Classic
- ใช้สำหรับส่งข้อมูลปริมาณมาก
- เสียง (A2DP) / ไฟล์ (OBEX)
- ความเร็ว: ~3 Mbps
- กินแบตเตอรีมากกว่า BLE
- ระยะ: ~10-100 เมตร
ตัวอย่างการใช้งาน:
หูฟัง, ลำโพง, รับสาย, ไฟล์ transfer, คีย์บอร์ด, เมาส์
⚡ BLE (Bluetooth Low Energy)
- ออกแบบมาเพื่อประหยัดพลังงาน
- ส่งข้อมูลเล็กน้อยเป็นระยะๆ
- แบตอาจอยู่ได้หลายเดือนหรือปี
- เหมาะกับ IoT อย่างมาก
- ระยะ: ~50-150 เมตร (BT 5.0)
ตัวอย่างการใช้งาน:
Smart Watch, Fitness Tracker, เซ็นเซอร์ IoT, Beacon, Smart Lock
📜 เวอร์ชั่นของ Bluetooth
| เวอร์ชั่น | ปี | ความเร็ว | ระยะ | คุณสมบัติเด่น |
|---|---|---|---|---|
| BT 1.0-2.0 | 1999-2004 | 1-3 Mbps | ~10m | เริ่มต้น, EDR |
| BT 3.0 | 2009 | 24 Mbps | ~10m | ส่งไฟล์เร็วขึ้น |
| BT 4.0 + BLE | 2010 | 25 Mbps | ~50m | BLE ประหยัดพลังงาน |
| BT 4.2 | 2014 | 25 Mbps | ~50m | IPv6, IoT-ready |
| BT 5.0 | 2016 | 50 Mbps | ~240m | ⭐ ระยะไกล 4x, BLE ดีขึ้น |
| BT 5.3 | 2021 | 50 Mbps | ~240m | 🆕 ล่าสุด, ปรับปรุง BLE |
📋 Bluetooth Profiles
Profile = โปรโตคอลเฉพาะสำหรับการใช้งานแต่ละประเภท
🎵A2DP
Advanced Audio Distribution
ส่งเสียงคุณภาพสูง เช่น หูฟัง ลำโพง
📞HFP
Hands-Free Profile
รับสาย โทรออกผ่าน headset
⌨️HID
Human Interface Device
คีย์บอร์ด เมาส์ gamepad
📊GATT
Generic Attribute Profile
BLE: แลกเปลี่ยนข้อมูลขนาดเล็ก (IoT)
📁OBEX
Object Exchange
ส่งไฟล์ / vCard ระหว่างอุปกรณ์
🔌SPP
Serial Port Profile
จำลอง Serial port ใช้กับ Arduino/ESP
🔌 Bluetooth กับ ESP32 ใน IoT
// ESP32 BLE Server - วัดอุณหภูมิส่งผ่าน BLE
#include <BLEDevice.h>
#include <BLEServer.h>
BLECharacteristic *pCharacteristic;
void setup() {
BLEDevice::init("ESP32-TempSensor");
BLEServer *pServer = BLEDevice::createServer();
BLEService *pService = pServer->createService(SERVICE_UUID);
pCharacteristic = pService->createCharacteristic(
CHAR_UUID, BLECharacteristic::PROPERTY_READ | PROPERTY_NOTIFY
);
pService->start();
BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
pAdvertising->start();
}
void loop() {
float temp = readTemperature();
pCharacteristic->setValue(String(temp).c_str());
pCharacteristic->notify(); // ส่งข้อมูลไปแอปมือถือ
delay(1000);
}ต้องการพัฒนาระบบ Bluetooth / BLE? 📶
เราพัฒนา BLE app เชื่อมต่ออุปกรณ์ IoT บน iOS และ Android
← กลับหน้าเรียนติดต่อเรา