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

NRF52840 ADC multiple channels via BLE_NUS

Hello, all

Following this ticket (Configuring ADC sampling rate and simultaneous reading from multiple channels.), I found a great example code that sends readings from multiple ADC channels via ble_nus. To transmit the data, the code concatenates all the ADC readings from all the channels in the same string and sends it using the ble_nus_data_send function.

My question is: is this the best approach for sending the data or would it be faster if we included two different ble_nus tx characteristics in the same service, one for each ADC channel?

Parents
  • Hello,

    Actually, using only one characteristic, and put your measurements back to back is the best way, because it decreases the number of required packets. Since all packets have some overhead, keeping the packets few and as long as possible is probably your best option.

     

    the code concatenates all the ADC readings from all the channels in the same string and sends it

     If you want to optimize it, you don't need to send it as a string (not clear if you are actually doing this). Just use the raw data values. 

    Two 12 bit samples = 24 bit = 3 bytes. If you translate them to strings, e.g. "3.0424, 0.3264", it is 14 characters long = 14 bytes.

    Now, if low latency is the most important feature for you, you should use a short connection interval. The periheral can only send data on the connection events (occurs every connection interval). 

    Best regards,

    Edvin

Reply Children
No Data
Related