Reading multiple BLE characteristics

I have yet to find how to do this: My Arduino is sending Humidity, Pressure and Temperature readings out continuously over BLE which I'm trying to figure out how to display on my phone. I register them all separately but when I try to read them, I only get the temperature (which happens to be the last one registered). Apparently the 'Bytes Received' uses the last characteristic registered. How do I do this?


Why don't you use one uuid and send all the data at once? Don't make it difficult for yourself unnecessarily.

I don't follow. These are three different measurements. Are you suggesting to combine the data into a single string?

I'm trying to understand the procedures that we have: When you Register a characteristic, you set up an interrupt for when it shows up. If I Register more than one characteristic, am I setting up multiple interrupts or is it just taking the last one?
If I then have multiple interrupts set up, I should then be able to see which characteristic came thru or is there another way of finding out? The Read Bytes seems to not give you a choice as to which one to respond to which implies that it only responds to one. The data I got suggests the later.

Check this out :slight_smile: .

I finally figured it out. See att'd.

1 Like

Hlw,
I have the same problem regarding sending skin temperature, heart rate and thermal sensation from Arduino Nano 33 BLE Sense. I registered them with the same Service UUID and different characteristic UUID.
I tried to follow your way but for multiple data, mine does not work. I can only show single real-time data.
I am totally new in this field.
Kindly help me.


1 Like

I've attached my AppInv and the Ardiono code. This combo works.
Good luck,
Cass
BLE_PTH_read.aia (196.1 KB)
BLE_PTH_Indicator.ino.txt (4.1 KB)

1 Like

Thank you so much.

Couple of things I noticed since I went down the same path: in the "bytes received", you do not need to check for the serviceUUid. 2. In spite of it working properly looking at the Arduino BT using Light Blue, AI2 only recognized the output as bytes. Since the Arduino is sending the data as an int, you basically need to read the data in byte chunks then put it back together (this was pointed out by McGyver earlier). This is why I used decodeShort function.

1 Like

@KazysD
Thank you so much for your help.
Now I am facing another problem to read the float data from the Arduino BLE. Two of my data have to be stored as integers and two are floats.
The continuous data has to be shown as decimal values but if I declare the characteristics as "Float" with "float received" I don't get the exact sensor values.

Use one of those apps that lets you check the data coming out of the Arduino (nRF Connect, Bluefruit, LightBlue). Once you know that is correct, then you have more confidence to debug the other end. I used LightBlue.
I did notice that LightBlue has no provision for floating point data and perhaps that's where the problem is. If I'm right, you will want to convert your float data to integers to send it across then back again to display or process it. See: https://community.cypress.com/t5/PSoC-4-MCU/Send-Float/td-p/181948

Another possibility is to send all of your data as text (strings).

Thank you so much.

thank you.

Normally it will work. It worked for me, only I send floats from the app... And that worked. Didn't do it for receiving but I suppose it will do OK. Float can change to decimal when you do calculation with it after declared it. Did you check that on the arduino side?

For you first issue you need to implement a timer to register properly, when you are register for multiple characteristics.

1 Like

BLE_PTH_read.aia worked great for me but I would like to read more than three values. I tried adding on to the BytesReceived block with another "else if", but that didn't work. (I did add a new Characteristic_UUID and changed the "get global stat +" to 8, because it seemed to fit the pattern). Any thoughts on where this went wrong?

Have you added RegisterForBytes for the next UUiD?

Thank you for the reply. Yes, I have included the RegisterForBytes. And everything works fine up to that forth else-if.