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

Send packets of data from my beacon

Hi! I want to send the temperature data that I get from the beacon sensor not one by one but in packets for example of 100 samples. I have followed this tutorial devzone.nordicsemi.com/.../ to create the service and everything else that is needed to send the data. Can someone help me to modify that code in order to send data in packets? Thanks in advance.

Parents
  • If you want to send more than 4 bytes, you need to modify the maximum length of the characteristic value, Step 2.H, Set characteristic length. If you want yo to send the data in notifications, this can be set up to 20 bytes.

    Then you just collect samples and call our_termperature_characteristic_update()/sd_ble_gatts_hvx() when you have the number of samples you want, max 20 bytes.

  • So if my data are 1 byte long, I cannot send more than 20 samples in a single packet? Because my problem is this: if i sample with the ADC (like in the temperature characteristic as said before) at a higher frequency than in the example (that is 1 Hz), let's say 1 kHz, with the minumum connection interval (that is 7.5 ms) i can't manage to get a sample every 1 ms and send it, because the maximum transmission frequency is 1/(7.5*10^-3); so i have to fill packets and transmit them with lower frequency than the sample frequency! So if i can fill a packet of let's say 100 samples, i can reach higher sampling frequencies and send by notification the packets. Is this correct? If so, this operation is limited by a maximum of 20 bytes packet? Thanks in advance!

    And also, when you say "collect samples" you mean to fill an array of values and then send it in the notification structure?

Reply
  • So if my data are 1 byte long, I cannot send more than 20 samples in a single packet? Because my problem is this: if i sample with the ADC (like in the temperature characteristic as said before) at a higher frequency than in the example (that is 1 Hz), let's say 1 kHz, with the minumum connection interval (that is 7.5 ms) i can't manage to get a sample every 1 ms and send it, because the maximum transmission frequency is 1/(7.5*10^-3); so i have to fill packets and transmit them with lower frequency than the sample frequency! So if i can fill a packet of let's say 100 samples, i can reach higher sampling frequencies and send by notification the packets. Is this correct? If so, this operation is limited by a maximum of 20 bytes packet? Thanks in advance!

    And also, when you say "collect samples" you mean to fill an array of values and then send it in the notification structure?

Children
No Data
Related