<?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>nrf52832 battery measurement</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/79703/nrf52832-battery-measurement</link><description>Hi, I am trying to update the battery level through an example of the HID keyboard of nrf52832.I&amp;#39;m trying to connect 3.3V battery to SAADC AIN0, but as shown in the picture above, the Bluetooth screen keeps saying 0%. Is there a problem with my code?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 16 Sep 2021 09:58:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/79703/nrf52832-battery-measurement" /><item><title>RE: nrf52832 battery measurement</title><link>https://devzone.nordicsemi.com/thread/329780?ContentTypeID=1</link><pubDate>Thu, 16 Sep 2021 09:58:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9326c2eb-4ccb-43ee-80d7-dc6d0ff35968</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user=""]I&amp;#39;m trying to connect 3.3V battery to SAADC AIN0[/quote][quote user=""]The (+) portion of the battery holder was connected to the board GPIO P0.02.[/quote]
&lt;p&gt;If you are working with &lt;a href="https://infocenter.nordicsemi.com/topic/ug_nrf52832_dk/UG/nrf52_DK/hw_power_sup.html"&gt;a nRF52 DK then powering your device from a battery the supply will be unregulated&lt;/a&gt;, so you could instead &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fsaadc.html&amp;amp;anchor=saadc_inputs"&gt;have the SAADC sample the VDD bus directly&lt;/a&gt;, instead of going the route through P0.02.&lt;/p&gt;
[quote user=""]but as shown in the picture above, the Bluetooth screen keeps saying 0%.[/quote]
&lt;p&gt;What values does your SAADC sample, and how do you convert them to a percentage of remaining charge?&lt;br /&gt;If you connect to the device using nRF Connect for Desktop, what is the value the is device sending through the Battery Service?&lt;br /&gt;The function for converting voltage to a battery percentage that exists in the SDK is made for a coincell battery, so it can not be used with any other battery. You will then have to create this mapping yourself, based on the discharge curve of the specific batteries you are working with. You will find this discharge curve in the batteries datasheet.&lt;br /&gt;&lt;br /&gt;I suspect that the output of the SAADC is not being handled correctly, and thus the Battery Service indicates 0.&lt;br /&gt;Could you share more of your code, specifically the part where you process your SAADC samples and use them to update the Battery Service?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>