<?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>why proximity example shows always 100 battery</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10919/why-proximity-example-shows-always-100-battery</link><description>Hello, 
 I am trying to make battery service in my application so i refer the proximity example in SDK 9 and i flashed into my kit it showing always 100percent in the nordic app what needs to be done inorder t monitor the exact battery voltage interms</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 09 Feb 2016 10:15:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10919/why-proximity-example-shows-always-100-battery" /><item><title>RE: why proximity example shows always 100 battery</title><link>https://devzone.nordicsemi.com/thread/40811?ContentTypeID=1</link><pubDate>Tue, 09 Feb 2016 10:15:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19ff7dba-36ed-47d4-b1c1-c6027546a7ed</guid><dc:creator>karan</dc:creator><description>&lt;p&gt;i found that my battery is providing only 3.18V so no way to excced the power supply more than 3.18v from the ADC is there is any other modifications do i ahve to check out?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why proximity example shows always 100 battery</title><link>https://devzone.nordicsemi.com/thread/40812?ContentTypeID=1</link><pubDate>Fri, 18 Dec 2015 13:49:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fce4b3b9-9a75-4b7d-bf7d-327a66ab0929</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;The problem is actually with the battery_level_in_percent(..) function. The battery level characteristic value is the percent capacity that is left in the battery. 100 percent means fully charged, 0 percent means fully discharged, see &lt;a href="https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml"&gt;here&lt;/a&gt;. The function calculates the percent from the non-linear discharge curve of a CR2032 battery:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; *           - Section 1: 3.0V - 2.9V = 100% - 42% (58% drop on 100 mV)
 *           - Section 2: 2.9V - 2.74V = 42% - 18% (24% drop on 160 mV)
 *           - Section 3: 2.74V - 2.44V = 18% - 6% (12% drop on 300 mV)
 *           - Section 4: 2.44V - 2.1V = 6% - 0% (6% drop on 340 mV)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When running from usb power, the voltage is higher than 3V and the function will always show 100 percent. If you run it from a battery, the value will probably be less than 100 percent.&lt;/p&gt;
&lt;p&gt;Note also that the notification must be enabled (enable services in MCP) for the battery measurements to start (battery measurement timer is started in BLE_BAS_EVT_NOTIFICATION_ENABLED event) and that the default measurement period is 120 seconds, so the value will not be updated at once.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why proximity example shows always 100 battery</title><link>https://devzone.nordicsemi.com/thread/40810?ContentTypeID=1</link><pubDate>Thu, 17 Dec 2015 17:24:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c63e7815-6f31-4af3-bd5c-12e31355bd1e</guid><dc:creator>monpetit</dc:creator><description>&lt;p&gt;Well, I&amp;#39;m afraid I don&amp;#39;t know other ways. Here is a good document deals with measuring battery voltage: &lt;a href="https://devzone.nordicsemi.com/blogs/30/measuring-lithium-battery-voltage-with-voltage-div/"&gt;Measuring Lithium battery voltage with voltage divider&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why proximity example shows always 100 battery</title><link>https://devzone.nordicsemi.com/thread/40809?ContentTypeID=1</link><pubDate>Thu, 17 Dec 2015 16:56:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8a24f09-78c3-41ce-a0c3-8ca49a1786f3</guid><dc:creator>karan</dc:creator><description>&lt;p&gt;so it is mandatory to use only voltage dividers is there isany other ways to measure battery voltage?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why proximity example shows always 100 battery</title><link>https://devzone.nordicsemi.com/thread/40808?ContentTypeID=1</link><pubDate>Thu, 17 Dec 2015 15:36:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e10fd0de-f9f4-468c-9fb9-bd027422af45</guid><dc:creator>monpetit</dc:creator><description>&lt;p&gt;I see. Look at &lt;code&gt;adc_config.reference = NRF_ADC_CONFIG_REF_VBG;&lt;/code&gt; In this case, adc measurement range is from 0 to 3.6V. If battery voltage is exceeds 3.6V you have to use voltage divider with resistors.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why proximity example shows always 100 battery</title><link>https://devzone.nordicsemi.com/thread/40807?ContentTypeID=1</link><pubDate>Thu, 17 Dec 2015 15:24:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f452212-424a-4258-bbb0-e0d570d07f03</guid><dc:creator>karan</dc:creator><description>&lt;p&gt;Thanks for your reply but still in the nordic app am getting only 100 percent response and i have connected and tested with  battery and  usb power supply to see the measurementS am getting 100 only&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why proximity example shows always 100 battery</title><link>https://devzone.nordicsemi.com/thread/40806?ContentTypeID=1</link><pubDate>Thu, 17 Dec 2015 13:39:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e299e23-247d-4194-854c-99d665b14246</guid><dc:creator>monpetit</dc:creator><description>&lt;p&gt;Sorry for the confusion, it was my fault for using the example of SDK 10.0.0.&lt;/p&gt;
&lt;p&gt;You should use &lt;code&gt;void nrf_adc_input_select(nrf_adc_config_input_t input)&lt;/code&gt; before &lt;code&gt;nrf_adc_start()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void battery_level_meas_timeout_handler(void * p_context)
{
    UNUSED_PARAMETER(p_context);
    nrf_adc_input_select(NRF_ADC_CONFIG_INPUT_0);
    nrf_adc_start();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Happy coding... :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why proximity example shows always 100 battery</title><link>https://devzone.nordicsemi.com/thread/40805?ContentTypeID=1</link><pubDate>Thu, 17 Dec 2015 13:21:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:946ddc2c-7c98-4dc8-ac51-fc5e77245e1b</guid><dc:creator>karan</dc:creator><description>&lt;p&gt;can you tell me do i have add any information in the ADC configure function?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why proximity example shows always 100 battery</title><link>https://devzone.nordicsemi.com/thread/40804?ContentTypeID=1</link><pubDate>Thu, 17 Dec 2015 13:19:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd6c4f86-8bc3-4c81-91cd-15d55d734447</guid><dc:creator>karan</dc:creator><description>&lt;p&gt;i did not see any lines like that in the ADC configure function&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/**@brief Function for configuring ADC to do battery level conversion.
 */
static void adc_configure(void)
{
    uint32_t err_code;
    nrf_adc_config_t adc_config = NRF_ADC_CONFIG_DEFAULT;

    // Configure ADC
    adc_config.reference  = NRF_ADC_CONFIG_REF_VBG;
    adc_config.resolution = NRF_ADC_CONFIG_RES_8BIT;
    adc_config.scaling    = NRF_ADC_CONFIG_SCALING_SUPPLY_ONE_THIRD;
    nrf_adc_configure(&amp;amp;adc_config);

    // Enable ADC interrupt
    nrf_adc_int_enable(ADC_INTENSET_END_Msk);
    err_code = sd_nvic_ClearPendingIRQ(ADC_IRQn);
    APP_ERROR_CHECK(err_code);

    err_code = sd_nvic_SetPriority(ADC_IRQn, NRF_APP_PRIORITY_LOW);
    APP_ERROR_CHECK(err_code);

    err_code = sd_nvic_EnableIRQ(ADC_IRQn);
    APP_ERROR_CHECK(err_code);
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: why proximity example shows always 100 battery</title><link>https://devzone.nordicsemi.com/thread/40803?ContentTypeID=1</link><pubDate>Thu, 17 Dec 2015 12:01:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad09abdd-6ec0-4e55-9de4-b0d15aff8c3d</guid><dc:creator>monpetit</dc:creator><description>&lt;p&gt;Look at the code. It probably says like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void adc_configure(void)
{
    ...
    nrf_adc_input_select(NRF_ADC_CONFIG_INPUT_DISABLED);
    ...
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Change adc input pin to NRF_ADC_CONFIG_INPUT_0 ~ NRF_ADC_CONFIG_INPUT_7 properly and test again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>