I am streaming sensor data from a XIAO NRF52840, to my mobile device using the nRF Connect App. In code, I am transmitting the data (as a string) using the setValue() function. This works fine, but I am quickly running out of the amount of information that I can I can transmit and view in the App.
For example, if I have the variable myString, which contains casted data from a temperature sensor, “Temp: 65.55 F”, I will send like so:
switchCharacteristic.setValue(myString);
I will see in the nRF Connect app, something like:
Value: (0x) 4E-43-2E-20-54-3A, “Temp: 65.55 F.”
This is fine, however, as I add additional sensors and attempt to transmit additional data, I quickly run out of space, to the point where my string gets cut off before I can view all of the data.
I suppose there are two possibilities:
I don’t transmit the Address Bits, thus freeing up space to send my sensor data. (I don’t know if this is even possible, but I’d prefer this, as it would make the readout on the nRF Connect App cleaner).
I increase the size of the buffer being sent. Again, I’m not sure if this is feasible or wise, as it may slow down transmission.
I do not know which is the better options (if my assumptions are even correct) nor, how to perform either action. So I came here, asking for advice.
Please let me know if I need to clarify anything at all. Thank you all in advance.
That could work. I currently have a single Service and a single Characteristic. Would it make sense to have 3 Services and 1 Characteristic? Or 3 Characteristics, each with their own Service? I never actually figured out the proper convention for that.
After doing a little further research, it seems I have confused Services and Characteristics and it would be ideal for me to have 1 Service with 3 Characteristics (1 for each sensor).
If anyone believes otherwise, I’d be happy to be corrected.
Giving each sensor their own characteristic and adding them to a single service seems to have solved my problem.
I’m not a huge fan of the way information is displayed in the nRF Connect App (that is, I need to start each stream of data for each Characteristic), but I understand that this is just a development tool.
AN ASIDE: Is there a way to change the Service and Characteristic names in the nRF Connect App? Preferably in firmware on my NRF52840 so that it’s permanent, no matter what mobile device is connecting to it.
So your setup of 1 service with 3 characteristics is exactly how it’s normally done.
If your sensors are environmental, I’d recommend using the standard Environmental Sensing Service (0x181A) with standard characteristics. That way tools like nRF Connect will automatically label them properly instead of showing raw UUIDs.
Regarding names: BLE doesn’t really transmit “names” for services/characteristics. Apps recognize standard UUIDs and display friendly names. For custom UUIDs, you can add a User Description descriptor (0x2901), but support varies by app.
Also, enabling notifications per characteristic is normal — each one has its own CCCD, so the app lets you control them individually.
What you built now is actually the correct structure — just decide whether you want to go “standard UUIDs” or “custom + descriptors.”
Check out the demo’s with video & code I have on here , to learn more.