<?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 Battery level is always 100?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/6278/why-battery-level-is-always-100</link><description>static void adc_init(void) 
 { 
 /* Enable interrupt on ADC sample ready event*/ 

NRF_ADC-&amp;gt;INTENSET = ADC_INTENSET_END_Msk; 

sd_nvic_SetPriority(ADC_IRQn, NRF_APP_PRIORITY_LOW); 

sd_nvic_EnableIRQ(ADC_IRQn);

NRF_ADC-&amp;gt;CONFIG	= (ADC_CONFIG_EXTREFSEL_None</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 30 Mar 2015 13:09:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/6278/why-battery-level-is-always-100" /><item><title>RE: Why Battery level is always 100?</title><link>https://devzone.nordicsemi.com/thread/21938?ContentTypeID=1</link><pubDate>Mon, 30 Mar 2015 13:09:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:028806ab-990f-44b7-87f6-ec381d80b2d6</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;You wrote in a comment to Mango922:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;but I need a voltage higher than 4.5V&lt;/p&gt;
&lt;p&gt;If I need a voltage higher than 4.5V,
Will always get 100 results?&lt;/p&gt;
&lt;p&gt;Result of My source is always 1023.
(ADC 10bit)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Please read section &lt;strong&gt;31.1.1 Set input voltage range&lt;/strong&gt; in the nRF51 Series Reference manual. Here it is written:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;There are two rules to follow to find
the maximum input voltage allowed on
the AIN pins:&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;The ADC should not be exposed to higher voltage than 2.4 V on an AIN
pin after prescaling: Input voltage x
prescaling = max. 2.4 V. 31 Analog to
Digital Converter (ADC) Page 166&lt;/li&gt;
&lt;li&gt;A GPIO pin must not be exposed to higher voltage than VDD + 0.3 V,
according to the Absolute maximum
ratings from the nRF51x22 Product
Specification.&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;p&gt;Also please read section &lt;strong&gt;31.1.2 Using a voltage divider to lower voltage.&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why Battery level is always 100?</title><link>https://devzone.nordicsemi.com/thread/21941?ContentTypeID=1</link><pubDate>Mon, 30 Mar 2015 07:03:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1162efdc-b241-44a8-900d-b32ec315b21b</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;Hi, since I do not know your schematic, my answer could not satisfy you.&lt;/p&gt;
&lt;p&gt;Aren&amp;#39;t you using voltage regulator? The supply voltage should be 1.8~3.6V to the MCU (ref. nRF51822_PS v3.1).&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll make a guess that you are using 5V battery for your OLED and this battery is also an input for a&lt;/p&gt;
&lt;p&gt;3.3V regulator. Then always, the result will be 100 percent&lt;/p&gt;
&lt;p&gt;if you have inserted 5V (or 4.5V) to the ADC input.&lt;/p&gt;
&lt;p&gt;One more thing, I don&amp;#39;t know why you are mentioning about PSEL.&lt;/p&gt;
&lt;p&gt;If you are not using the Nordic&amp;#39;s SDK and coding by yourself and setting all the registers, I hope you&lt;/p&gt;
&lt;p&gt;should look at the datasheet (nRF51_Series_Reference_manual v3.0) .&lt;/p&gt;
&lt;p&gt;However, looks like you are using the API and the example codes right?&lt;/p&gt;
&lt;p&gt;Then I think there doesn&amp;#39;t need many editing the code above.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why Battery level is always 100?</title><link>https://devzone.nordicsemi.com/thread/21940?ContentTypeID=1</link><pubDate>Mon, 30 Mar 2015 06:40:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca7b9f89-cd85-41ad-9267-3b4bdef75755</guid><dc:creator>GunMin</dc:creator><description>&lt;p&gt;Thank you for reply, Mango922&lt;/p&gt;
&lt;p&gt;Good.  Thanks understood to.&lt;/p&gt;
&lt;p&gt;but I need a voltage higher than 4.5V&lt;/p&gt;
&lt;p&gt;If I need a voltage higher than 4.5V, Will always get 100 results?&lt;/p&gt;
&lt;p&gt;Result of My source is always 1023.  (ADC 10bit)&lt;/p&gt;
&lt;p&gt;In this case, Do I need to use the PSEL??&lt;/p&gt;
&lt;p&gt;or PSEL also did the same results?&lt;/p&gt;
&lt;p&gt;3V is enough order to operate the nrf51822.&lt;/p&gt;
&lt;p&gt;But I uses the OLED, the OLED fit a lack of action.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Why Battery level is always 100?</title><link>https://devzone.nordicsemi.com/thread/21939?ContentTypeID=1</link><pubDate>Mon, 30 Mar 2015 05:04:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ea4caf3-216f-40b0-998e-1df5250aea31</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;Hi, I think this depends on what battery you are using.&lt;/p&gt;
&lt;p&gt;If you see app_util.h, you&amp;#39;ll see this block reference.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/** @brief Function for converting the input voltage (in milli volts) into percentage of 3.0 Volts.

*
*  @details The calculation is based on a linearized version of the battery&amp;#39;s discharge
*           curve. 3.0V returns 100% battery level. The limit for power failure is 2.1V and
*           is considered to be the lower boundary.
*
*           The discharge curve for CR2032 is non-linear. In this model it is split into
*           4 linear sections:
*           - 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)
*
*           These numbers are by no means accurate. Temperature and
*           load in the actual application is not accounted for!
*
*  @param[in] mvolts The voltage in mV
*
*  @return    Battery level in percent.
*/
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As you see, the function&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static __INLINE uint8_t battery_level_in_percent(const uint16_t mvolts)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;returns results following the reference. The CR2032 is a coin cell.&lt;/p&gt;
&lt;p&gt;So if you use other batteries, the result would be quite different.&lt;/p&gt;
&lt;p&gt;In my case, I use a custom board attaching two AA batteries in series.&lt;/p&gt;
&lt;p&gt;So I also get 100% most of the time, unless the battery level has decreased dramatically.&lt;/p&gt;
&lt;p&gt;So in short,&lt;/p&gt;
&lt;p&gt;the program doesn&amp;#39;t have problem. This depends on what battery you use.&lt;/p&gt;
&lt;p&gt;If you want to see the percentage drop from any Nordic App,&lt;/p&gt;
&lt;p&gt;how about connecting your kit or board to the power supply and switch the voltage level?&lt;/p&gt;
&lt;p&gt;Then you&amp;#39;ll see the level dropping.&lt;/p&gt;
&lt;p&gt;-Regards, Mango922&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>