<?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>Measuring Vbat (2xAAA cell) with nRF52</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22496/measuring-vbat-2xaaa-cell-with-nrf52</link><description>Hello,
I tryed to find in Q&amp;amp;A something that can help me understand how it is possible to measure battery voltage with nRF52, but i am not sure i found the exact explanations.
I am using primary 2xAAA cell (meaning 3v when fresh and it is going low</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 04 Jun 2017 06:46:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22496/measuring-vbat-2xaaa-cell-with-nrf52" /><item><title>RE: Measuring Vbat (2xAAA cell) with nRF52</title><link>https://devzone.nordicsemi.com/thread/88516?ContentTypeID=1</link><pubDate>Sun, 04 Jun 2017 06:46:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:083d40ee-100c-4a59-bab4-a6cd3ba64992</guid><dc:creator>yulya</dc:creator><description>&lt;p&gt;thank you for the code info, i&amp;#39;ll pass it to our firmware guy. My question initially was regarding hardware points.
thank you for help.
By the way i read the chapter on SAADC in spec before i published my question.
thanks anyway.
BR,
Yulya&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Measuring Vbat (2xAAA cell) with nRF52</title><link>https://devzone.nordicsemi.com/thread/88515?ContentTypeID=1</link><pubDate>Thu, 01 Jun 2017 23:13:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00714625-0bb7-43c4-bc89-078eba060ebe</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;Sorry that the pagination is a little weird.  Sometimes the code formats oddly on this website.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Measuring Vbat (2xAAA cell) with nRF52</title><link>https://devzone.nordicsemi.com/thread/88514?ContentTypeID=1</link><pubDate>Thu, 01 Jun 2017 17:17:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b61e61a2-b5f9-45de-9de7-2fc3e9e44089</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;Finally this is the handler that you will trigger on an app timer to get the battery level.  The callback handler is the bit above here:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void bat_timer_handler(void * p_context)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;{
UNUSED_PARAMETER(p_context);
saadc_init();
nrf_drv_saadc_sample();
}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Measuring Vbat (2xAAA cell) with nRF52</title><link>https://devzone.nordicsemi.com/thread/88513?ContentTypeID=1</link><pubDate>Thu, 01 Jun 2017 17:12:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1a4e0b3-71ec-4093-be72-debeb8524a4c</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;This is the handler:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;volatile uint8_t state = 1;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;static nrf_saadc_value_t       m_buffer_pool[2][SAMPLES_IN_BUFFER];&lt;/p&gt;
&lt;p&gt;void saadc_callback(nrf_drv_saadc_evt_t const * p_event)
{
uint32_t bat_level;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if (p_event-&amp;gt;type == NRF_DRV_SAADC_EVT_DONE)
{
    ret_code_t err_code;
    err_code = nrf_drv_saadc_buffer_convert(p_event-&amp;gt;data.done.p_buffer, SAMPLES_IN_BUFFER);
    APP_ERROR_CHECK(err_code);

    for (int i = 0; i &amp;lt; SAMPLES_IN_BUFFER; i++)
    {
				bat_level = p_event-&amp;gt;data.done.p_buffer[i]&amp;gt;&amp;gt;2;
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;//At this point your battery level is captured in bat_level. You can do whatever you want with it now			&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_drv_saadc_uninit(); //Turns off SAADC
    NRF_SAADC-&amp;gt;INTENCLR = (SAADC_INTENCLR_END_Clear &amp;lt;&amp;lt; SAADC_INTENCLR_END_Pos);
    NVIC_ClearPendingIRQ(SAADC_IRQn);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Measuring Vbat (2xAAA cell) with nRF52</title><link>https://devzone.nordicsemi.com/thread/88512?ContentTypeID=1</link><pubDate>Thu, 01 Jun 2017 17:10:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23646f4c-54c6-436d-9c47-1effd89fb1d0</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;Here is all the code you need to measure Vdd.  It is up to you how you want to configure the app timer.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;quot;nrf_drv_saadc.h&amp;quot;
void saadc_init(void)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;{
ret_code_t err_code;
nrf_saadc_channel_config_t channel_config =
NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_VDD);
err_code = nrf_drv_saadc_init(NULL, saadc_callback);
APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;err_code = nrf_drv_saadc_channel_init(0, &amp;amp;channel_config);
APP_ERROR_CHECK(err_code);

err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[0],SAMPLES_IN_BUFFER);
APP_ERROR_CHECK(err_code);

err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[1],SAMPLES_IN_BUFFER);
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Measuring Vbat (2xAAA cell) with nRF52</title><link>https://devzone.nordicsemi.com/thread/88511?ContentTypeID=1</link><pubDate>Thu, 01 Jun 2017 16:49:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88eedad1-5801-401b-93df-e9a82db94b60</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;Here is the section of the product spec discussing the SAADC: &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fsaadc.html&amp;amp;cp=2_2_0_36&amp;amp;anchor=saadc_frontpage"&gt;infocenter.nordicsemi.com/index.jsp&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Measuring Vbat (2xAAA cell) with nRF52</title><link>https://devzone.nordicsemi.com/thread/88510?ContentTypeID=1</link><pubDate>Thu, 01 Jun 2017 16:49:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd5475c2-8a97-4750-b742-0d76a79b50e0</guid><dc:creator>yulya</dc:creator><description>&lt;p&gt;HI,
I didn&amp;#39;t intend to use nFR with 1.6v operating voltage. I know the limitations. As i said we will stop system operation at 2v (there are other components that limits the operation).
and i read the section about SAADC in spec.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Measuring Vbat (2xAAA cell) with nRF52</title><link>https://devzone.nordicsemi.com/thread/88509?ContentTypeID=1</link><pubDate>Thu, 01 Jun 2017 16:38:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0801d19-d336-43a1-b9af-ad23efa6d351</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;Well, not really sure where you are looking and not finding the info.&lt;br /&gt;
This search alone brought up 226 answered questions on measuring battery voltage. &lt;a href="https://devzone.nordicsemi.com/questions/scope:all/sort:relevance-desc/page:1/query:measure%20battery/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;But to answer it again, no you do not need additional hardware to measure Vdd.  The SAADC can be configured through its registers to measure Vdd internally. See the nRF product spec in the SAADC section on how to configure this. The SAADC uses system voltage 1.3V as Vref. It has an internal prescaler to put voltages above Vref within its fullscale range.&lt;/p&gt;
&lt;p&gt;With regard to operating at 1.6V, this is prohibited by the nRF.  Vdd below 1.7V triggers a brownout reset. Refer to the power supply section of the nRF product spec for info on brownout behavior.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Measuring Vbat (2xAAA cell) with nRF52</title><link>https://devzone.nordicsemi.com/thread/88508?ContentTypeID=1</link><pubDate>Thu, 01 Jun 2017 16:04:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17684f1c-5123-4530-8320-a4ede329f7c4</guid><dc:creator>yulya</dc:creator><description>&lt;p&gt;I did this before i published my questions!
if i would find the right answer, i wouldn&amp;#39;t ask my question.
there are no dozens of answers - there are around 3 by the way.&lt;/p&gt;
&lt;p&gt;I hope someone here can help with specific answer.
thank you
yulya&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Measuring Vbat (2xAAA cell) with nRF52</title><link>https://devzone.nordicsemi.com/thread/88507?ContentTypeID=1</link><pubDate>Thu, 01 Jun 2017 15:00:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b452038-40c7-4f09-af14-b4ddba7a3dad</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;Just search in this blog for measuring battery voltage with saadc. There are literally dozens of answers and examples.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>