<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22246/best-way-to-send-data-from-many-sensors</link><description>Hi, 
 For an application I have a nRF51 at my disposal and I need to transfer about 3&amp;#39;000Bytes. I found in the documentation that the nRF51 can use the S130 SoftDevice which support BLE 4.2. The data I have to transfer come from 1 to 50 sensors and are</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 30 May 2017 21:25:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22246/best-way-to-send-data-from-many-sensors" /><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87435?ContentTypeID=1</link><pubDate>Tue, 30 May 2017 21:25:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09d448b1-902d-4893-9ef0-44f178ccbf99</guid><dc:creator>rct42</dc:creator><description>&lt;p&gt;If you decide to go down the UART over BLE, one recommendation for a protocol is &lt;a href="https://en.wikipedia.org/wiki/Binary_Synchronous_Communications"&gt;IBM Bisync&lt;/a&gt; (or something similar). However, if you&amp;#39;re wanting to transfer 3K bytes in a go, how about &lt;a href="https://en.wikipedia.org/wiki/YMODEM"&gt;YMODEM&lt;/a&gt;? (I haven&amp;#39;t used YMODEM on NRF5x projects but have used the STM32F0xx_IAP for STM32 UART/RS485 bootloaders)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87439?ContentTypeID=1</link><pubDate>Tue, 30 May 2017 08:37:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:546ead91-23a0-48cf-9f78-4ef252b54053</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;But to conclude on NUS: it is good thing which should just allow data to flow over the GATT, basically no overhead (examples are expecting the strings to end with line delimiters or similar but I&amp;#39;m not sure if it is inherent limitation of NUS itself or just example implementation). Still it doesn&amp;#39;t help you with designing your own protocol (= if you want to send some sensor data over the link you need to format them yourself, if you want to provide them on request - after the other peer asks and maybe even says what data it wants - then you need to design your command/response protocol yourself as well... we were maybe mixing these two things together in this Q&amp;amp;A too much.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87438?ContentTypeID=1</link><pubDate>Tue, 30 May 2017 08:27:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98e813af-143a-4552-bf34-62c48e12b8dd</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Hi both, I&amp;#39;m used to work with single Characteristic simply because it works well. The only added value of splitting Tx/Rx streams into two GATT Characteristics (I&amp;#39;m aware of) is that you get full-duplex capability aka you can &amp;quot;stream&amp;quot; data both ways at the same time and througput should be close to optimal while with single Characteristic some devices (I don&amp;#39;t think it is limitation mentioned in BT SIG specification but I might be wrong) can use only one GATT method (= Write or Notify) on the same handle during one connection interval so sometimes when there are multiple PDUs pending on both sides to go over the radio they might get delayed. But because 99% of protocols I see in the wild are half-duplex (command-response not asynchronous data streams from both sides) I don&amp;#39;t see this as major limitation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87437?ContentTypeID=1</link><pubDate>Tue, 30 May 2017 07:19:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db592d79-a5ea-4fc2-a1b1-f2405a86b477</guid><dc:creator>Olivier</dc:creator><description>&lt;p&gt;Hi rct42, Thanks for your comment! Yes I&amp;#39;m considering starting with this example (&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v12.0.0%2Fble_sdk_app_nus_eval.html)"&gt;infocenter.nordicsemi.com/index.jsp&lt;/a&gt;. That is why I don&amp;#39;t understand very well why endnode says that I only need one Characteristic while this example uses 2 Characteristics (working with the nRF51+S130 SoftDevice).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87436?ContentTypeID=1</link><pubDate>Tue, 30 May 2017 01:54:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:017e4bab-f325-4d78-9e88-dee0f8025fb2</guid><dc:creator>rct42</dc:creator><description>&lt;p&gt;Just wondering whether you&amp;#39;ve considered the BLE UART abstraction (ble_app_uart) as a method of transferring data and adding a binary protocol to encode/decode this? (I&amp;#39;m also weighing up a similar decision vs writing a specific BLE service)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87434?ContentTypeID=1</link><pubDate>Mon, 29 May 2017 13:13:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3493009-42e1-4374-95d9-bab08d1f7d9d</guid><dc:creator>Olivier</dc:creator><description>&lt;p&gt;Thank you for your help and for your suggestions!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87433?ContentTypeID=1</link><pubDate>Mon, 29 May 2017 09:49:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b802931-f260-4005-9e4f-08a161a187b1</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;I&amp;#39;m struggling to understand added value of that second optional Characteristic, what will be Read by Client there vs. what would be received in Notify on the other Characteristic upon some Write (containing command data). But if you want both things and have some use for it then why not.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87432?ContentTypeID=1</link><pubDate>Mon, 29 May 2017 08:37:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:796eb8c7-3bd0-46b4-b51c-8923a3ba2f45</guid><dc:creator>Olivier</dc:creator><description>&lt;p&gt;To resumed the situation I&amp;#39;m now thinking of 2 possibles solutions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Having a new custom service with only one characteristic (mandatory) which has Notify and Write. I will implement a customized protocol to recognize the data piped within BLE. The values will be stored by the application&lt;/li&gt;
&lt;li&gt;Having a new custom service with one characteristic (mandatory) which has Notify and write and an other one (optional) which has read and write. For the notify characteristic I will implement a customized protocol to recognize the data piped within BLE. The values will be stored by the application. For the second characteristic the data will be stored in the stack in the value field and will contain some settings if available which are readable and writable.
The Notify will carry many data values but the write command will carry only some data values and some commands. In my opinion splitting the settings and the data in two different characteristic make more sense but I&amp;#39;m still not 100% sure.
I understand that you prefer choice 1 but can you please give me some advantages of this solution in comparison with the second choice?&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87431?ContentTypeID=1</link><pubDate>Mon, 29 May 2017 08:22:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70657923-4e8e-4ad8-a824-d82855ce566d</guid><dc:creator>Olivier</dc:creator><description>&lt;p&gt;I have updated my question to give a better overview of your answers. Yes I&amp;#39;m designing a solution for one very specific use case.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87430?ContentTypeID=1</link><pubDate>Mon, 29 May 2017 07:48:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:abad0e44-aaa0-4799-91b4-c159dee83b9b</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;ATT_MTU size is by default 23 and can be negotiated once per connection to minimum from Server and Client max values. We are going into too much theoretical discussion with many assumptions and potential situations where one or another solution can provide better throughput. Does it mean that you are designing solution for one very specific use case of data granularity and througput or are we really talking about some general (limit) use cases?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87429?ContentTypeID=1</link><pubDate>Mon, 29 May 2017 07:33:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b147a1a0-c76f-4fce-b290-433dd992600b</guid><dc:creator>Olivier</dc:creator><description>&lt;p&gt;A) The Notify method provides ATT_MTU-3 value while read blob response provides ATT_MTU-1 with should offer a better throughput. Doesn&amp;#39;t it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87428?ContentTypeID=1</link><pubDate>Mon, 29 May 2017 07:33:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d83f956-140e-4121-8898-34ae8e5ee162</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;B) Again all my comments are skipping this basic scenario of quasi-static value stored in Characteristic&amp;#39;s Value handle. Yes, you can do Write and Read from Client side and async Notification from Server side but that leads exactly to the scheme you presented originally: load of single-purpose Characteristics on the server side. It can be fine for simple use cases but when scaling to dozens of things (like your case with dozens of sensors) and caring about &amp;quot;performance&amp;quot; in terms of connection time and throughput the experience is suggesting to design single &amp;quot;tube&amp;quot; (or pair of Tx/Rx buffers) on top of some Characteristic Value and then define more condensed protocol with Write/Notify methods. The worst thing which could happen is that you will have the same &amp;quot;performance&amp;quot; as if you would do Read + response, but typically you will be much better.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87427?ContentTypeID=1</link><pubDate>Mon, 29 May 2017 07:30:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:454cbe87-4b9a-48c5-a847-4c116c33c472</guid><dc:creator>Olivier</dc:creator><description>&lt;p&gt;C) Yes the Notification maximal size is ATT_MTU-3 but what is the size of ATT_MTU? Is it defined by the Server or by the Client?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87426?ContentTypeID=1</link><pubDate>Mon, 29 May 2017 07:26:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9785fda5-be23-4106-a60e-69865ce7d50f</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;A) Reading values over (G)ATT methods in BLE makes sense for some read-only or similar informative string exposed by GATT Server. It&amp;#39;s rarely used. For any real communication on application layer Notify methods are providing much better throughput so everyone uses that way.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87425?ContentTypeID=1</link><pubDate>Mon, 29 May 2017 07:09:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6324f577-724e-4fd0-932e-3123a7cb85be</guid><dc:creator>Olivier</dc:creator><description>&lt;p&gt;B) If I understand you right, with the read command I will read the data written with the write command but the content of notification will not be the same as the written data? In my understanding a Service with notification has a Characteristic with the propertie (read, notify, etc.) in its value, a Characteristic with the value being advertised and a Characteristic format with the status of the notification/indication (enable or disable) in its value. For example the Battery Service is read and notify and has only one Characteristic Value, so I assume that an application reading the Battery level will get the same value as the one being notified. For this reason I don&amp;#39;t understand why should the write command write at a different place as the read command read from? In this example I differentiate the notification enable and the write because notification enable write a 1 in the Characteristic Format bit0 which is notification enable.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87424?ContentTypeID=1</link><pubDate>Mon, 29 May 2017 07:07:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95140398-8fbb-4302-9fa3-cf789e2970a3</guid><dc:creator>Olivier</dc:creator><description>&lt;p&gt;A) Why do you say that the Read methods is kind of old-fashion &amp;quot;pull&amp;quot; model for people who are not able to understand or use &amp;quot;sync&amp;quot; way? What is the sync way if it isn&amp;#39;t read?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87423?ContentTypeID=1</link><pubDate>Wed, 24 May 2017 15:06:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9c19668-f058-4b90-9474-ec5d6d077eac</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;This is probably just implementation detail but normally (= with Nordic SoftDevice) you get event callback and in event data structure you get pointer to the data buffer. Then you should take the data and work with them, if you store them in one or million buffers inside your application code/logic is your business. Once event callback processing ends you should probably not assume that data are left somewhere for you (they actually are as I wrote but you should do little testing if it matters to you, I was never investigating this because I just use Write and Notify so there is no one who would &amp;quot;read&amp;quot; any data which are left in some Value data buffer).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87422?ContentTypeID=1</link><pubDate>Wed, 24 May 2017 15:01:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23044dac-e58a-4a75-8278-5efc1dc760ed</guid><dc:creator>Olivier</dc:creator><description>&lt;p&gt;B) If I write in a characteristic and I notify the same characteristic (say the characteristic is Write+Notify) will the data be written in the same memory region? I&amp;#39;m not referencing to the notification enable which enable the notification but is actually written in the CCCD characteristic.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87421?ContentTypeID=1</link><pubDate>Wed, 24 May 2017 14:08:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:497e7671-7aad-46d7-9d53-509ddef807f6</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;I don&amp;#39;t want to be impolite but looking to your assumptions about how BLE works I&amp;#39;d recommend to go through some basic courses like &lt;a href="https://github.com/Szarp/WolfsHeart/blob/master/Documents/Low%20Energy%20Training.pdf"&gt;this one from BT SIG&lt;/a&gt;. Maybe twice;) It&amp;#39;s pretty detailed and explanatory to understand basic concepts of all layers. It&amp;#39;s missing few enhancements coming with BT 4.2 and 5.0 but unfortunately there is no such material to cover these known to me, maybe just few blog posts by Nordic guys here cover some parts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87420?ContentTypeID=1</link><pubDate>Wed, 24 May 2017 13:34:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e2cfb46-ced8-44e1-8070-b3ffcefea446</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Sorry, one more to Notifications and CCCD: once you allow Notification as method for given Characteristic then GATT Server (= the stack under the API aka Soft Device in Nordic case) automatically creates CCCD handle for you. You just need to remember its handle number so then if write arrives to it you know what is it (and can check data which might mean that Client wants to activate Notifications or anything else). You can try to blindly use API and just catch if there is some error return from SD (like &amp;quot;invalid operation (because Notifications are not enabled)&amp;quot;) but that doesn&amp;#39;t look like proper way of doing SW development;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87419?ContentTypeID=1</link><pubDate>Wed, 24 May 2017 13:28:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd2ae02e-1ee2-4ceb-80a9-fb5815143004</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;E) The size limits I mention are linked to ASN.1 BER-TLV notation (length encoding to be specific) but that&amp;#39;s completely independent on BLE so you can forget about it if you don&amp;#39;t plan to use it;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87418?ContentTypeID=1</link><pubDate>Wed, 24 May 2017 13:27:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce3fb189-2824-4e95-b70f-1bfb2423a52e</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;D) Yes, that&amp;#39;s what I would do.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87417?ContentTypeID=1</link><pubDate>Wed, 24 May 2017 13:27:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6e5f8a5-6a6f-4b8f-a311-2437ada8af85</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;C) In Nordic SD API there are GATT calls how to send data out through Notify method but note that Notifications (and Indications) by nature cannot be larger then ATT_MTU size! (again this is my understanding, maybe good to double check with other sources on this forum and internet). The usual solution is to implement custom fragmentation/reassembly protocol on top of GATT (bellow your APP data) which then allows you to transport theoretically unlimited sizes of data strings.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87416?ContentTypeID=1</link><pubDate>Wed, 24 May 2017 13:24:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa5378ca-efc5-4b0f-a5fd-937b31987c9a</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;B) your understanding of GATT Characteristics seems to be wrong. There is &amp;quot;Value&amp;quot; handle attached to each Char and that is used for Write/Read methods (= data are &amp;quot;stored&amp;quot; there). However on top of the same &amp;quot;Value&amp;quot; handle you can support Notify or Indicate methods which are kind of &amp;quot;separate&amp;quot; (one time) data transfers not interfering with data in actual &amp;quot;Value&amp;quot; buffer. Or at least this is my understanding and also implementation in Nordic Stack (but please validate this experimentally). All methods must be &amp;quot;allowed&amp;quot; on given Characteristic explicitly but you can combine it so one single Char you can allow Notifications as well as Write methods and let the data flow bi-directionally (and you can allow even more things of course). The only limitation seems to be that methods cannot be combined within one connection interval (so it&amp;#39;s kind of half-duplex).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Best way to send data from many sensors</title><link>https://devzone.nordicsemi.com/thread/87415?ContentTypeID=1</link><pubDate>Wed, 24 May 2017 13:19:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:408c3688-ab2f-47d3-a41d-1bc40e19a6d7</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;(continue...)&lt;/p&gt;
&lt;p&gt;A) As I said I was lost in your Client/Server architecture so in general from Client to Server you transport data through Write methods (two types) and from Server to Client through Notify/Indicate methods (this is usual &amp;quot;async&amp;quot; model used by most of modern Profiles) or through Read methods (kind of old-fashion &amp;quot;pull&amp;quot; model for people who are not able to understand or use &amp;quot;sync&amp;quot; way). Again I don&amp;#39;t understand all the details of your application data flow so this was general remark and you will need to decide yourself.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>