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

How should I increase the throughput of my BLE application?

I have an android client that functions as a central and have an app on my MAC (peripheral) that this central connects to and sends data.

At this point, I need to wait almost 100ms after I call writeCharacteristic(..) to receive the onCharacteristicWrite(..) callback. I am sending strings. If I send smaller strings, the throughput is great (understandably). When the string contains about 200 characters and I send 20 byte chunks, it takes almost a second before the entire string is seen at the peripheral.

After I connect, I have done the following to improve throughput:

  • Stopped discovery after services are discovered because it is an expensive operation
  • I set the write type to default first - When I do this, I see data on the peripheral. But, there is a significant delay. When I set the writeType to NO_RESPONSE, I see no data on the peripheral. I have no logic in onCharacteristicWrite(..) either.
  • I have set the desired connection latency to low on my mac app. Is there a way to set a value (as 7.5ms perhaps?).
  • When I set the write type to default and send a string of 200 characters - I split the string into 20 byte chunks. I now have 10 chunks to send. If I set characteristic value and call writeCharacteristic(..) in loop, I see no data. When I add a ~100ms delay after writeCharacteristic(..) before it executes the next iteration of the loop, I see data on the peripheral.

I see a huge increase in throughput between an iOS central - iOS peripheral. From my understanding, Android and iOS use the same chip.

Any reason the performance is so poor? Is there anything else I can do to improve throughput?

Related