<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-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>Nrf9160: Battery ADC measurement off by ~100 mv</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/86498/nrf9160-battery-adc-measurement-off-by-100-mv</link><description>I&amp;#39;m getting a strange amount of error when trying to measure the battery for a custom PCB based on the nrf9160. 
 Details 
 
 My VCC_IO is 1.8V 
 My max battery voltage is 4.2V 
 I am using a slightly modified version of the battery sample from zephyr</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Mon, 23 May 2022 14:55:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/86498/nrf9160-battery-adc-measurement-off-by-100-mv" /><item><title>RE: Nrf9160: Battery ADC measurement off by ~100 mv</title><link>https://test-devzone.nordicsemi.com/thread/369087?ContentTypeID=1</link><pubDate>Mon, 23 May 2022 14:55:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97297958-ba22-49c5-8d6f-cfd3657693cd</guid><dc:creator>user81959</dc:creator><description>&lt;p&gt;Sorry, I&amp;#39;m not sure I ever said that. Which response are you referring?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf9160: Battery ADC measurement off by ~100 mv</title><link>https://test-devzone.nordicsemi.com/thread/364834?ContentTypeID=1</link><pubDate>Tue, 26 Apr 2022 07:27:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eec7edd3-f36f-446e-94e7-12028380c1e4</guid><dc:creator>user26071</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Can you please specify what you mean by changing VDD from 1.8 to 3.6V? Do you mean toggling the switch on the DK, or do you do this from SW? Are you using a standard DK?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf9160: Battery ADC measurement off by ~100 mv</title><link>https://test-devzone.nordicsemi.com/thread/364745?ContentTypeID=1</link><pubDate>Mon, 25 Apr 2022 13:34:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9f1fde2-897d-43ae-b723-e61da8f5da02</guid><dc:creator>user81959</dc:creator><description>&lt;p&gt;The sample came from zephyr/samples/boards/nrf/battery and as you have already figured out, you need to add the necessary overlay.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf9160: Battery ADC measurement off by ~100 mv</title><link>https://test-devzone.nordicsemi.com/thread/364610?ContentTypeID=1</link><pubDate>Mon, 25 Apr 2022 07:34:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fde44884-9a5a-4f9e-b684-a6dab275c667</guid><dc:creator>user26071</dc:creator><description>&lt;p&gt;Edit:&lt;br /&gt;I added the an overlay file with the vbatt structure that you mentioned in your original post, and then it compiled. I&amp;#39;ll continue working on this.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf9160: Battery ADC measurement off by ~100 mv</title><link>https://test-devzone.nordicsemi.com/thread/364598?ContentTypeID=1</link><pubDate>Mon, 25 Apr 2022 07:04:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8dabcc87-f056-4ed2-b4a1-74a4b67fbfb1</guid><dc:creator>user26071</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Sorry for the late reply. It was a bit much to do the week after Easter.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I tried to build your project, but I got a lot of build errors.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Where did you find the sample with the vbatt module? And what board do you build it for? And does it need to be built from some specific location? Can you try to build it in an unmodified SDK to check that you didn&amp;#39;t change any SDK files that are outside the project folder?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf9160: Battery ADC measurement off by ~100 mv</title><link>https://test-devzone.nordicsemi.com/thread/364037?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2022 20:09:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ed209fa-563c-45bd-950d-a41b75030f8d</guid><dc:creator>user81959</dc:creator><description>&lt;p&gt;Any luck here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf9160: Battery ADC measurement off by ~100 mv</title><link>https://test-devzone.nordicsemi.com/thread/362829?ContentTypeID=1</link><pubDate>Mon, 11 Apr 2022 11:41:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9d133bc-7643-496f-9e4b-57303cb91fb8</guid><dc:creator>user26071</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am sorry for the late reply. We are vert short staffed during Easter Holidays, so I will have to see whether I can either get time to test this myself (with my limited nRF91 knowledge), or if I can find anyone else who can test it and try to reproduce what you are seeing.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Just wanted to let you know that this case is not forgotten. I will get back to you as soon as I can.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf9160: Battery ADC measurement off by ~100 mv</title><link>https://test-devzone.nordicsemi.com/thread/362359?ContentTypeID=1</link><pubDate>Thu, 07 Apr 2022 13:14:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45c2cf78-3ddc-4ab2-811b-31e74ff66c8a</guid><dc:creator>user81959</dc:creator><description>&lt;p&gt;&lt;a href="https://test-devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/battery_5F00_test.zip"&gt;test-devzone.nordicsemi.com/.../battery_5F00_test.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf9160: Battery ADC measurement off by ~100 mv</title><link>https://test-devzone.nordicsemi.com/thread/362276?ContentTypeID=1</link><pubDate>Thu, 07 Apr 2022 09:49:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d56cc958-46d6-4ea3-ad80-4116237df010</guid><dc:creator>user26071</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Is there some way for me to reproduce this? Can you please send me the application that you are using to test? I don&amp;#39;t have the exact voltage divider that you are using, but I can use a generator to generate the desired input voltage.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf9160: Battery ADC measurement off by ~100 mv</title><link>https://test-devzone.nordicsemi.com/thread/361899?ContentTypeID=1</link><pubDate>Tue, 05 Apr 2022 14:50:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee0bf312-440c-48ce-9ebb-3075cc61a3f2</guid><dc:creator>user81959</dc:creator><description>&lt;p&gt;Edvin,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for getting back to me, sorry for the delay.&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t seen any dips in the battery voltage when a measurement takes place. I will run tests again to verify.&lt;/p&gt;
&lt;p&gt;My 3.0V variant board is working as expected. I just measured a battery to be 4.098V with my DMM and the nrf9160 reports the voltage as 4.102V.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The resistors are 0.1% tolerance. I removed them from the board and measured their resistances. Note they are 0402, so my probing was a little wobbly and I only used&amp;nbsp;&lt;span&gt;&amp;Omega;2W.&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Spec 2000 Ohm = Measured ~1996 Ohm&lt;/li&gt;
&lt;li&gt;Spec 3010 Ohm = Measured ~3005 Ohm&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;My battery measurement logic came from the following sample app: &lt;em&gt;zephyr/samples/boards/nrf/battery.&amp;nbsp;&lt;/em&gt;If you are referring to the device tree node, that came from the readme of that sample.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would be happy to share my project. I&amp;#39;m currently using my production application to run these tests (which I cannot share publicly). I will try to replicate this behavior on the battery sample app and share it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;New Discovery: The nrf9160 has the ability to measure the battery voltage internally. I typically don&amp;#39;t use this feature because it first requires initializing the modem which uses more energy for my use case. Anyway, I put the device in a loop that measures the battery with my circuit and the internal circuit. The internal circuit was measuring the battery voltage with better&amp;nbsp;accuracy.&amp;nbsp;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Internal:&amp;nbsp;4109 [mv]&lt;/li&gt;
&lt;li&gt;External:&amp;nbsp;3972 [mv]&lt;/li&gt;
&lt;li&gt;Actual: 4088 [mv]&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf9160: Battery ADC measurement off by ~100 mv</title><link>https://test-devzone.nordicsemi.com/thread/361461?ContentTypeID=1</link><pubDate>Mon, 04 Apr 2022 10:16:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69de7de0-4f58-458e-965f-670528ec23a3</guid><dc:creator>user26071</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Since I see that you have an oscilloscope, do you see a dip in the voltage measured on the pin when you try to read out the voltage using the nRF9160?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And you say that the issue is not present when you use the VDD_IO = 3.0V, is that correct?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="sheldon_b"]The ADC readout from&amp;nbsp;adc_raw_to_millivolts() is 1409 mv.[/quote]
&lt;p&gt;What does this event look like, and what are the corresponding parameters?&lt;/p&gt;
[quote user="sheldon_b"]This results in the measured voltage to be 3529 mv[/quote]
&lt;p&gt;That is 1409 * 5010 ohm/2000 ohm, right? What accuracy do you have on your R1 and R2? Did you measure them yourself?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am not familiar with the details, but where did you find the vbatt config? Is that from the thingy52 sample?&lt;/p&gt;
&lt;p&gt;Is it possible to zip the project so that I can have a look?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf9160: Battery ADC measurement off by ~100 mv</title><link>https://test-devzone.nordicsemi.com/thread/361276?ContentTypeID=1</link><pubDate>Fri, 01 Apr 2022 15:02:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bfd8ee4d-eb12-4371-ae66-6a6737d4891e</guid><dc:creator>user81959</dc:creator><description>&lt;p&gt;Sorry for the confusion, let me try again. There was a typo: 145 mv should actually be 1450 mv. Here are some new measurements from today:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The voltage I&amp;#39;m trying to measure is&amp;nbsp;&lt;span&gt;3634&amp;nbsp;mv.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;The ADC GPIO voltage going into the nrf9160 is&amp;nbsp;measuring&amp;nbsp;&lt;span&gt;1442 mv.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;The ADC readout from&amp;nbsp;adc_raw_to_millivolts() is 1409 mv.&lt;/li&gt;
&lt;li&gt;This results in the measured voltage to be 3529 mv (Off by 105 mv)&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf9160: Battery ADC measurement off by ~100 mv</title><link>https://test-devzone.nordicsemi.com/thread/361240?ContentTypeID=1</link><pubDate>Fri, 01 Apr 2022 12:59:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c28c60eb-7925-4dc4-8e0c-4c20ec7dfa16</guid><dc:creator>user26071</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am a bit confused regarding what I am looking at.&lt;/p&gt;
[quote user=""]An analog value of 145 mv&amp;nbsp;should result in a value of around 3630 mv to be reported from the device.[/quote]
&lt;p&gt;Is this a typo? 145mV should be 145mV*3*(5/2) = 1087mV, right?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Can you please explain to me what your input value is (what you are measuring), and please try to measure the voltage on the ADC GPIO. What is that compared to what you are reading out from your ADC?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>