ESP32 BLE Notifications: Master Complete Beginner Friendly Guide

0b63979cd9494aa401d1fce2d73bb002
On: November 24, 2025
ESP32 BLE Notifications

Build an ESP32 BLE server easily with this beginner-friendly guide. Learn setup, examples, troubleshooting, and pro tips to create fast, stable BLE communication.

When you first start with Bluetooth Low Energy on the ESP32, one feature immediately stands out: BLE notifications. They’re fast, lightweight, don’t need constant polling, and make your ESP32 react in real time whether you’re sending sensor data to a smartphone or receiving commands from a BLE device.

But here’s the tricky part: BLE can feel confusing when you’re just starting out. Terms like characteristic, client, server, notify, and callbacks can turn anyone’s head into spaghetti code.

So grab a coffee.
Let’s talk through ESP32 BLE Notifications like two smart friends figuring things out step by step.

By the end, you’ll understand:

  • What BLE notifications actually are
  • How the ESP32 sends and receives them
  • How notifications work on Android, iOS, Arduino, and client-server setups
  • How to use all the common BLE examples (server, client, callback, OTA, etc.)
  • Real code you can copy-paste and run

Let’s jump in.

What Are ESP32 BLE Notifications (And Why They Matter)?

Imagine you’re waiting for a text message.
Your phone doesn’t keep checking the server every second (that would kill your battery).
Instead, the server pushes a notification only when something new comes in.

That’s exactly what esp32 ble notifications do.

Without notifications:
The client keeps polling the server: “Do you have new data?”
This wastes power and time.

With notifications:
The server automatically sends data whenever it changes.
Fast. Simple. Efficient.

This is why notifications are the backbone of:

  • BLE sensors
  • Fitness trackers
  • Smart locks
  • IoT BLE gateways
  • ESP32 BLE presence detection
  • ESP32 BLE keyboard inputs
  • OTA BLE updates
  • And simple BLE Arduino projects

Notifications make communication feel instant—even though everything runs over BLE.

ESP32 BLE Server and Client

To understand esp32 ble notification, you need to know two roles:

ESP32 BLE Server

  • Creates a service
  • Registers characteristics
  • Sends notifications

ESP32 BLE Client

  • Connects to a server
  • Enables notify
  • Receives real-time data

Many tutorials confuse these, so here’s a simple rule:
The device that sends notifications is always the server.
The device that receives notifications is the client.

So if you see:

  • “esp32 ble client notify”
  • “esp32 ble notify callback”
  • “esp32 ble client example”

It’s always referring to the receiving side.

ESP32 BLE Arduino Example

Let’s Write the Simplest Possible BLE Server That Sends Notifications

This is the classic esp32 ble example to get started.

ESP32 BLE Notify Example (Server Code)

#include 
#include 
#include 
#include 

BLECharacteristic *pCharacteristic;
bool deviceConnected = false;

class ServerCallbacks : public BLEServerCallbacks {
  void onConnect(BLEServer *pServer) {
    deviceConnected = true;
  }
  void onDisconnect(BLEServer *pServer) {
    deviceConnected = false;
    pServer->startAdvertising();   // important for reconnection
  }
};

void setup() {
  BLEDevice::init("ESP32-Notify");
  BLEServer *pServer = BLEDevice::createServer();
  pServer->setCallbacks(new ServerCallbacks());

  BLEService *pService = pServer->createService("1234");

  pCharacteristic = pService->createCharacteristic(
    "ABCD",
    BLECharacteristic::PROPERTY_NOTIFY
  );

  pCharacteristic->addDescriptor(new BLE2902());
  pService->start();

  BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
  pAdvertising->start();
}

void loop() {
  if (deviceConnected) {
    int value = random(0, 100);
    pCharacteristic->setValue(value);
    pCharacteristic->notify();
    delay(500);
  }
}

This simple sketch demonstrates:

  • esp32 ble advertising example
  • esp32 ble notify example
  • esp32 ble notify callback
  • esp32 ble arduino example
  • Automatic advertising restart when the client disconnects

Exactly how BLE devices behave in real products.

ESP32 BLE Client Notify Example (How to Receive Notifications)

Now that your server can notify, let’s write the esp32 ble client example that receives them.

ESP32 as BLE Client Receiving Notifications

#include 

static BLEUUID serviceUUID("1234");
static BLEUUID charUUID("ABCD");

class MyClientCallback : public BLERemoteCharacteristicCallbacks {
  void onNotify(
    BLERemoteCharacteristic* pBLERemoteCharacteristic,
    uint8_t* pData, size_t length, bool isNotify) {

    Serial.print("Received: ");
    for (int i = 0; i < length; i++) {
      Serial.print(pData[i]);
    }
    Serial.println();
  }
};

void setup() {
  Serial.begin(115200);
  BLEDevice::init("");

  BLEScan *scan = BLEDevice::getScan();
  BLEScanResults results = scan->start(5);

  for (int i = 0; i < results.getCount(); i++) {
    BLEAdvertisedDevice device = results.getDevice(i);

    if (device.haveServiceUUID() && device.isAdvertisingService(serviceUUID)) {
      BLEClient *client = BLEDevice::createClient();
      client->connect(&device);

      BLERemoteService* remoteService =
        client->getService(serviceUUID);

      BLERemoteCharacteristic* remoteChar =
        remoteService->getCharacteristic(charUUID);

      remoteChar->registerForNotify(new MyClientCallback());
    }
  }
}

void loop() {}

This covers:

  • esp32 ble notify callback
  • esp32 ble client notify
  • esp32 ble callbacks
  • esp32 bluetooth example

So you now have a working end-to-end notification system.

ESP32 BLE Notifications With Android (Mobile App Example)

If your user is on Android, BLE is easy to test.

Use any app like:

  • nRF Connect
  • LightBlue
  • BLE Scanner

What you can do:

Scan for “ESP32-Notify”
Connect
Enable notification on the characteristic
Watch live data come in

This naturally uses and demonstrates:

  • esp32 ble android app example
  • esp32 ble receive data
  • esp32 bluetooth notification

Once you enable notifications, the ESP32 sends data instantly without you touching anything.

ESP32 BLE Notifications on iOS (ANCS & Regular BLE)

iPhones work slightly differently, but they’re still easy.

You can use:

  • LightBlue (iOS version)
  • nRF Connect
  • Custom Swift app

If you’re looking at iOS-specific notification features, you might come across:

  • esp32 ble ios
  • esp32 ble ancs notifications

ANCS = Apple Notification Center Service.
It lets you forward real iPhone notifications (calls, SMS, app alerts) to the ESP32.

Yes, your ESP32 can literally detect when you receive a WhatsApp message.

ESP32 BLE Presence Detection (Cool Use Case)

BLE notifications also help create presence detection systems.

How?

Your ESP32 scans nearby BLE MACs and checks whether known devices are present.

This method is widely used in:

  • Smart homes
  • Security systems
  • Energy-saving automation

This naturally uses:

  • esp32 ble presence detection
  • esp32 ble gateway

Your ESP32 becomes a tiny BLE gateway that senses activity around it.

ESP32 BLE Keyboard + Notifications

Another cool trick:
You can make your ESP32 act like a BLE keyboard and still send notifications.

Useful for:

  • Home automation
  • Game controllers
  • Input devices

This uses:

You can send keystrokes and BLE data at the same time.

ESP32 OTA BLE (Firmware Update Over BLE)

BLE notifications are also part of BLE OTA protocols.

The ESP32 can receive firmware chunks over BLE using:

  • write
  • notify
  • indicate

This includes:

  • esp32 ota ble
  • esp32 push notification

This includes powerful features like ESP32 OTA over BLE and ESP32 push notification support.

If you want a complete beginner-friendly walkthrough, you can follow this practical guide on the ESP32 BLE Server
Imagine updating thousands of devices wirelessly without ever touching a single one.

ESP32 BLE Advertising Example (How Advertising Works)

Before a device connects, it sees the advertising packet.

A simple ESP32 BLE advertising example:

BLEAdvertising *adv = BLEDevice::getAdvertising();
adv->setScanResponse(true);
adv->start();

This helps with:

  • esp32 ble advertising example
  • esp32 ble examples

You can modify advertising data to show battery status, device role, or quick info.

ESP32 BLE Notify Callback Explained Simply

A notify callback is a function that runs whenever new data arrives.

Client-side callback helps you react instantly:

  • Blink LED
  • Update display
  • Log data
  • Trigger command

This is used in:

  • esp32 ble notify callback
  • arduino ble notify example
  • esp32 arduino ble notification

Callbacks make everything real-time.

ESP32 BLE Receive Data (Client Side)

When receiving data:

  • ESP32 is the client
  • Phone or another ESP32 acts as server
  • Notifications arrive as raw bytes

Use them to read:

  • Temperature
  • Heart rate
  • Buttons
  • Sensor streams

This naturally covers:

  • esp32 ble receive data
  • esp32 bluetooth example

Receiving data is just as important as sending it.

ESP32 BLE Gateway Use Case

A BLE Gateway basically:

  • Scans BLE devices
  • Reads their notifications
  • Sends data to a server via Wi-Fi or MQTT

This uses:

  • esp32 ble gateway

A great use case if you’re building an IoT hub or smart home hub.

12 Most Common Problems With ESP32 BLE Notifications (And Fixes)

Problem 1: Notifications Not Working

Enable notify:

pCharacteristic->addDescriptor(new BLE2902());

Problem 2: Client Disconnects Automatically

Restart advertising in callback:

pServer->startAdvertising();

Problem 3: Data Comes in Broken

Use a buffer instead of single bytes.

Problem 4: Android Not Receiving Data

Make sure scan permissions are granted.

Problem 5: iPhone Not Connecting

Use 128-bit UUIDs.

Problem 6: Slow Notifications

Decrease delay or increase MTU:

pServer->getPeerMTU(connId);

Problem 7: ESP32 Resets on Heavy Data

Enable BLE Arduino NimBLE library for lower memory usage.

Final Thoughts ESP32 BLE Notifications Are Simple Once You “Get It”

If you’ve made it this far, you now understand:

  • How esp32 ble notifications work
  • How to create a server that sends them
  • How to build an ESP32 BLE client that receives them
  • How to test with Android and iOS
  • How callbacks, advertising, and BLE examples tie together
  • How to use advanced cases like OTA BLE, BLE keyboards, BLE gateway, presence detection

BLE isn’t magic.
It’s just event-based communication.

FAQ : ESP32 BLE Notifications

This FAQ section covers the most common questions about ESP32 BLE notifications, including examples, callbacks, Android/iOS behavior, advertising, gateways, presence detection, and advanced use cases.

1. What exactly are ESP32 BLE notifications?

ESP32 BLE notifications are automatic real-time data updates sent from a BLE server to a BLE client without the client needing to poll. This makes communication faster and more battery-efficient. You can use notifications for sensor data, ESP32 BLE gateway systems, presence detection, keyboard inputs, and more.

2. How do ESP32 BLE notifications differ from indications?

Notifications are one-way and do not require acknowledgment. Indications require the client to confirm receipt. For fast data like heart rate or sensor streams, notifications are better. For critical transfers (OTA BLE updates), indications may be safer.

3. How do I enable notify on ESP32 BLE characteristics?

You must add a BLE2902 descriptor and set the characteristic property to PROPERTY_NOTIFY. Without this, Android/iOS apps cannot enable notifications. This applies to all ESP32 BLE Arduino example projects.

4. Why are my ESP32 BLE notifications not being received by Android?

Most Android devices require the BLE2902 descriptor to be present. In addition, location permissions must be enabled for BLE scanning. Also ensure MTU is increased if sending large payloads.

5. Why do notifications fail on iOS even though they work on Android?

iOS has stricter BLE rules. You must use 128-bit UUIDs and include proper descriptors. For iPhone alert mirroring, you must implement the ANCS (Apple Notification Center Service), commonly used in esp32 ble ancs notifications.

6. How can I test ESP32 BLE notifications on a smartphone?

Use any BLE scanner app such as nRF Connect, LightBlue, or BLE Scanner. These apps let you scan for the ESP32 BLE advertising example, connect, enable notify, and monitor incoming data instantly.

7. How do I receive notifications using an ESP32 BLE client?

On the client side, register a callback using registerForNotify(). This triggers when a notification arrives. This pattern appears in most esp32 ble client example code.

8. Why does my ESP32 stop sending notifications after the client disconnects?

You must restart advertising inside onDisconnect(). Otherwise, the server waits forever and doesn’t allow reconnections. Example: pServer->startAdvertising();.

9. Can ESP32 BLE send multiple notifications per second?

Yes. You can send several notifications per second by optimizing the delay loop. Increasing MTU size improves throughput. For high-rate data (like audio streaming), BLE is limited but feasible for low-bitrate use cases.

10. Will notifications drain the ESP32 battery fast?

Notifications are lighter than polling, making them efficient for battery-powered applications. Adjusting advertising intervals and disabling scan responses in your ESP32 BLE advertising example helps conserve energy.

11. Can I send data from my phone to ESP32 using notifications?

No. Notifications only go from server → client. To send phone → ESP32, you must use writes or write-without-response. Many Arduino BLE notify examples combine writes and notifications for bidirectional messaging.

12. How do ESP32 BLE notifications help with presence detection?

Presence detection systems use BLE scans to identify nearby devices. Notifications help send detection events instantly to a central ESP32 BLE gateway or MQTT server. This is common in smart homes and automation setups.

13. Can ESP32 BLE notifications be used with OTA updates?

Yes. Some OTA BLE implementations use notifications to confirm transfer states or send progress feedback. This is useful when Wi-Fi isn’t available.

14. Can I use ESP32 BLE notifications with ESP32 BLE keyboard projects?

Yes. The ESP32 can act as a BLE keyboard and still expose a separate GATT service for notifications. This is common in custom HID devices like gamepads or macro pads.

15. What is the maximum data size for one ESP32 BLE notification?

The default BLE payload is 20 bytes. Increasing the MTU (e.g., to 185 bytes) allows larger packets. Large MTU is essential when streaming sensor data or sending structured JSON packets.

Leave a Comment