Comments on: ESP32 BLE Server and Client (Bluetooth Low Energy) https://randomnerdtutorials.com/esp32-ble-server-client/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Sun, 05 Apr 2026 09:14:54 +0000 hourly 1 https://wordpress.org/?v=6.8.5 By: Sara Santos https://randomnerdtutorials.com/esp32-ble-server-client/#comment-1175858 Sun, 05 Apr 2026 09:14:54 +0000 https://randomnerdtutorials.com/?p=107720#comment-1175858 In reply to Claudio.

Hi.
You don’t need to load any library.
It is automatically included.
Regards,
Sara

]]>
By: Claudio https://randomnerdtutorials.com/esp32-ble-server-client/#comment-1175318 Fri, 03 Apr 2026 14:08:44 +0000 https://randomnerdtutorials.com/?p=107720#comment-1175318 Hello,
Thanks for your excellent work on BLE.
I use platformIO to develop project under ESP32 board.
I installed the BLE library (ESP32 BLE Arduino by Neil Kolban) but on the repository this library is deprecated.
“This repository is deprecated. The BLE code is now part of the ESP32 Arduino core, making it automatically available to any Arduino ESP32 project without the need for manual import.”

Which library I have lo load into platformIO?
Tanks in advance
Claudio

]]>
By: ChrisGadg https://randomnerdtutorials.com/esp32-ble-server-client/#comment-1101628 Thu, 25 Sep 2025 06:35:37 +0000 https://randomnerdtutorials.com/?p=107720#comment-1101628 In reply to Sara Santos.

A phone/PC software building program – and not node red!!! Awful.

To build an app. To interact with the Bluetooth device.

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-ble-server-client/#comment-1101478 Wed, 24 Sep 2025 19:45:30 +0000 https://randomnerdtutorials.com/?p=107720#comment-1101478 In reply to ChrisGadg.

Hi.
I’m sorry, but I ddidn’t really understand your question.
Can you reformulate?
Regards,
Sara

]]>
By: ChrisGadg https://randomnerdtutorials.com/esp32-ble-server-client/#comment-1101356 Wed, 24 Sep 2025 09:57:35 +0000 https://randomnerdtutorials.com/?p=107720#comment-1101356 I got this working after there were multiple library conflicts. Then the UART project. Both suffer with the ESP32S3 Dev board, the com port somehow.

I want to build a PC/phone terminal for these, what platform do you recommend?

]]>
By: Holin Chang https://randomnerdtutorials.com/esp32-ble-server-client/#comment-1060795 Wed, 25 Jun 2025 07:56:55 +0000 https://randomnerdtutorials.com/?p=107720#comment-1060795 Hi Rui / Sara,
I am a freshman for Arduino.
Your website/ tutorial really helped me.

I have a question about the below function:
I guess there is an ” else ” missed.
the statemant I sandwiched with “//////////////////////…” seems always go through ( connectToServer() always delivers true ) no matter previous if result.

bool connectToServer(BLEAddress pAddress) {
BLEClient* pClient = BLEDevice::createClient();

// Connect to the remove BLE Server.
pClient->connect(pAddress);
Serial.println(” – Connected to server”);

// Obtain a reference to the service we are after in the remote BLE server.
BLERemoteService* pRemoteService = pClient->getService(bmeServiceUUID);
if (pRemoteService == nullptr) {
Serial.print(“Failed to find our service UUID: “);
Serial.println(bmeServiceUUID.toString().c_str());
return (false);
}

// Obtain a reference to the characteristics in the service of the remote BLE server.
temperatureCharacteristic = pRemoteService->getCharacteristic(temperatureCharacteristicUUID);
humidityCharacteristic = pRemoteService->getCharacteristic(humidityCharacteristicUUID);

if (temperatureCharacteristic == nullptr || humidityCharacteristic == nullptr) {
Serial.print(“Failed to find our characteristic UUID”);
return false;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Serial.println(” – Found our characteristics”);

//Assign callback functions for the Characteristics
temperatureCharacteristic->registerForNotify(temperatureNotifyCallback);
humidityCharacteristic->registerForNotify(humidityNotifyCallback);
return true;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

]]>
By: David Hughes https://randomnerdtutorials.com/esp32-ble-server-client/#comment-1060004 Sun, 22 Jun 2025 14:03:47 +0000 https://randomnerdtutorials.com/?p=107720#comment-1060004 I am going to ask a really simple question, as I am new to this, so please bear with me.

I have mostly got all this working and have client and server talking to eachother.

I want to send the data between them using numerical data, ie integers, rather than character strings. I have managed to do this at the server end, but can not figure out what I need to change at the client end.

David

]]>
By: Rezeki https://randomnerdtutorials.com/esp32-ble-server-client/#comment-1057136 Fri, 13 Jun 2025 03:33:54 +0000 https://randomnerdtutorials.com/?p=107720#comment-1057136 Hi Sara,
Good day.

Is there any simple sample sketch for Server and Client which both of them can send and receive data between Server and Client. Thanks in advance

]]>
By: Rohith https://randomnerdtutorials.com/esp32-ble-server-client/#comment-1052022 Thu, 29 May 2025 03:46:01 +0000 https://randomnerdtutorials.com/?p=107720#comment-1052022 Hi ,
Thanks for your excellent contents.
I am struggling to add passkey encryption in ESP32 Client. Always getting Pairing failed!”

Added call back.
// Custom Security Callback Class
class MySecurity : public BLESecurityCallbacks {
uint32_t onPassKeyRequest() {
Serial.println(“Requested passkey”);
// Return the passkey expected by the server
return passkey; // Replace with your passkey
}
void onPassKeyNotify(uint32_t pass_key) {
Serial.printf(“Passkey Notify: %d\n”, pass_key);
}
bool onConfirmPIN(uint32_t pass_key) {
Serial.printf(“Confirm Passkey: %d\n”, pass_key);
return true; // Accept the passkey
}
bool onSecurityRequest() {
return true;
}
void onAuthenticationComplete(esp_ble_auth_cmpl_t auth_cmpl) {
if(auth_cmpl.success) {
Serial.println(“Pairing success!”);
} else {
Serial.println(“Pairing failed!”);
}
}
};

Calling this before “LEClient* pClient = BLEDevice::createClient();”
BLEDevice::setEncryptionLevel(ESP_BLE_SEC_ENCRYPT);
BLEDevice::setSecurityCallbacks(new MySecurity());

BLESecurity *pSecurity = new BLESecurity();
pSecurity->setAuthenticationMode(ESP_LE_AUTH_REQ_SC_ONLY); // Secure Connections Only
pSecurity->setCapability(ESP_IO_CAP_OUT); // Display Only (client provides passkey)
pSecurity->setRespEncryptionKey(ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK);
pSecurity->setStaticPIN(passkey);
pSecurity->setKeySize(16);

]]>
By: Narasimman.M https://randomnerdtutorials.com/esp32-ble-server-client/#comment-1006765 Mon, 10 Feb 2025 06:32:22 +0000 https://randomnerdtutorials.com/?p=107720#comment-1006765 Hi SARA,
If ESP32 as a server, Mobile BLE application is Client.
In this case after the successful server(ESP32) client(App) conection , ESp32 need to disconnect the BLE connection between the Mobile application.
What should I do?
Thanks.

]]>