This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

send data to smartphone

Hallo i am beginner developer, i plan to send sensor data to smartphone, i am still confused whether to use ble_app_uart or advertising mode, for example my case saw TrackR module not using uart communication, i hope you can help me, thanks

  • How anyone could help you with this input?:) Sure you can use either way, it just depoends what you want:

    • With advertising you have limited space but you can broadcast to all listeners at once. It's probably the most effective way in terms of power consumption but the biggest drawback is that there is no way (unless you build some protocol on top of it and perform dual role which immediately becomes less effective then BLE link) to know if the data were received by listener(s) or not. So if you very much care about power consumption and don't mind if few packets get lost from time to time without any easy way to recover/re-transmit then go with advertising. Example could be weather thermometer: you like to have long-lasting battery, it is nice that it can target many listeners at the same time and you don't care if no one sees the temperature broadcast or if few packets get lost, because you are interested in changes over dozens of minutes/hours not faster.
    • For all the rest you need to go with BLE link, however there are many possible architectures on top of that and Nordic BLE UART Service (NUS) over GATT is just one of examples. You can theoretically build something directly on top of Link Layer, more common are protocols on top of L2CAP (because BLE stacks offer APIs for that and L2CAP allows fragmentation/defragmentation) and the most usual way is to go on top of (the highest layer with structured data) GATT layer, simply because many "black box" devices provide APIs just to GATT (like Android, iOS, Windows etc.) Once you get to GATT you will hardly find something simpler and with less overhead then direct mapping of APP data (unstructured) to GATT Values like NUS does. Actually most of people who use it define another proprietary formatting layer on top of it to be able to work with their application-specific data. Something like that is the right way for you as well I believe. All these methods on top of Link Layer (= BLE connection) have advantage of just little bit higher power consumption but reliable link (meaning that you know for sure that either packet reached the opposite side or that connection breaks at time-out).
Related