<?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>nrf 51822 IO values not as expected</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16366/nrf-51822-io-values-not-as-expected</link><description>Good morning all, 
 We have a circuit based on 51822 chip. 
 We are currently trying to monitor some value from 0v to 24v from the analog inputs.
It&amp;#39;s working, however, we have found 2 issues. 
 
 
 The values we get are between 74 (0V) and 496</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 16 Sep 2016 02:54:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16366/nrf-51822-io-values-not-as-expected" /><item><title>RE: nrf 51822 IO values not as expected</title><link>https://devzone.nordicsemi.com/thread/62633?ContentTypeID=1</link><pubDate>Fri, 16 Sep 2016 02:54:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c053945-240b-461e-a198-4ecfabbb8d5f</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Very good.&lt;/p&gt;
&lt;p&gt;The values for the ADC internal resistors are documented in table 313 in the nRF51 Series Reference Manual v3.0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf 51822 IO values not as expected</title><link>https://devzone.nordicsemi.com/thread/62632?ContentTypeID=1</link><pubDate>Thu, 15 Sep 2016 19:54:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a81a66a-16cb-4eb8-8b52-d8eec880d281</guid><dc:creator>Francois</dc:creator><description>&lt;p&gt;Amazing answer! Thank you.&lt;/p&gt;
&lt;p&gt;I guess there is something missing as the value I get today with no capacitor and the voltage divider does not correspond to what is in your file. Are you sure about ADC resistance value?&lt;/p&gt;
&lt;p&gt;I will try with a very big one (425nf) as I don&amp;#39;t need high level of reactivity.
Will try other value on test board.&lt;/p&gt;
&lt;p&gt;Thanks again, will keep you informed.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Francois&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf 51822 IO values not as expected</title><link>https://devzone.nordicsemi.com/thread/62631?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2016 22:29:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a1938d3-9df3-4dce-952a-e21b8065d6ff</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi Fransois&lt;/p&gt;
&lt;p&gt;By inserting a few extra numbers into your excel sheet, you should be seeing value ~819 on the ADC output (10-bit, 1/3 prescaler) when inserting 20V into a 2200k/370k voltage divider and with adequately large capacitor connected in the circuit and slow sampling frequency (&amp;lt;0.5Hz). According to the calculation, the capacitor should be ~1uF.&lt;/p&gt;
&lt;p&gt;To be honest, I was not completely satified with the calculation result in the pdf document. I was fairly confident with the theory and the equations, but the result was 70nF, but in practice we found that 22nF was adequate. So there is perhaps something that I have not taken into account, but I think this still gives a good idea about the size.&lt;/p&gt;
&lt;p&gt;You can verify the capacitor size with trial and error method. First do the calculation and install that capacitor that you have calculated and test the ADC output with small sampling frequency, e.g. 0.5 Hz. Step 2 is to install a capacitor double that size. If you get the same ADC output as before , then the former capacitor size was not to small. Try then to put half the capacitor size as the first one, if you get lower or higher value than before, the capacitor is too small. If you get the same ADC output, you can try to decrease the capacitor further until you see an error on the ADC output.  My point is: increase the size of the capacitor until you stop seeing ADC output error, then the capacitor is big enough. Check for error near the boundary of the ADC range, e.g. at 1.1V if the range is 0V-1.2V&lt;/p&gt;
&lt;p&gt;Operational amplifier is good yes and is the way to go if you need higher sampling frequency than perhaps ~1Hz - 5Hz. Capacitor is simpler solution and cheaper.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf 51822 IO values not as expected</title><link>https://devzone.nordicsemi.com/thread/62630?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2016 17:25:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a38f339-d16d-4c57-b244-11c22a51a25b</guid><dc:creator>Francois</dc:creator><description>&lt;p&gt;Could it be a good option to use an OP-AMP in order to isolate the signal from the ADC?
How do we add pictures in comment? Please see added picture in original post.
Sorry for so many questions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf 51822 IO values not as expected</title><link>https://devzone.nordicsemi.com/thread/62629?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2016 16:39:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43db5f9b-c1b9-44fb-b05e-dcc1c206d995</guid><dc:creator>Francois</dc:creator><description>&lt;p&gt;No problem. Could you please just help me figure out two things:&lt;/p&gt;
&lt;p&gt;Where the 0.6v is coming from?
Also any idea why I&amp;#39;m not finding the valued given by the Excel sheets in reality? I&amp;#39;m getting the right value for 0v, but not for 20v... Are you 100% of your ADC resistance values?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;Francois&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf 51822 IO values not as expected</title><link>https://devzone.nordicsemi.com/thread/62628?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2016 16:25:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4831d43b-4359-4b80-be7c-e6a44fb05f88</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Thanks a lot Francois for attaching your excel sheet. Ill attach it in my blog post if you don&amp;#39;t mind for convenience for others that link to the blog post.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf 51822 IO values not as expected</title><link>https://devzone.nordicsemi.com/thread/62627?ContentTypeID=1</link><pubDate>Tue, 13 Sep 2016 21:22:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67bdb6dc-b853-40bf-9096-531e5b22899d</guid><dc:creator>Francois</dc:creator><description>&lt;p&gt;Stefan,&lt;/p&gt;
&lt;p&gt;Thanks a lot, exactly what I&amp;#39;m looking for!&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve read this document: &lt;a href="https://devzone.nordicsemi.com/attachment/428b530562fded0e484c166e76d88129"&gt;devzone.nordicsemi.com/.../428b530562fded0e484c166e76d88129&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m clear on everything except the U ADC: It&amp;#39;s always 0.6V?&lt;/p&gt;
&lt;p&gt;Also, I&amp;#39;m adding an Excel file doing the calculation described in the PDF. It could be practical for others... but I can&amp;#39;t find the number from my curve with my values... Any idea why?&lt;/p&gt;
&lt;p&gt;For example entering 20V, resistor values, pre-scaling value (1/3), U BATT @ 20V and resolution 10 bit.
(at 0V, it&amp;#39;s plausible. But at 20V, I&amp;#39;m far from it using the pre-scaling values I&amp;#39;m using).&lt;/p&gt;
&lt;p&gt;Also, If I want to sample from 0 to 24v and frequency is not an issue, I must use the biggest capacitor right? I guess I don&amp;#39;t have any options...&lt;/p&gt;
&lt;p&gt;Thanks again&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf 51822 IO values not as expected</title><link>https://devzone.nordicsemi.com/thread/62626?ContentTypeID=1</link><pubDate>Tue, 13 Sep 2016 18:30:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7dca36c-ea43-44aa-a63e-ca04eb4b70f3</guid><dc:creator>Francois</dc:creator><description>&lt;p&gt;Thank you, looking at it right now!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf 51822 IO values not as expected</title><link>https://devzone.nordicsemi.com/thread/62625?ContentTypeID=1</link><pubDate>Tue, 13 Sep 2016 16:21:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:206fa686-4647-42d6-8381-4fd388797c82</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi Francois&lt;/p&gt;
&lt;p&gt;Connecting nRF51 ADC input directly to a voltage divider will cause both ADC offset and gain error. A common method of correcting the gain/offset error is to use a capacitor with the voltage divider, see &lt;a href="https://devzone.nordicsemi.com/blogs/30/measuring-lithium-battery-voltage-with-nrf51/"&gt;this blog post&lt;/a&gt;. There is also available a &lt;a href="https://github.com/NordicSemiconductor/nrf51-ADC-examples"&gt;ADC code code on Nordic&amp;#39;s Github page&lt;/a&gt; that samples on multiple input pins, i.e. the &lt;code&gt;ble_app_uart_adc_scan_mode&lt;/code&gt; example.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>