<?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>How can I read out the actual value of the power supply, using the low power comparator?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/49186/how-can-i-read-out-the-actual-value-of-the-power-supply-using-the-low-power-comparator</link><description>Dear all, 
 
 I need to read out the voltage of the battery that supplies my nrf52. From what I have read I see that there are 2 options: LPCOMP and ADC. 
 
 Due to restrictions that I have because of my hardware, I cannot add any exteranl components</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 01 Jul 2019 13:17:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/49186/how-can-i-read-out-the-actual-value-of-the-power-supply-using-the-low-power-comparator" /><item><title>RE: How can I read out the actual value of the power supply, using the low power comparator?</title><link>https://devzone.nordicsemi.com/thread/195665?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 13:17:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e6e93db-2764-49a5-bab0-4eb12bc94462</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Check the &lt;strong&gt;Product Specification&lt;/strong&gt; for the actual limit (which is also related to VDD) - as long as you don&amp;#39;t exceed that, you&amp;#39;re OK.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You may also need to adjust the ADC gain so as not to exceed its internal input range&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I read out the actual value of the power supply, using the low power comparator?</title><link>https://devzone.nordicsemi.com/thread/195662?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 13:11:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7fa992b-744b-471b-8c4e-1f0d8179dfd1</guid><dc:creator>Giannis Anastasopoulos</dc:creator><description>&lt;p&gt;So, from what I understand, I can simply read the voltage directly from the pin, without any voltage divider, as long as my supplied voltage is less than 3.3V, correct?&lt;/p&gt;
&lt;div id="simple-translate"&gt;
&lt;div&gt;
&lt;div class="simple-translate-button " style="height:22px;left:10px;top:10px;width:22px;"&gt;&lt;/div&gt;
&lt;div class="simple-translate-panel " style="background-color:#ffffff;font-size:13px;height:200px;left:0px;top:0px;width:300px;"&gt;
&lt;div class="simple-translate-result-wrapper" style="overflow:hidden;"&gt;
&lt;p class="simple-translate-result" style="color:#000000;"&gt;&lt;/p&gt;
&lt;p class="simple-translate-candidate" style="color:#737373;"&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I read out the actual value of the power supply, using the low power comparator?</title><link>https://devzone.nordicsemi.com/thread/195649?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 12:53:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:826870ca-cd75-4407-a263-bbd414213bca</guid><dc:creator>awneil</dc:creator><description>[quote userid="80274" url="~/f/nordic-q-a/49186/how-can-i-read-out-the-actual-value-of-the-power-supply-using-the-low-power-comparator"]I don&amp;#39;t see how to actually read out the value[/quote]
&lt;p&gt;The &amp;quot;LPCOMP&amp;quot; is a &lt;em&gt;&lt;strong&gt;comparator&lt;/strong&gt;&lt;/em&gt; - so it does not give you a &amp;quot;read out of the voltage&amp;quot;&lt;/p&gt;
&lt;p&gt;A &lt;em&gt;comparator&lt;/em&gt; just tells you that the input is above or below the reference.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="80274" url="~/f/nordic-q-a/49186/how-can-i-read-out-the-actual-value-of-the-power-supply-using-the-low-power-comparator"]I cannot add any exteranl components in order to add the voltage divider.[/quote]
&lt;p&gt;If your battery voltage exceeds the allowable input pin voltage, then you will still need a divider - whether you use the comparator or the ADC&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I read out the actual value of the power supply, using the low power comparator?</title><link>https://devzone.nordicsemi.com/thread/195634?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 12:31:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17d9e792-2036-423b-8d7b-93c05cb65727</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]I have checked the SDK example, but I don&amp;#39;t see how to actually read out the value[/quote]
&lt;p&gt;What example did you look at? The&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/ble_sdk_app_proximity.html?resultof=%22%50%72%6f%78%69%6d%69%74%79%22%20%22%70%72%6f%78%69%6d%22%20%22%41%70%70%6c%69%63%61%74%69%6f%6e%22%20%22%61%70%70%6c%69%63%22%20"&gt;Proximity Application&lt;/a&gt;&amp;nbsp;(examples\ble_peripheral\ble_app_proximity) measures the battery level every 2 minutes using ADC.&amp;nbsp;&lt;span&gt;If there is a change in the &lt;/span&gt;battery&lt;span&gt; level, the application sends the current level as a notification.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**@brief Function for handling the ADC interrupt.
 *
 * @details  This function will fetch the conversion result from the ADC, convert the value into
 *           percentage and send it to peer.
 */
void saadc_event_handler(nrf_drv_saadc_evt_t const * p_event)
{
    if (p_event-&amp;gt;type == NRF_DRV_SAADC_EVT_DONE)
    {
        nrf_saadc_value_t adc_result;
        uint16_t          batt_lvl_in_milli_volts;
        uint8_t           percentage_batt_lvl;
        uint32_t          err_code;

        adc_result = p_event-&amp;gt;data.done.p_buffer[0];

        err_code = nrf_drv_saadc_buffer_convert(p_event-&amp;gt;data.done.p_buffer, 1);
        APP_ERROR_CHECK(err_code);

        batt_lvl_in_milli_volts = ADC_RESULT_IN_MILLI_VOLTS(adc_result) +
                                  DIODE_FWD_VOLT_DROP_MILLIVOLTS;
        percentage_batt_lvl = battery_level_in_percent(batt_lvl_in_milli_volts);

        err_code = ble_bas_battery_level_update(&amp;amp;m_bas, percentage_batt_lvl, BLE_CONN_HANDLE_ALL);
        if ((err_code != NRF_SUCCESS) &amp;amp;&amp;amp;
            (err_code != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp;
            (err_code != NRF_ERROR_RESOURCES) &amp;amp;&amp;amp;
            (err_code != NRF_ERROR_BUSY) &amp;amp;&amp;amp;
            (err_code != BLE_ERROR_GATTS_SYS_ATTR_MISSING)
           )
        {
            APP_ERROR_HANDLER(err_code);
        }
    }
}
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Hope this helps.&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>