<?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>Help with Converting SAADC ADC Value to Millivolts in nRF52810</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115125/help-with-converting-saadc-adc-value-to-millivolts-in-nrf52810</link><description>hi , 
 I am currently developing a project using the nRF52810 as my controller and SEGGER Embedded Studio (version 5.42a) as my IDE. I have successfully integrated the Timer and SAADC peripherals into the ble_app_uart/pca10040e/s112 example project from</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 04 Oct 2024 10:18:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115125/help-with-converting-saadc-adc-value-to-millivolts-in-nrf52810" /><item><title>RE: Help with Converting SAADC ADC Value to Millivolts in nRF52810</title><link>https://devzone.nordicsemi.com/thread/504964?ContentTypeID=1</link><pubDate>Fri, 04 Oct 2024 10:18:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c59b09f2-f2a3-4777-b481-e644e3f94a34</guid><dc:creator>siltvm</dc:creator><description>&lt;p&gt;Thank you&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/aryan"&gt;Susheel Nuguru&lt;/a&gt;&amp;nbsp;very much for your response.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help with Converting SAADC ADC Value to Millivolts in nRF52810</title><link>https://devzone.nordicsemi.com/thread/504930?ContentTypeID=1</link><pubDate>Fri, 04 Oct 2024 07:12:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56102240-33bd-4d58-bf30-a9c19edd8ea3</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I overlooked to see that you are still using the old deprecated version of the SDK.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The implementation of adc_raw_to_millivolts() can be extracted from the header file from here -&amp;gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/8005d4e87b9bcba25f441a51f4f5d29b541022b9/include/zephyr/drivers/adc.h#L883"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/8005d4e87b9bcba25f441a51f4f5d29b541022b9/include/zephyr/drivers/adc.h#L883&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you can the vref, gain and resolution, then you can formulate it as shown in the code in the above link.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help with Converting SAADC ADC Value to Millivolts in nRF52810</title><link>https://devzone.nordicsemi.com/thread/504776?ContentTypeID=1</link><pubDate>Thu, 03 Oct 2024 05:58:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55c64053-9f7b-4100-81f7-44a61684686c</guid><dc:creator>siltvm</dc:creator><description>&lt;p&gt;hi &lt;a href="https://devzone.nordicsemi.com/members/aryan"&gt;Susheel Nuguru&lt;/a&gt;&amp;nbsp;,Are there any other methods available for converting ADC values to millivolts?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help with Converting SAADC ADC Value to Millivolts in nRF52810</title><link>https://devzone.nordicsemi.com/thread/504775?ContentTypeID=1</link><pubDate>Thu, 03 Oct 2024 05:52:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b59eab5-3d41-47c5-8bf1-49a747baf05e</guid><dc:creator>siltvm</dc:creator><description>&lt;p&gt;hi &lt;a href="https://devzone.nordicsemi.com/members/aryan"&gt;Susheel Nuguru&lt;/a&gt;&amp;nbsp;, There is no &lt;code&gt;adc_raw_to_millivolts()&lt;/code&gt; function available in the nRF5 SDK version 17.0.2.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help with Converting SAADC ADC Value to Millivolts in nRF52810</title><link>https://devzone.nordicsemi.com/thread/504585?ContentTypeID=1</link><pubDate>Tue, 01 Oct 2024 18:03:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a36f70ec-6dba-4fe0-bb49-5269170cd7b9</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;div&gt;
&lt;div&gt;To convert the ADC value into a voltage in millivolts, you can use the formula provided in the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf52833/page/saadc.html#ariaid-title12"&gt;documentation here.&lt;/a&gt;:&lt;/div&gt;
&lt;div&gt;
&lt;div dir="ltr"&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;RESULT = [V(P) – V(N)] * (GAIN/REFERENCE) * 2^(RESOLUTION - m)&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;Where:&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;&lt;span&gt;&lt;code dir="ltr"&gt;V(P)&lt;/code&gt;&amp;nbsp;is the voltage at input P&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;&lt;span&gt;&lt;code dir="ltr"&gt;V(N)&lt;/code&gt;&amp;nbsp;is the voltage at input N&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;&lt;span&gt;&lt;code dir="ltr"&gt;GAIN&lt;/code&gt;&amp;nbsp;is the selected gain&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;&lt;span&gt;&lt;code dir="ltr"&gt;REFERENCE&lt;/code&gt;&amp;nbsp;is the selected reference voltage&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;&lt;span&gt;&lt;code dir="ltr"&gt;RESOLUTION&lt;/code&gt;&amp;nbsp;is output resolution in bits&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;&lt;span&gt;&lt;code dir="ltr"&gt;m&lt;/code&gt;&amp;nbsp;is 0 for single-ended channels and 1 for differential channels&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;In your case, since you are using a single-ended input,&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code dir="ltr"&gt;m&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;would be 0.&lt;/div&gt;
&lt;div&gt;Here is a code snippet from the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/99939/attempting-to-get-adc-to-work?ReplyFilter=Answers&amp;amp;ReplySortBy=Answers&amp;amp;ReplySortOrder=Descending"&gt;devzone thread&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;that demonstrates how to convert the ADC value to millivolts:&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;int32_t mv_value = sample_buffer[0];
int32_t adc_vref = adc_ref_internal(dev);
adc_raw_to_millivolts(adc_vref, ADC_GAIN, ADC_RESOLUTION, &amp;amp;mv_value);
&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div dir="ltr"&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;In this code,&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code dir="ltr"&gt;sample_buffer[0]&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;is the ADC value,&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code dir="ltr"&gt;adc_vref&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;is the reference voltage,&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code dir="ltr"&gt;ADC_GAIN&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;is the gain, and&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code dir="ltr"&gt;ADC_RESOLUTION&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;is the resolution. The function&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code dir="ltr"&gt;adc_raw_to_millivolts()&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;converts the raw ADC value to millivolts.&lt;/div&gt;
&lt;div&gt;Please note that the actual implementation might vary depending on the specifics of your project and the exact ADC configuration.&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>