<?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>BLE Button low power</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8351/ble-button-low-power</link><description>Hello fellow developers, 
 I am new to BLE applications and I am trying to do a very simple device with three buttons that informs a Android smartphone when one has been pressed. So far, I got everything running: the android part, the nRF51822 application</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 30 Jul 2015 18:05:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8351/ble-button-low-power" /><item><title>RE: BLE Button low power</title><link>https://devzone.nordicsemi.com/thread/30276?ContentTypeID=1</link><pubDate>Thu, 30 Jul 2015 18:05:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ef19841-cb2b-4bd2-9dec-86bbd65fd679</guid><dc:creator>SebastianP</dc:creator><description>&lt;p&gt;Thanks &lt;strong&gt;a lot&lt;/strong&gt;, Peter. Now I just need to test it for longer times and tweak the timeouts. As you say, I&amp;#39;m pretty sure that I saw it disconnected and the clock drift sounds like a good explanation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Button low power</title><link>https://devzone.nordicsemi.com/thread/30275?ContentTypeID=1</link><pubDate>Wed, 29 Jul 2015 12:05:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0252572d-4b92-4eca-95ae-fe76f055cf0b</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;I added a &lt;a href="https://devzone.nordicsemi.com/question/46510/how-can-the-peripheralslave-sleep-as-much-as-possible/"&gt;question&lt;/a&gt; that I hope explains this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Button low power</title><link>https://devzone.nordicsemi.com/thread/30274?ContentTypeID=1</link><pubDate>Tue, 28 Jul 2015 10:04:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5fc646bd-9c15-47b6-91d5-25c283d1d282</guid><dc:creator>SebastianP</dc:creator><description>&lt;p&gt;Answering to myself. According to &lt;a href="https://developer.mbed.org/teams/Bluetooth-Low-Energy/wiki/Managing-Power-on-mbed-BLE"&gt;this mbed Wiki Page&lt;/a&gt; the constrain is:
&lt;code&gt;(conn_sup_timeout * 8) &amp;gt;= (max_conn_interval * (slave_latency + 1))&lt;/code&gt;
However, it seems to refer to softdevice S110 while in mbed IDE it seems to be using S130. In S130 I can&amp;#39;t find any reference to this constrain, but it seems that it&amp;#39;s been changed to &lt;code&gt;conn_sup_timeout * 4&lt;/code&gt; instead of &lt;code&gt;conn_sup_timeout * 8&lt;/code&gt;, but it&amp;#39;s an empirical finding.
So far, it&amp;#39;s good to me. When I have something more stable (and less ugly) I&amp;#39;ll share both an mbed and Android projects.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Button low power</title><link>https://devzone.nordicsemi.com/thread/30273?ContentTypeID=1</link><pubDate>Mon, 27 Jul 2015 16:57:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bcf443f-e3c7-423e-adf7-7aeb036fe857</guid><dc:creator>SebastianP</dc:creator><description>&lt;p&gt;Now I have some problems with the connection parameters, sometimes I get an &lt;code&gt;OUT_OF_RANGE&lt;/code&gt; error and I don&amp;#39;t get why.
The following works:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;new_params.minConnectionInterval = 304 ;
new_params.maxConnectionInterval = 320;
new_params.slaveLatency = 5;
new_params.connectionSupervisionTimeout = 600;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But this one doesn&amp;#39;t:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;new_params.minConnectionInterval = BLE_GAP_CP_MIN_CONN_INTVL_MAX; //0xC80
new_params.maxConnectionInterval = BLE_GAP_CP_MAX_CONN_INTVL_MAX; //0xC80
new_params.slaveLatency = BLE_GAP_CP_SLAVE_LATENCY_MAX; //0x1F3
new_params.connectionSupervisionTimeout = BLE_GAP_CP_CONN_SUP_TIMEOUT_MAX; //0xC80
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If I lower the Latency to 2 it works but it always disconnects after 32 seconds. I guess there are some formulae that I&amp;#39;m missing for validating the parameters. It seems that the key is in the latency, I would like it to be as high as possible.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Button low power</title><link>https://devzone.nordicsemi.com/thread/30272?ContentTypeID=1</link><pubDate>Mon, 27 Jul 2015 16:49:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95d6a983-1c0c-4019-bd54-f8dd06f1aa80</guid><dc:creator>SebastianP</dc:creator><description>&lt;p&gt;I&amp;#39;ve been playing a little with a Linux machine and &lt;code&gt;gatttool&lt;/code&gt;, &lt;code&gt;hcitool&lt;/code&gt;, and &lt;code&gt;hcidump&lt;/code&gt; and I have done some great progress. As Petter pointed out, the problem was in the connection intervals. The &lt;code&gt;hcidump&lt;/code&gt; output when connected to my device showed:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;2015-07-27 13:58:47.398017 &amp;lt; HCI Command: LE Create Connection (0x08|0x000d) plen 25
    bdaddr C3:C5:C1:B5:CE:6B type 1
    interval 96 window 48 initiator_filter 0
    own_bdaddr_type 0 min_interval 40 max_interval 56
    latency 0 supervision_to 42 min_ce 0 max_ce 0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then with the &lt;code&gt;hcitool lecup&lt;/code&gt; commands described in &lt;a href="http://mike.saunby.net/2013/04/raspberry-pi-and-ti-cc2541-sensortag.html?showComment=1385137396524#c2601206620864060040"&gt;this comment&lt;/a&gt; I was able to update the connections lowering the current consumption.
After that, I changed the mbed code to update the parameters when it connects.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Button low power</title><link>https://devzone.nordicsemi.com/thread/30270?ContentTypeID=1</link><pubDate>Mon, 27 Jul 2015 11:01:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1c95138-dbe7-410a-b7a7-cafe27c1e2e3</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;If you don&amp;#39;t enter a connection you need to put your data into advertising/scan response packets. These will not be acknowledged. Then you need to build your ack mechanism into your application. I&amp;#39;m not sure you are familiar with scan request/scan response. Anyways, if the central does active scanning it sends scan requests when it receives an advertising packet, then the peripheral can send a scan response with additional data. You may be able to use this to make an ack mechanism, where an advertising packet is acked with a scan request, but I don&amp;#39;t recommend doing this. I&amp;#39;m not sure if you are doing bonding now, but if not, I would look into that, so that the GATT client on the central avoids doing a service discovery on every connection.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Button low power</title><link>https://devzone.nordicsemi.com/thread/30271?ContentTypeID=1</link><pubDate>Mon, 27 Jul 2015 10:56:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d02ad15-7e39-49f7-8cbf-3d8b688a409f</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;0.6 uA is only achievable in SYSTEM OFF. In this state the chip can only be woken up from a pin change, by the LPCOMP, or from a reset. It will not go to SYSTEM OFF between advertisements. In SYSTEM ON the minimum current you should see between advertisements should be something like 2.6 uA. In your second comment you talk about using a button to start advertising, this button can be used to go from SYSTEM OFF to SYSTEM ON, then 0.6 uA is achievable. From a power consumption perspective you solution is very valid, if your application can live with the latency.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Button low power</title><link>https://devzone.nordicsemi.com/thread/30266?ContentTypeID=1</link><pubDate>Mon, 27 Jul 2015 10:10:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae18ebf2-3b6c-4a60-be5c-e645ff1dcdcc</guid><dc:creator>SebastianP</dc:creator><description>&lt;p&gt;Thanks for answering Locky! As I commented in Petter&amp;#39;s answer, I will need to gather more information on the connection parameters with an sniffer. I hope to have more information soon. Best regards.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Button low power</title><link>https://devzone.nordicsemi.com/thread/30269?ContentTypeID=1</link><pubDate>Sat, 25 Jul 2015 11:38:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a0ae8df-501d-42a0-b7c6-31ed6e14d925</guid><dc:creator>SebastianP</dc:creator><description>&lt;p&gt;I have also been thinking about redesigning the solution and did some tests. Now the nRF51 sleeps (0.5 uA) until a button is pressed. Then it wakes up, starts advertising, Android connects to it, reads the information and ends the communication as quick as possible so the nRF51 sleeps again. Do you think it&amp;#39;s a valid solution?
It kind of worked, but Android does not find the device as quick as one would expect and the system has a 1-2 seconds latency, but that&amp;#39;s Android&amp;#39;s fault...
Another solution I was thinking about is to use GAP or beacons directly to inform the central that an event occurred, but that would be broadcasting and the delivery wouldn&amp;#39;t be acknowledged, right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Button low power</title><link>https://devzone.nordicsemi.com/thread/30268?ContentTypeID=1</link><pubDate>Sat, 25 Jul 2015 11:27:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5b4cd50-19c9-4d01-b15c-ebea079c5290</guid><dc:creator>SebastianP</dc:creator><description>&lt;p&gt;Hello Petter,
Thank you very much for your inputs. I have expressed my self wrong: the mbed application starts advertising every 1 second, so it &amp;quot;sleeps&amp;quot; one second consuming 0.6 uA, then wakes up and have a spike when advertising and then sleeps again. That seems good enough to me.&lt;/p&gt;
&lt;p&gt;I think I will need more tools to figure out what&amp;#39;s happening: a sniffer to check the actual connection parameters and then a master device with a more flexible API than the native Android. I will try to build a simple application in Linux/Windows to have more control on the connection parameters and come back with the results.&lt;/p&gt;
&lt;p&gt;As you point in the last link, Android does have an API to update the connection parameters but it&amp;#39;s available since API 21 (Lollipop) and my device runs 19 (KitKat)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Button low power</title><link>https://devzone.nordicsemi.com/thread/30267?ContentTypeID=1</link><pubDate>Fri, 24 Jul 2015 13:48:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3833052c-1a5d-4e2e-91ba-d6e6795da817</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Welcome, great that you have your first application working.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The problem comes with the power
consumption: it&amp;#39;s around 0.60 uA when
advertising (which seems OK to me) and
rises to 160-200 uA when the device is
paired with the Android application.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I think there is something wrong with your measurements. 0.6 uA is only achievable when the chip is in SYSTEM OFF. You need to be in SYSTEM ON to advertise. Please see the nRF51422 product specification, available &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf51.v1.0.0/pdflinks/51422_ps.html?cp=2_4_0"&gt;here&lt;/a&gt;. Please see this blog for typical average current for advertising and connection.&lt;/p&gt;
&lt;p&gt;160-200 uA could be correct, depends on a lot of parameters as you can see in the blog.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I wonder if there is a way to drop
that consumption when the device is
connected to lower values as it seems
to be pretty high to me.&lt;/p&gt;
&lt;p&gt;Is there a way to configure the device
to sleep as much as possible, while
keeping the communication channel open
and wake up only to send the
notification? Should that
configuration be done in the Android
part or in the nRF51 code?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The maximum is connection interval is per Bluetooth specification 4 seconds. In addition you can reduce the number of connetion events in the peripheral by using slave latency. The rest of the time you can sleep.&lt;/p&gt;
&lt;p&gt;Please see Vol 6, Part B, Section 4.5.1 in the Bluetooth Core specification v4.2 for more information.&lt;/p&gt;
&lt;p&gt;The initial connection parameters are determined by the central/master (Android), these are included in the connection request sent to the peripheral/slave. The connection parameters can be changed if the master sends a connection parameter update. The slave can send a ask the master to change the connection parameters by sending a connection parameter request.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I have tried by reducing the latency
but I did not get any changes. Maybe I
need to change something on the
Android application? Should these
parameters be changed before starting
the advertisement or when the device
has been connected?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;setPreferredConnectionParams() only sets the Preferred Connection Parameters in the Peripheral Preferred Connection Parameters (PPCP) characteristic. The master can use these values when/if it wants to update the connection parameters.&lt;/p&gt;
&lt;p&gt;It seems you are only using current measurements to test this? I recommend you to use a debugger or a sniffer to figure out what the connection interval actually is, if connection parameters updates are actually performed and so on.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not an expert on Android, but it seems you can set connection priority, please see &lt;a href="https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html"&gt;this&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Button low power</title><link>https://devzone.nordicsemi.com/thread/30265?ContentTypeID=1</link><pubDate>Thu, 23 Jul 2015 23:38:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50e97db2-f1c2-46d1-afb8-1a60d948e587</guid><dc:creator>Locky</dc:creator><description>&lt;p&gt;A couple things to check:
What are your Interval settings min and max set to?&lt;br /&gt;
Do you specify a preferred initial connection parameter?
If a connection parameter update fails do your have retries?&lt;/p&gt;
&lt;p&gt;A few things to note: 1)  Android typically only allows one connection parameter update per connection.  So make sure you don&amp;#39;t send a preferred connection parameter.  Also make sure that the parameters you are specifying are acceptable to the device.  There is an Apple Developer Guide which is also a good rule of thumb for setting connection parameters on Android.&lt;/p&gt;
&lt;p&gt;-K&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>