Trying to display sensor data on app via BluetoothLE

Hi Everyone,

I've had an Arduino project with a HC-05 attached for Bluetooth and a working app I created here.

In order to advance the project I'm moving it to the Arduino Giga with onboard BluetoothLE. Now I'm in the process of converting the app to work with the BLE.

I've been stumbling through it for a few days and have had a partial succes. I can get a connection between the app and Arduino, scan for devices and connect to my device.
At some Point the app would auto-connect to my device on startup, but that's no longer working. The blocks have changed so much I don't recall what they used to be when it was working. I've made a seperate button for it with blocks linked but no succes yet.

However the major problem is reading sensordata through the BLE connection.
My first working example used BLEShortCharacteristig. I was getting the temperature through and could display it where I wanted. Getting multiple values proved to be a problem. In the Arduino Code I've tried to make extra (unique) Services to seperate the individual charasteristics. But that didn't work. I've read it's fine to pass 3 ints under the same charasteristic but I'm having trouble "grouping" them before and seperating them after.
Currently I'm trying splitting a String but I'm having just as much trouble "creating" the String. At the moment the String is "temp 251 humi 544 pres 1019"

I've used this tutorial for biggest part of it, but from the Arduino code side it is unclear to me how the data is packaged before sending it.

If anyone could point me in the right direction I would be grateful.

PaludariumApp_2.aia (920.2 KB)



Your tutorial included an .aia file.

What version of the BLE extension was included?

For current version see

(Canned Reply ABG - BLE FAQ with Latest Versions for Permissions)

I'm using a BLE extension updated to the lastest one 28-7-2023

(that's all I can do from my phone)

Thanks for your time regardles :slight_smile:

In the Arduino code I've set:

BLEStringCharacteristic stringDataCharacteristic("ECBCAD86-1020-441B-BE5D-C11AB3415169", BLERead | BLENotify, 50);

String dataString;

in a loop updated every 2 seconds:

dataString = Serial.readString();

(serial prints "temp 251 humi 544 pres 1019")

stringDataCharacteristic.writeValue(dataString); (updated every 2 seconds)

BLE.setAdvertisedService(remoteControl);
remoteControl.addCharacteristic(stringDataCharacteristic);
BLE.addService(remoteControl);
stringDataCharacteristic.writeValue(dataString);

BLE.advertise()

When I try to read the string with the Light Blue app, after connecting to the device, I get "00 00" on hex and a blank line in UTF-8 String format.

I've found this thread about multiple sensors. It has given me a better idea of how to transmit the data in 1 charasteristic, so it should be easyer to read. I don't have a clear picture yet on how to split it, but I'll start with the call BluetoothLE1.ReadBytes