<?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>How to deal with broadcasting collision?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/13685/how-to-deal-with-broadcasting-collision</link><description>I have 500 nrf51822 devices, when I use Master Control panel to scan twice, the first time I can scan device A, the second time I can not scan out device A.
I google find out that,broadcast channel is 37,38,39.
Does bluetooth exist broadcasting collision</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 10 May 2016 11:47:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/13685/how-to-deal-with-broadcasting-collision" /><item><title>RE: How to deal with broadcasting collision?</title><link>https://devzone.nordicsemi.com/thread/52300?ContentTypeID=1</link><pubDate>Tue, 10 May 2016 11:47:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:452001d3-7459-4571-b866-6a638f900001</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I am book marking this not just because of the math (which is awesome BTW), but also because of the efforts you took to explain this. you rock :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to deal with broadcasting collision?</title><link>https://devzone.nordicsemi.com/thread/52299?ContentTypeID=1</link><pubDate>Tue, 10 May 2016 11:42:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23c63b80-d0d5-4206-b2ac-d4ebe790255c</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure all the assumptions in it are right, pretty sure the maths is right based on the assumptions and the numbers it gave seemed to agree with my back of the envelope guesses about how long the advertising interval would need to be. But it could be a factor of 10 or more out as far as I really know.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to deal with broadcasting collision?</title><link>https://devzone.nordicsemi.com/thread/52301?ContentTypeID=1</link><pubDate>Tue, 10 May 2016 08:43:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:242056e3-50af-4d3a-9406-bde932869631</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I am gonna bookmark this answer RK :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to deal with broadcasting collision?</title><link>https://devzone.nordicsemi.com/thread/52298?ContentTypeID=1</link><pubDate>Fri, 06 May 2016 08:17:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62fbd67c-54e8-45a7-bd85-0b7012ba50f8</guid><dc:creator>qoboty</dc:creator><description>&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;How many device I could scan out at most?
or How many devices could send adverting packet on the advertise channels support ?
Is there  fomula to caculate?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to deal with broadcasting collision?</title><link>https://devzone.nordicsemi.com/thread/52297?ContentTypeID=1</link><pubDate>Fri, 06 May 2016 07:41:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e604f53f-8973-4ee8-a01d-903fde924f58</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Yes bluetooth has a mechanism to deal with broadcast collisions by adding in a small element of randomness between advertisements. If you have enough devices however and a short enough advertising interval on every one of them, you could eventually get to the point there&amp;#39;s always more than one broadcasting on every channel at one time.&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s try to develop some idea of how likely it is one transmitting device will get an advertising packet out with nothing else overlapping it ..&lt;/p&gt;
&lt;p&gt;Say your advertising interval is &lt;em&gt;I&lt;/em&gt; and the length of an advertising packet is &lt;em&gt;a&lt;/em&gt;. Assuming that the randomness factor makes the start of any given packet in an interval random and uniformly distributed, what&amp;#39;s the probability that another given advertiser&amp;#39;s packet will overlap any piece of yours?&lt;/p&gt;
&lt;p&gt;Well if it starts anywhere between &lt;em&gt;a&lt;/em&gt; before you start up until when you finish, it will overlap, so that&amp;#39;s a window of &lt;em&gt;2a&lt;/em&gt;. However it could be on a different channel, so that gives us a &lt;em&gt;1/3&lt;/em&gt; probability that it&amp;#39;s on your channel. If the distribution is uniform over &lt;em&gt;I&lt;/em&gt; then&lt;/p&gt;
&lt;p&gt;P(overlap) = &lt;em&gt;2a/3I&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;so therefore the probability that it doesn&amp;#39;t overlap is&lt;/p&gt;
&lt;p&gt;P(miss) = &lt;em&gt;1 - 2a/3I&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s say there are &lt;em&gt;N&lt;/em&gt; advertisers and make the somewhat incorrect assumption that to get your packet out in the clear to even be possible to find, you must miss all of them.&lt;/p&gt;
&lt;p&gt;P(miss all) = &lt;em&gt;( 1 - 2a/3I )^( N-1 )&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s put some numbers in. Advertising packets are 80-376 bits long at 1Mb/s, let&amp;#39;s say it&amp;#39;s not a max length packet, it&amp;#39;s 300bits so that&amp;#39;s 300e-6 seconds or 3e-4 seconds. Your interval is 40mS which is 4e-2 so&lt;/p&gt;
&lt;p&gt;P(miss all) = &lt;em&gt;( 1 - 2x3e-4 / 3x4e-2 ) ^ 499&lt;/em&gt; = &lt;em&gt;( 1 - .0006 / 0.12 )^499&lt;/em&gt; = .082, or about 8.2%.&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s go the other way&lt;/p&gt;
&lt;p&gt;P(miss all) = &lt;em&gt;P(miss) ^ ( N - 1 )&lt;/em&gt; --&amp;gt; P(miss) = &lt;em&gt;exp( ln( P(miss all) / ( N - 1 ) )&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;say you want it to be 1/2 and you have your N as 500 still, so&lt;/p&gt;
&lt;p&gt;P(miss) = exp( ln ( 0.5 ) / 499 ) = 0.9986&lt;/p&gt;
&lt;p&gt;so &lt;em&gt;( 1 - 2a / 3I ) = .9986&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Since the length of the advertising packet is fixed at (I assumed) 3e-4 we have&lt;/p&gt;
&lt;p&gt;&lt;em&gt;( 1 - 6e-4 / 3I ) = .9986&lt;/em&gt; --&amp;gt; &lt;em&gt;I = 6e-4/( 3 x ( 1 - .9986 ) )&lt;/em&gt; = 0.143&lt;/p&gt;
&lt;p&gt;So with these rather broad assumptions, if you have 500 devices each with a 300 bit advertising packet (including preamble), in order to have a 50% chance any given advertising packet gets out in the clear, ie not overlapped by any other packet, you need an advertising interval of around 150ms.&lt;/p&gt;
&lt;p&gt;So on average at 40ms your device gets about 8% of its advertising packets out in the clear, which would make discovery a bit slow. At 150ms 50% of them get out in the clear.&lt;/p&gt;
&lt;p&gt;That&amp;#39;s my back-of-the-envelope calculation, you should see the device eventually however it may take a while for the randomness to slide it into that 8% window.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>