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

read out buffer via bluetooth

Hi

Here's what I would like to do: I have a bluetooth device with an nrf51822, with which I gather some sensor data, with a period of say 1 minute. I would like to store the last samples in a buffer, and I would use some circular buffer with a size of 1000 samples, so at any time I would have between 1 and 1000 samples in my buffer. What I would like to do is transfer those samples to a smartphone or a tablet when the smartphone or tablet is within reach. I already can do this using single values. But the question is now: how to transfer a buffer: I don't think I can define a characteristic with (variable) length of maximum 1000 bytes. So I think my smartphone app just needs a notification when it is in reach with a message that new samples are available, and then have a mechanism where the smartphone can download the buffer content, by consecutive reads of e.g. a readable characteristic of say 32 bits.

Is there some example somewhere which does a similar thing? Can anyone make a suggestion on what would be the best way of doing this, with minimal amount of transfers needed? Maybe should add to it that my bluetooth peripheral is battery operated.

Parents
  • Hi wim

    Over the BLE link, you can transmit up to 20 bytes per packet, and up to 6 packets per connection interval. The connection interval can be adjusted from 7,5ms to 4000ms, depending on your data throughput needs. You can also let the peripheral (the nRF51822) have large slave latency, which will enable data bursts, but will save current when there is nothing to transmit.

    Perhaps you can look at the ble_app_uart example present in the nrF51 SDK. It will receive data from UART (e.g. sensor) and forwared it to the softdevice to transfer it over BLE. The data is forwarded via FIFO RX buffer, and you can configure the size of the FIFO. Also when data is received over the BLE link, it is forwarded to the UART via the FIFO TX buffer.

Reply
  • Hi wim

    Over the BLE link, you can transmit up to 20 bytes per packet, and up to 6 packets per connection interval. The connection interval can be adjusted from 7,5ms to 4000ms, depending on your data throughput needs. You can also let the peripheral (the nRF51822) have large slave latency, which will enable data bursts, but will save current when there is nothing to transmit.

    Perhaps you can look at the ble_app_uart example present in the nrF51 SDK. It will receive data from UART (e.g. sensor) and forwared it to the softdevice to transfer it over BLE. The data is forwarded via FIFO RX buffer, and you can configure the size of the FIFO. Also when data is received over the BLE link, it is forwarded to the UART via the FIFO TX buffer.

Children
No Data
Related