ESP32 BLE Advertisement Data Wrong
In this tutorial, you'll learn about ESP32 BLE Advertisement Data Wrong. We cover key concepts, practical examples, and best practices.
The Problem
ESP32 BLE advertisement data is malformed, truncated, or does not include the intended service UUID.
Quick Fix
Wrong
BLEAdvertising* pAdv = BLEDevice::getAdvertising();
pAdv->start();
// No service UUID set, no device name in advertisement
Device appears as "Unknown" with no services listed in scanner.
Right
BLEAdvertising* pAdv = BLEDevice::getAdvertising();
pAdv->addServiceUUID("4fafc201-1fb5-459e-8fcc-c5c9c331914b");
pAdv->setScanResponse(true);
pAdv->setMinPreferred(0x06);
pAdv->setMaxPreferred(0x12);
pAdv->setAdvertisementType(ADV_TYPE_IND);
pAdv->start();
Device found: "ESP32-BLE" with service 4fafc201-1fb5-459e-8fcc-c5c9c331914b
Prevention
Always add service UUIDs to the advertisement. Set advertisement type to ADV_TYPE_IND for general discoverability. Use manufacturer-specific data for custom payloads. Keep advertisement data under 31 bytes (BLE limit). Enable scan response for additional data.
DodaTech engineers apply these same patterns when building Doda Browser's networking stack, DodaZIP's firmware packaging pipeline, and Durga Antivirus Pro's sensor communication layer.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro