<?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>Get battery level when BLE is connected</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/12612/get-battery-level-when-ble-is-connected</link><description>Hi, 
 I have to check every 10 minutes the battery level when BLE is connected . 
 I have found in this forum this source : github.com/.../main.c 
 As the source date is 2014-07-25, can you confirm that it is still the right way to check battery level</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 18 Mar 2016 10:09:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/12612/get-battery-level-when-ble-is-connected" /><item><title>RE: Get battery level when BLE is connected</title><link>https://devzone.nordicsemi.com/thread/47876?ContentTypeID=1</link><pubDate>Fri, 18 Mar 2016 10:09:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b7fe318-6b0f-4923-bd13-fa0f70e6ab5d</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Depending on the battery the voltage may drop a lot when the current goes up due to internal resistance in the battery. If the sample happens while the radio is on the measurements may be different than if the sample happens when the radio is off. &lt;a href="https://devzone.nordicsemi.com/question/58014/why-vsupply-measurement-is-inaccurate-in-nrf51/"&gt;Here&lt;/a&gt; is another post regarding this (voltage drops due to CPU is on, ~5mA). You can log the voltage with an oscilloscope to see if this is the case. To measure while the radio is inactive you can use &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s130.sds.v1.0/dita/softdevices/s130/concurrent_multiprotocol_tsl_api/concurrent_multiprotocol_tsl_api.html?cp=2_7_2_0_8"&gt;timeslot&lt;/a&gt;, see &lt;a href="https://devzone.nordicsemi.com/tutorials/16"&gt;this tutorial&lt;/a&gt; on how to use it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get battery level when BLE is connected</title><link>https://devzone.nordicsemi.com/thread/47875?ContentTypeID=1</link><pubDate>Thu, 17 Mar 2016 16:16:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:042065df-a504-4c7c-b8cc-e8ad0c812214</guid><dc:creator>S&amp;#233;bastien Despont</dc:creator><description>&lt;p&gt;Thanks for your answer.&lt;/p&gt;
&lt;p&gt;I need a battery level update every 10 minutes when peripheral is connected in order to transmit the value to a smartphone. I asked this question because when the BLE is connected, I get ADC results with big differences: battery = 66%, 10 minutes later 77%, then 62% and so on.&lt;/p&gt;
&lt;p&gt;My thought was that to obtain precise results, the ADC check must be done when there is no others power consumers like radio for data exchange for example.&lt;/p&gt;
&lt;p&gt;If I understand well your answer, ADC measurements can be done with or without BLE connected, during data exchange or not without any consequence to the result. Is that right? If yes, the problem could be on my side with power consumer not disable during the ADC measurement.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Get battery level when BLE is connected</title><link>https://devzone.nordicsemi.com/thread/47874?ContentTypeID=1</link><pubDate>Thu, 17 Mar 2016 10:16:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2308cbe-bc1f-411c-9f91-cfbbcf26a17d</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;The code should work as it is using the registers directly and not a SDK driver. To measure VDD (which is often connected straight to the battery) you can change the INPSEL to SupplyOneThirdPrescaling (and PSEL can be disgarded). This will make the ADC able to measure up to 3.6V, see &lt;a href="https://devzone.nordicsemi.com/question/102/what-voltage-range-can-be-measured-with-the-adc/?answer=103#post-id-103"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_ADC-&amp;gt;CONFIG = (ADC_CONFIG_EXTREFSEL_None &amp;lt;&amp;lt; ADC_CONFIG_EXTREFSEL_Pos)
                | (ADC_CONFIG_PSEL_Disabled &amp;lt;&amp;lt; ADC_CONFIG_PSEL_Pos)
                | (ADC_CONFIG_REFSEL_VBG &amp;lt;&amp;lt; ADC_CONFIG_REFSEL_Pos)
                | (ADC_CONFIG_INPSEL_SupplyOneThirdPrescaling &amp;lt;&amp;lt; ADC_CONFIG_INPSEL_Pos)
                | (ADC_CONFIG_RES_8bit &amp;lt;&amp;lt; ADC_CONFIG_RES_Pos);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Starting the HFCLK is not absolutely necessary. It will add some accuracy, but will also add a delay in your code equal to the startup time of the crystal, so the current consumption will be a little more.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>