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

Delay between BLE transmissions using Android Blinky

I started modifying the NRF Android Blinky example project to suits my needs (to control a servo motor). I observed there is a BIG delay between writings to a specific characteristic.

I would like that servo motor to move in real time. If you make multiple modifications per second, the queue size will increase and phone will continue to send the data over a few seconds.

Is there a way to decrease this delay? Can you try to reproduce this issue by sending multiple values/second to a specific characteristic?

As a microcontroller I use NRF52832 with a custom board.

Thank you very much!

  • Hello,

    I observed there is a BIG delay between writings to a specific characteristic

    How long is the delay in question? Please be specific.

    the queue size will increase and phone will continue to send the data over a few seconds.

    What are your connection parameters in your Blinky central application? It sounds like the connection interval might be longer than needed.

    Best regards,
    Karl 

     

  • Hello Karl, thanks for the answer,

    I tried with other application and the data is sent instantly.

    With NRF BLinky example, at most 3 to 5 transmissions are made per second, so if I have 15 events (from a slider) in a second the transmission of all data will last more than 5 seconds...

    This is a picture sample from the NRF Blinky Example Code, but it is not modified, basically the code is this, https://github.com/NordicSemiconductor/Android-nRF-Blinky only with a Characteristics UUID modified and a seekbar. So on value change of seekbar I setup and writeCharacteristic() with specific UUID.

  • Bujanca Ovidiu said:
    thanks for the answer,

    No problem at all, I am happy to help!

    Bujanca Ovidiu said:
    I tried with other application and the data is sent instantly.

    Which other application do you refer to - another smartphone application? If so, which smartphone application?
    If the difference lies in which smartphone application is being used, then we need to look at your smartphone applications connection parameters.

    Bujanca Ovidiu said:
    With NRF BLinky example, at most 3 to 5 transmissions are made per second, so if I have 15 events (from a slider) in a second the transmission of all data will last more than 5 seconds...

    This is not a limitation by BLE, so we only need to identify where the slow speed is configured.
    Have you modified the connection parameters of the Blinky application?
    Particularly, we are interested in the connection interval that the smartphone application is configuring. This parameter decides the time between each transffer, and may range from 7.5 ms to 4 s, which means it could be configured too high for your application. From your description, it sounds to be in the 200-300 ms range, while you would like it to be at ~ 65 ms.
    The connection interval is specified as an interval with a _MAX and _MIN. Setting them both to the same value restricts the available range to that single number.

    Best regards,
    Karl

  • Regarding the other application, it was created using MIT App creator name APP Inventor V2, using blocks of code, so I cannot access the code behind the blocks in order to see the connection parameters.. It is a simple drag and drop application creator.

    I did not modified the connection parameters of the Blinky application. It is the default code as I said, with small modifications regarding UUIDs used with writeCharacteristic() function..

    Regarding connection interval in the code, the nordic ble library is compiled in a .jar, so I cannot make modications to it, or at least I do not know how.

    I made a search for 'connection interval' and found multiple results, but In the end I ended up with something called Parcel received as input - this set the interval value.

    You can take a look at the bellow photo.

    It would be helpful if you can take a look in the Blinky example project for the connection interval variable that needs to be modified..

    In the Microcontroller the _MIN interval was set to 100ms and _MAX was set to 200ms.

    Currently I will try to set the _min and _max value on microcontroller to the same value of 10 ms and see what happens.

    Thanks for the help

    • Add to Phrasebook
      • No word lists for English -> English...
      • Create a new word list...
    • Copy
    • Add to Phrasebook
      • No word lists for English -> English...
      • Create a new word list...
    • Copy
  • Hello,

    Bujanca Ovidiu said:
    Regarding the other application, it was created using MIT App creator name APP Inventor V2, using blocks of code, so I cannot access the code behind the blocks in order to see the connection parameters.. It is a simple drag and drop application creator.

    I understand. I am personally not familiar with the MIT App creator APP Inventor V2 drag-and-drop program that you mention, but I would think that they list how to change the connection parameters as part of their documentation - since it is an integral part of the Bluetooth Low Energy specification.

    Bujanca Ovidiu said:
    I did not modified the connection parameters of the Blinky application. It is the default code as I said, with small modifications regarding UUIDs used with writeCharacteristic() function..

    Thank you for verifying this for me. The default connection interval ranges from 100 to 200 ms, if you application default to choosing the 200 ms connection interval that would reasonably explain why you are seeing between 3 and 5 packages per second.

    Bujanca Ovidiu said:
    Regarding connection interval in the code, the nordic ble library is compiled in a .jar, so I cannot make modications to it, or at least I do not know how.

    I would think that you would not have to make a change to the libraries they provide. Normally, you would just have to set the connection parameters - including connection interval min / max - as part of your BLE initiation.

    Bujanca Ovidiu said:
    You can take a look at the bellow photo.

    The photo depicts the legal values that those connection parameters can take. Each unit is 1.25 ms, and the possible connection intervals from the BLE specification ranges from 7.5 ms to 4 s - this equals the range 6 -  3200 in 1.25 ms units.

    Bujanca Ovidiu said:

    It would be helpful if you can take a look in the Blinky example project for the connection interval variable that needs to be modified..

    In the Microcontroller the _MIN interval was set to 100ms and _MAX was set to 200ms.

    You can change the parameters MIN_CONN_INTERVAL and MAX_CONN_INTERVAL in the Blinky example to whatever you want that is within the specified range, but the central might still reject the connection if it can not support the connection interval that the peripheral demands.
    I encourage you to test this out by changing the Blinky connection interval to 10 ms, your APP Inventor V2 might very well accept this connection interval.
    I would appreciate it if you could let me know if this solves the connection parameter issue with APP Inventor V2.

    Bear in mind that a shorter connection interval will require more active radio time, leading to higher power consumption. You are probably already aware of this, but I mention it just in case.

    Bujanca Ovidiu said:
    Thanks for the help

    No problem at all, I am happy to help!

    Best regards,
    Karl

Related