Bluetooth examples

20 Dec 2018

Hello guys,

I always find it difficult navigating to examples on the website. I managed to find the Bluetooth examples and test them, but they seemed to be very application specific. For example, I tried changing the Beacon example to send float numbers for Major/Minor, but it is hard set to int so that is not possible...

I am looking for a very simple example on how to use my board's Bluetooth (using Disco L475). I am used to using external bluetooth modules connected to Arduino and Software Serial, setting TX/RX and simply printing to serial. In the available examples, it looks like each one makes use of a very specific class which we cannot edit, like the Heart rate or Battery ones.

I am sorry if I am missing something, I just can't understand how these examples are meant to be useful to get us started if we cannot edit them to send anything we want. Which example would you use to just send random numbers to ensure that you receive them on the serial monitor?

Thank you, Chris

26 Dec 2018

Hi Chris,

Regarding BLE_Beacon example, there is a good article https://os.mbed.com/blog/entry/BLE-Beacons-URIBeacon-AltBeacons-iBeacon/ for explaining how beacon works, majorNumber and minorNumber are defined as unsigned-int type. Is there any reason you need to set major/minor to float number?

Regarding HeatRate and Battery, those are GATT services (https://www.bluetooth.com/specifications/gatt/services) which are defined as standard BLE services, so that's why they are written to very specific class.

Are you trying to use BLE as a UART console interface? If the answer is yes, you can refer to this project (https://os.mbed.com/teams/Bluetooth-Low-Energy/wiki/UART-access-over-BLE), which provide a example of using Nordic UART service. This is vendor specific service, so you need to download Nordic's app to achieve this feature.

Here (https://github.com/ARMmbed/mbed-os-example-ble) are some BLE examples we provide, you can refer to those examples, and feel free to ask me any questions!

Thanks,

- Desmond, team mbed

07 Jan 2019

Desmond Chen wrote:

Hi Chris,

Regarding BLE_Beacon example, there is a good article https://os.mbed.com/blog/entry/BLE-Beacons-URIBeacon-AltBeacons-iBeacon/ for explaining how beacon works, majorNumber and minorNumber are defined as unsigned-int type. Is there any reason you need to set major/minor to float number?

Regarding HeatRate and Battery, those are GATT services (https://www.bluetooth.com/specifications/gatt/services) which are defined as standard BLE services, so that's why they are written to very specific class.

Are you trying to use BLE as a UART console interface? If the answer is yes, you can refer to this project (https://os.mbed.com/teams/Bluetooth-Low-Energy/wiki/UART-access-over-BLE), which provide a example of using Nordic UART service. This is vendor specific service, so you need to download Nordic's app to achieve this feature.

Here (https://github.com/ARMmbed/mbed-os-example-ble) are some BLE examples we provide, you can refer to those examples, and feel free to ask me any questions!

Thanks,

- Desmond, team mbed

Hello happy new year and thank you for your reply,

Thank you for clarifying the HeartRate and Battery examples and that I cannot change them. Regarding the Beacon example, the only reason I wanted to change Major/Minor to float is to just to prove that my program works. Major/minor doesn't mean anything to me, it was just a way to see the received number on my phone change. I have 3 sensors connected onto my Disco board, getting readings. I would like to, at any instant, get these three values and just send the over Bluetooth (probably in CSV format) to a serial monitor (which is why I tried to edit the Beacon example to be an ADC reading from my sensor and it worked but it wasn't in float).

I am currently looking into the Nordic UART service but I am not sure if it will be helpful yet. I will explain why I need to use BLE in my application.

As I have said, I have checked the examples you provide but they seem very application specific. I cannot find a simple program which sets up my BLE, allows me to choose some data and just send it over.

Thank you, Chris

08 Jan 2019

I believe what you need is GATT Server and GATT Client, there are good at updating sensor data. You can find the examples here https://github.com/ARMmbed/mbed-os-example-ble.

We also have documentation for what they are.

GATT Client https://os.mbed.com/docs/latest/apis/gattclient.html

GATT Server https://os.mbed.com/docs/latest/apis/gattserver.html

And this is a good article describing GATT from TI http://dev.ti.com/tirex/content/simplelink_cc2640r2_sdk_1_40_00_45/docs/blestack/ble_user_guide/html/ble-stack-3.x/gatt.html.

Hope this help you well.

08 Apr 2019

Desmond Chen wrote:

I believe what you need is GATT Server and GATT Client, there are good at updating sensor data. You can find the examples here https://github.com/ARMmbed/mbed-os-example-ble.

We also have documentation for what they are.

GATT Client https://os.mbed.com/docs/latest/apis/gattclient.html

GATT Server https://os.mbed.com/docs/latest/apis/gattserver.html

And this is a good article describing GATT from TI http://dev.ti.com/tirex/content/simplelink_cc2640r2_sdk_1_40_00_45/docs/blestack/ble_user_guide/html/ble-stack-3.x/gatt.html.

Hope this help you well.

Hello,

After putting the project on hold, I have returned to it now. I have gone through the documentation but I just ended up connecting an external Bluetooth module on A5/A4 pins and just use the Serial to print my values. My mistake 2 months ago was that I was trying to use D5/D4 instead.

Thank you for your help and next step is to actually use the embedded BLE module on the board rather than an external module.

Chris

09 Apr 2019

Glad to hear that, please let me know for any questions!