• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

BLE Multiple Service

Q&A Forum › Category: ESP32 › BLE Multiple Service
0 Vote Up Vote Down
Rushi Patel asked 6 years ago

Hi Rui,
I want little help from you. Can you suggest me how to create a multiple services in the BLE? & How to advertizing the multiple ble services? 
My thoughts:
I think same manner we create another service and for advertising loop is required.I am confusing with my idea. Please help me.

Question Tags: BLE Services
8 Answers
0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

Just to clarify:

  • Do you want to create multiple BLE services?
  • Or do you want to have a BLE service with multiple characteristics?

You don’t need anything in the loop, you just need to start the advertising and all the functions run as callbacks. Regards,
Rui

0 Vote Up Vote Down
Rushi Patel answered 6 years ago

I want multiple services and each service display the value like I am use temperature sensor and gas sensor, etc so right now I am use only one service but instead of that now I want to create each service for each sensor. 

0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

Ok, I would probably still just use one service with multiple characteristics. A service usually holds all the data in different characteristics.

For example, if you had 2 DHT sensors reading 2 temperatures and 2 humidity values, it makes sense to create two services (each service having 2 characteristics).

If you want to create multiple services, I recommend starting with the sample sketch that comes with the ESP32 add-on. Open your Arduino IDE, go to File > Examples > ESP32 BLE Arduino > BLE_server.

You’ll need to start duplicating the sections that create the service with a different name:

#define SERVICE_UUID_2 "4fafc201-1fb5-459e-8fcc-c5c9c331914X"
#define CHARACTERISTIC_UUID_2 "beb5483e-36e1-4688-b7f5-ea07361b26aX"
(...)
BLEService *pService2 = pServer->createService(SERVICE_UUID);

You’ll need to duplicate those sections to having two services. Unfortunately I don’t have any tutorial on that exact subject.

I hope that helps!

0 Vote Up Vote Down
Rushi Patel answered 6 years ago

Ok Thanks. I will try that.

0 Vote Up Vote Down
Rushi Patel answered 6 years ago

Thanks Rui Its work fine with multiple services.

0 Vote Up Vote Down
Rushi Patel answered 6 years ago

Hi Rui,
I am using 2 types of Mobile with different BLE Version

  1. BLE 4.2
  2. BLE 5.0

So I just want to know from you, I am use ESP-WROOM-32 module. In datasheet it written Bluetooth 4.2 EDR/BT & BLE.
So it is supported into BLE 5.0 or not? 
because in BLE 5.0 mobile it is only show one service and in BLE 4.2 device it shows all service.

0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

I’m glad you were able to make it work with multiple services!
The ESP32 supports BLE 4.2 according to what I can find online. It might be some incompatibility with BLE 5.0… I’m not sure, but I think it should show all the services regardless of the BLE version…

0 Vote Up Vote Down
Rushi Patel answered 6 years ago

Thanks to your tutorial and support i able to do multiple services and char also.

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.