Learn ESP32 Send Data Over BLE with easy examples, data types, notifications, long data, and phone communication in this beginner-friendly guide.
If you’ve ever wanted your ESP32 to send data wirelessly, you’ve probably looked at Wi-Fi first. But here’s something many beginners miss: BLE (Bluetooth Low Energy) is often a better fit when you want low-power, short-range, fast, lightweight communication. In fact, learning how to ESP32 send data over BLE is one of the most useful skills you can pick up in IoT.
In this mega-guide, we’ll walk through everything step by step what BLE is, how it works on ESP32, how to send and receive data, long packets, notifications, data types, faster throughput, and complete examples. We’ll also compare BLE with Wi-Fi and Bluetooth Classic so you know when to use what.
Grab a coffee, and let’s dive in.
ESP32 Send Data Over BLE
What Does It Mean to ESP32 Send Data Over BLE ?
When people say ESP32 send data over BLE, they usually mean one of these:
- Sending sensor values to a smartphone
- Streaming data to another ESP32
- Building a BLE server to broadcast readings
- Sending commands from a phone to ESP32
- Sending long messages (like JSON strings)
BLE is built around a simple concept:
The ESP32 acts as a BLE server. Your phone (or another ESP32) acts as a BLE client. They exchange data through characteristics.
If that sounds confusing, don’t worry; it’ll make sense once we try.
Why Use BLE Instead of Wi-Fi?
Here’s a quick comparison:
| Feature | BLE | Wi-Fi |
|---|---|---|
| Power usage | Extremely low | High |
| Range | Short | Long |
| Data rate | Moderate | High |
| Setup | Easy | Needs router or hotspot |
| Ideal for | Sensors, wearable, control apps | Streaming, cloud, web APIs |
BLE shines when you need:
- Low-power portability
- Fast reconnection
- Simple phone-to-device communication
So when you want to send data ESP32-to-phone, BLE is perfect.
That said, the ESP32 also supports esp32 send data over WiFi, esp32 send data via bluetooth, esp32 send data over WiFi to PC, and esp32 send data over Bluetooth Classic — but this article keeps the focus on BLE.
Understanding ESP32 BLE : A Simple Explanation
BLE uses these components:
Server
A device that provides data.
(Our ESP32 in most cases.)
Client
A device that reads or writes data.
(Smartphone, PC, or another ESP32.)
Service
A category of related data.
Characteristic
The actual value you send —> like temperature, string, or commands.
Notifications
The server pushes data to the client automatically.
This is what lets you implement things like:
- esp32 ble example
- esp32 ble server example
- esp32 ble client example
- esp32 ble advertising example
- esp32 ble mesh example
We’ll get into those later.
ESP32 BLE Data Types You Can Send
The ESP32 supports almost all common data types:
- integers (8-bit, 16-bit, 32-bit)
- floats
- strings
- binary packets (byte array)
- sensor readings
- JSON formatted text
- long messages (we’ll cover esp32 ble send long data too)
Your phone or client receives them the same way.
ESP32 Data Rate over BLE : How Fast Is It?
Many beginners ask about esp32 data rate over BLE.
Here’s the real-world average:
- ~5–10 KB/s using standard BLE characteristics
- 20–40 KB/s using optimized MTU + notifications
BLE is not designed for file transfers or video streaming, but for IoT sensor data, it’s more than enough.
ESP32 BLE Server Example (Arduino)
If you want a simple starting point, let’s look at a clean ESP32 BLE example that shows exactly how to send data using notifications. This example creates a BLE server, advertises a service, and sends “Hello from ESP32” every 2 seconds while using BLE notifications for fast and lightweight data transfer. If you’re new to notifications or want a deeper explanation of how they work internally, you can check out this detailed guide on ESP32 BLE notifications , it explains how notification packets flow, how MTU affects speed, and how to optimize data updates.
This example:
- Creates a BLE server
- Advertises a BLE service
- Sends “Hello from ESP32” every 2 seconds
- Uses BLE notifications for efficient updates
Complete Working ESP32 BLE Server Example
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
BLEServer* server;
BLECharacteristic* characteristic;
#define SERVICE_UUID "12ab"
#define CHARACTERISTIC_UUID "34cd"
void setup() {
Serial.begin(115200);
BLEDevice::init("MyESP32-BLE");
server = BLEDevice::createServer();
BLEService* service = server->createService(SERVICE_UUID);
characteristic = service->createCharacteristic(
CHARACTERISTIC_UUID,
BLECharacteristic::PROPERTY_READ |
BLECharacteristic::PROPERTY_NOTIFY
);
service->start();
BLEAdvertising* advertising = BLEDevice::getAdvertising();
advertising->start();
Serial.println("BLE Advertising Started");
}
void loop() {
characteristic->setValue("Hello from ESP32");
characteristic->notify();
delay(2000);
}
This is the simplest way to send data over BLE ESP32.
How to Send Data Over BLE ESP32 (Explained Like a Friend)
Let’s break it down in plain English.
Step 1: Start BLE advertising
This is how your ESP32 shows up in apps.
Step 2: Create a service
Think of it like a folder.
Step 3: Create a characteristic
This is the “data slot.”
Step 4: Set values
characteristic.setValue(data)
Step 5: Notify the client
characteristic.notify()
That’s literally it.
ESP32 BLE Send Data to Phone
You can use:
- nRF Connect (Android/iOS)
- LightBlue (iOS)
- BLE Scanner app
Steps:
- Enable Bluetooth
- Scan for “MyESP32-BLE”
- Connect
- Open characteristic
- Watch live notifications
You will see real-time esp32 ble send data to phone.
ESP32 BLE Receive Data From Phone
To implement esp32 ble receive data, add this:
characteristic = service->createCharacteristic(
CHARACTERISTIC_UUID,
BLECharacteristic::PROPERTY_WRITE |
BLECharacteristic::PROPERTY_READ |
BLECharacteristic::PROPERTY_NOTIFY
);
Then handle write events:
class MyCallbacks : public BLECharacteristicCallbacks {
void onWrite(BLECharacteristic *pCharacteristic) {
std::string data = pCharacteristic->getValue();
Serial.println("Received: " + String(data.c_str()));
}
};
Attach callback:
characteristic->setCallbacks(new MyCallbacks());
Now you can send commands like:
- “LED ON”
- “START”
- “STOP”
- “123”
ESP32 BLE Send Long Data (MTU Increase)
Default BLE MTU is 20 bytes.
Increase it like this:
BLEDevice::setMTU(517);
Then you can send long strings:
String longMessage = "This is a long BLE message...";
characteristic->setValue(longMessage.c_str());
characteristic->notify();
This enables esp32 ble send long data smoothly.
ESP32 BLE Client Example (ESP32 → ESP32 Communication)
Here’s a minimal esp32 bluetooth example acting as a client:
#include <BLEDevice.h>
void setup() {
Serial.begin(115200);
BLEDevice::init("");
BLEClient* client = BLEDevice::createClient();
client->connect(BLEAddress("AA:BB:CC:DD:EE:FF"));
BLERemoteService* service = client->getService("12ab");
BLERemoteCharacteristic* ch = service->getCharacteristic("34cd");
std::string value = ch->readValue();
Serial.println(value.c_str());
}
void loop() {}
This completes the esp32 ble client example.
Common Problems: ESP32 Not Flashing?
If you ever see esp32 not flashing, try:
- Hold BOOT while pressing EN
- Use correct COM port
- Disconnect GPIO 0 pins
- Lower upload speed to 115200
- Replace USB cable
ESP32 Send Data Over Bluetooth Classic (Alternative Method)
If you want more data rate than BLE:
- Use Bluetooth Serial
- Compatible with arduino send data over bluetooth
Example:
#include "BluetoothSerial.h"
BluetoothSerial SerialBT;
void setup() {
SerialBT.begin("ESP32-Classic");
}
void loop() {
SerialBT.println("Hello via Bluetooth Classic");
delay(1000);
}
This covers esp32 send data over bluetooth and send data over bluetooth esp32.
ESP32 Send Data Over WiFi (Comparison Section)
Sometimes BLE isn’t enough.
Here’s how to send data over WiFi ESP32.
HTTP POST Example
#include <WiFi.h>
#include <HTTPClient.h>
WiFi.begin("SSID", "PASS");
void loop() {
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
http.begin("http://server.com/api");
http.POST("value=123");
http.end();
}
}
This is the simplest esp32 http post example and helps when sending data over WiFi.
ESP32 BLE Mesh Example (Overview)
ESP32 supports BLE Mesh, which means:
- Many ESP32s communicate together
- Good for home automation
- Ultra-low power
Beginners usually start with:
esp32 ble mesh example
But BLE Mesh is more complex and not needed for simple data transfer.
8BitDo ESP32 Note
Some people search 8bitdo esp32 because many game controller mods use ESP32 BLE.
Just a side trivia your ESP32 can behave like a custom controller too.
Full End-to-End Data Transfer Example (Final Working Code)
Below is a polished, production-friendly BLE server that:
- sends temperature data
- receives commands
- sends long strings
- works with any BLE mobile app
How to Optimize ESP32 BLE Data Transfer
Increase MTU
BLEDevice::setMTU(517);
Use notifications instead of polling
Much faster.
Use byte arrays for compact data
Efficient for sensors.
Use short UUIDs
Better speed.
Advanced Tips for ESP32 BLE Projects
- Use a dedicated task for BLE
- Use debouncing on sensors
- Avoid sending data too frequently
- Use battery-friendly intervals
- Always disconnect cleanly
Sending ESP32 Data to PC Over WiFi (Alt Method)
If you prefer WiFi:
- esp32 send data over wifi
- esp32 send data over wifi to pc
Use either:
- HTTP server
- WebSocket
- MQTT
But for local, quick communication, BLE is still simpler.
Frequently Asked Questions (FAQs)
1. How to send data over BLE ESP32?
Use BLE characteristics with notifications. Set value, then call notify().
2. Can ESP32 send long BLE data?
Yes. Increase MTU to 517 and send long strings or byte arrays.
3. What is the data rate of ESP32 BLE?
Around 10–40 KB/s depending on MTU and notifications.
4. Can I send sensor values to a phone?
Yes. ESP32 BLE is perfect for this.
5. Does ESP32 BLE need pairing?
Not always. You can run unencrypted BLE for simple projects.
6. ESP32 BLE vs WiFi: which is better?
BLE is low power and simple. WiFi is high speed and internet friendly.
7. How to fix ESP32 not flashing?
Hold BOOT, use better cable, change COM port.
8. Can ESP32 be both BLE server and WiFi client?
Yes. ESP32 supports dual-mode operation.
9. Can two ESP32 boards communicate over BLE?
Yes. One acts as server, the other as client.
10. Which app is best to read BLE data?
nRF Connect is the gold standard.
11. Can ESP32 send data via classic Bluetooth?
Yes. Use BluetoothSerial library.
12. Can I send images over BLE?
Not recommended. BLE is too slow.
13. Is BLE secure?
Yes, but only if you enable encryption and bonding.
Final Thoughts
Learning how to ESP32 send data over BLE opens up a whole world of cool IoT projects from health trackers to smart home gadgets, to mobile-controlled robots. BLE is simple, light, power-efficient, and extremely effective for short-range device communication.
If you follow the examples above, you can build:
- ESP32 → Phone communication
- ESP32 → ESP32 mesh
- ESP32 data streaming
- Command-based control systems
You now have everything you need to use BLE like a pro.
If you want, I can also generate:
Mr. Raj Kumar is a highly experienced Technical Content Engineer with 7 years of dedicated expertise in the intricate field of embedded systems. At Embedded Prep, Raj is at the forefront of creating and curating high-quality technical content designed to educate and empower aspiring and seasoned professionals in the embedded domain.
Throughout his career, Raj has honed a unique skill set that bridges the gap between deep technical understanding and effective communication. His work encompasses a wide range of educational materials, including in-depth tutorials, practical guides, course modules, and insightful articles focused on embedded hardware and software solutions. He possesses a strong grasp of embedded architectures, microcontrollers, real-time operating systems (RTOS), firmware development, and various communication protocols relevant to the embedded industry.
Raj is adept at collaborating closely with subject matter experts, engineers, and instructional designers to ensure the accuracy, completeness, and pedagogical effectiveness of the content. His meticulous attention to detail and commitment to clarity are instrumental in transforming complex embedded concepts into easily digestible and engaging learning experiences. At Embedded Prep, he plays a crucial role in building a robust knowledge base that helps learners master the complexities of embedded technologies.













