<?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>Distance detection with  PCA20006 nRF51822 Bluetooth smart beacon kit</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/13349/distance-detection-with-pca20006-nrf51822-bluetooth-smart-beacon-kit</link><description>I need help sorting out a configuration. 
 What I want to accomplish: 
phase 1: detect if any bluetooth phone/device is present, without connecting to it 
phase 2: determine how far that bluetooth phone/device is from the beacon (far, near, close)</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 06 May 2016 10:16:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/13349/distance-detection-with-pca20006-nrf51822-bluetooth-smart-beacon-kit" /><item><title>RE: Distance detection with  PCA20006 nRF51822 Bluetooth smart beacon kit</title><link>https://devzone.nordicsemi.com/thread/50884?ContentTypeID=1</link><pubDate>Fri, 06 May 2016 10:16:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85b79cc9-0091-4046-95a9-2805cdaea0ad</guid><dc:creator>Robert</dc:creator><description>&lt;p&gt;A bit late, sorry. Nevertheless many thanks for your answer. We need to redefine the project.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Distance detection with  PCA20006 nRF51822 Bluetooth smart beacon kit</title><link>https://devzone.nordicsemi.com/thread/50883?ContentTypeID=1</link><pubDate>Mon, 25 Apr 2016 11:00:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7849a980-e0ed-4b5b-a169-0d6299bd961f</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;phase 1: detect if any bluetooth phone/device is present, without connecting to it&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You can detect centrals by advertising using advertising packets with the &amp;#39;scannable&amp;#39; property, which means either &lt;code&gt;ADV_IND&lt;/code&gt; (connectable) or &lt;code&gt;ADV_SCAN_IND&lt;/code&gt; (not connectable). The central may choose to send a scan request when receiving the advertising packet, which means you will be able to detect it. Do note that you will only detect active scanners. Passive scanners do not send scan requests, and so it is impossible to tell they are there.&lt;/p&gt;
&lt;p&gt;You can detect peripherals by scanning.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;phase 2: determine how far that bluetooth phone/device is from the beacon (far, near, close)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You can use the received RSSI value as a rough estimate for distance. As it measures signal strength (and not actual physical distance) it will be affected by the environment such as reflecting walls or objects blocking line of sight, but it can give a good approximation. While in a connection you  can use &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s130.api.v2.0.0%2Fgroup___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html&amp;amp;cp=2_6_2_1_0_2_1_2_23&amp;amp;anchor=ga51f25b5b74290f91aa92cb47dc8d4276"&gt;sd_ble_gap_rssi_get()&lt;/a&gt; to read the received signal strength. If you need the value for non-connected devices then you can read this on BLE events as described in the &lt;a href="https://devzone.nordicsemi.com/question/59623/rssi-without-connection/"&gt;RSSI without connection&lt;/a&gt; answer.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;phase 3: detect if a specific phone/device is near,
phase 4: connect with that phone/device.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Using Peer Manager (or the older Device Manager) you can keep track of bonded devices, that is devices which you have previously connected to and initiated a bond with. By using RSSI values found in phase 2 you can for instance initiate directed advertising to the closest device of the devices in the bonding table.&lt;/p&gt;
&lt;p&gt;Your questions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;I think it should be possible to do what you want, but it depends a little on what exactly it is. At least something close to what you want should be possible. It will require som work, and I think it would be best to take one step at a time. Use some time to get to know BLE, the SDK and the SoftDevice before you begin (see also answer to 4.).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I would recommend using the &lt;a href="http://developer.nordicsemi.com/nRF5_SDK/"&gt;latest version of the SDK&lt;/a&gt; whenever starting a new project, as this would provide the most features and support the newest hardware. Check the &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf51%2Fdita%2Fnrf51%2Fpdflinks%2Fnrf51_comp_matrix.html&amp;amp;cp=2_0"&gt;compatibility matrix&lt;/a&gt; to see what SDK versions support your hardware revision. There should be some markings on the IC that you can use to read from one of the compatibility matrixes what revision it is. I suggest that you use the newest SDK/SoftDevice that is compatible with each other and with your IC revision.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I would try to find an example from a recent SDK to start from. If the example is not for pca20006 then you should be able to make it work by changing the PCAxxxxxx preprocessor define to PCA20006. Depending on the usage of LEDs and buttons some other changes might be required as well (as the PCA20006 may have fewer LEDs and buttons). There are beacon examples for the PCA20006 in the SDKs as well.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To get familiar with the nRF series, the SDK and the SoftDevice I suggest you have a look at our &lt;a href="https://devzone.nordicsemi.com/tutorials/"&gt;tutorials&lt;/a&gt;, in particular those listed under &amp;quot;Bluetooth Low Energy&amp;quot;. Then you will also get more familiar with BLE and get some thoughts about how you can make the things you want to make. But before that, the &amp;quot;Getting Started&amp;quot; tutorials is a great place for starting.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Regards, Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>