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

How to increase data transfer rate for BLE nrf51822 to raspberry pi?

I am working on a project where i need to send sensor values from nrf51822 module to a raspberry pi. The sensor values are received by the nrf using I2C protocol. I am using mbed compiler with the BLE.h and Gap.h libraries. I want to increase the data transfer rate. Currently it sends data at an interval of 150ms. I want to bring this down to 10ms. I tried tweaking parameters for the setAdvertisingInterval() function, but it didnt change the speed at all. Please help.

Parents Reply Children
  • Further doubts to your reply

    ---"I assume you are connected when you want to transfer the data, and in this case it is the connection interval that is critical, not the advertising interval." Currently my advertising type is [GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED]. I had read that the 'undirected' mode takes a minimum of 100ms interval time. So i changed it to the 'directed' mode. But, after doing so the raspberry pi(peripheral) couldn't connect to the nrf51822(cental). How do I change this to connection mode from advertising mode? It will be really helpful if you could attach a code snippet that does so.

    ---"You might want to consider packing multiple sensor updates into a single packet, to make the data transmission more efficient." I implemented this but the time interval for each sensor value still remains the same. Calculated this by sending a packet of 10 values which takes approx 1400ms and dividing by 10 yields 140ms

  • Hi

    I think most of the mBed BLE libraries are connection based, including this one.

    How many bytes long is each sensor value?
    It seems odd that adding multiple values together wouldn't increase overall data rate, unless you are still breaking them up before sending them across the BLE link.

    As a general note, you might get better support for mBed specific questions by using the mBed forums. Since mBed is not a Nordic delivery we have limited experience with it.

    Best regards

  • I have to transmit accelerometer (acc), magnetometer (mag), gyroscope (gyro) and temperature data. I have 3 valeus for acc, mag and gyro along their 3 axes namely x, y and z. Along with these I am also sending the time value in ms by reading the timer. (Sending time value so as to compare it with the timer on Rpi). Thus a total of 3+3+3+1+1=11 values. Every value is an int thus 2 bytes. Stacking them in an array of 11 elements gives me an array of 22 bytes. I have also added a loop where i can collect these sensor values multiple times say 10, hence that would make an array of 22*10.

    As suggested by you, I also included minConnectionInterval = 8 (10ms), maxConnectionInterval = 16 (20ms) and set these connection params using the ble.setPreferredConnectionParams() function before the connection being established. Yet the time does not change (still a difference of 140-150ms between consecutive values)

  • Hi

    The mBed API's should have a function called ble.updateConnectionParams(connHandle, connParams), which you can use to request a different set of connection parameters after the connection has been established.

    Could you try to call this function 5-10 seconds after connection establishment, and see if it is successful?

    Best regards

  • I tried this as well but still no improvement in results. I am a bit confused about the argument connHandle. Could you please explain it or suggest suitable articles to read upon it. Will I have to tweak these connection parameters on the Rpi as well?

Related