<?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>ADC values ​​are changing each time you assemble or disassemble or tighten the screws of a mechanical assembly</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/103882/adc-values-are-changing-each-time-you-assemble-or-disassemble-or-tighten-the-screws-of-a-mechanical-assembly</link><description>Hello, 
 I&amp;#39;m developing a torque meter using nrf82832 I fixed complete wheatsotne bridge in my metal part that need measure deformation, but each time that I assemble or disassemple or thighten the screws, the value of adc is changing.. 
 Below, the saadc</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 21 Sep 2023 16:06:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/103882/adc-values-are-changing-each-time-you-assemble-or-disassemble-or-tighten-the-screws-of-a-mechanical-assembly" /><item><title>RE: ADC values ​​are changing each time you assemble or disassemble or tighten the screws of a mechanical assembly</title><link>https://devzone.nordicsemi.com/thread/447137?ContentTypeID=1</link><pubDate>Thu, 21 Sep 2023 16:06:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23d8b33d-6e4a-4c30-96d3-44964b540359</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/group__nrfx__saadc.html#gaf117e087540c455a6dfe05f258d118f0"&gt;nrfx_saadc_sample() returning NRF_ERROR_INVALID_STATE means that the SAADC is in the IDLE state when you attempt to call nrfx_saadc_sample()&lt;/a&gt;.&lt;br /&gt;&lt;/span&gt;Please make sure to have started the SAADC before you attempt to sample, and see if this resolves your issue.&lt;br /&gt;Please also &lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52832_Rev3/ERR/nRF52832/Rev3/latest/anomaly_832_86.html"&gt;make sure that your calibrateoffset procedures follows the approach described in the workaround for Errata 86&lt;/a&gt;.&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><item><title>RE: ADC values ​​are changing each time you assemble or disassemble or tighten the screws of a mechanical assembly</title><link>https://devzone.nordicsemi.com/thread/446872?ContentTypeID=1</link><pubDate>Wed, 20 Sep 2023 12:24:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:281baa0f-2f05-416d-9914-7f520ef1f541</guid><dc:creator>Laerte Junior</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote userid="65515" url="~/f/nordic-q-a/103882/adc-values-are-changing-each-time-you-assemble-or-disassemble-or-tighten-the-screws-of-a-mechanical-assembly/446524"]Yes, doing the SAADC internal calibration (once or periodically) would help. Couple of tickets which might help, hard to find the best as there are so many:[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I tried to do it using the example code of the &amp;quot;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/81692/continuous-adc-sampling-issue-nrf52840---nano-33-mbed---with-irq"&gt;continuous-adc-sampling-issue&lt;/a&gt;&amp;quot;, where I inserted the calibration function in my saadc_init, but now, I have problems with my saadc_event_handler function.&lt;/p&gt;
&lt;p&gt;below, my modified function:&lt;/p&gt;
&lt;p&gt;void saadc_init(void) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; SAADC config &amp;amp; calibrate&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrfx_saadc_config_t saadc_config = NRFX_SAADC_DEFAULT_CONFIG;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; APP_ERROR_CHECK(nrfx_saadc_init(&amp;amp;saadc_config, saadc_event_handler));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (nrfx_saadc_is_busy())&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sd_app_evt_wait();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Channels config&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Bateria&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_saadc_channel_config_t battery_config = NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN0);//NRFX_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_VDD);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; APP_ERROR_CHECK(nrf_drv_saadc_channel_init( 0, &amp;amp;battery_config));&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Celulas de carga&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_saadc_channel_config_t cell_config = NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_DIFFERENTIAL(NRF_SAADC_INPUT_AIN4, NRF_SAADC_INPUT_AIN7);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cell_config.reference = NRF_SAADC_INPUT_AIN5;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cell_config.gain = NRF_SAADC_GAIN1_4;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; APP_ERROR_CHECK(nrf_drv_saadc_channel_init( 1, &amp;amp;cell_config));&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // double buffering&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; APP_ERROR_CHECK(nrfx_saadc_buffer_convert(buffer[0], INPUTS));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; APP_ERROR_CHECK(nrfx_saadc_buffer_convert(buffer[1], INPUTS));&lt;/p&gt;
&lt;p&gt;// Calibrate the SAADC by finding its offset&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_SAADC-&amp;gt;TASKS_CALIBRATEOFFSET = 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (NRF_SAADC-&amp;gt;EVENTS_CALIBRATEDONE == 0);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NRF_SAADC-&amp;gt;EVENTS_CALIBRATEDONE = 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (NRF_SAADC-&amp;gt;STATUS == (SAADC_STATUS_STATUS_Busy &amp;lt;&amp;lt; SAADC_STATUS_STATUS_Pos));&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;This form is correct?&lt;/p&gt;
&lt;p&gt;The returned error of the saadc_timeout_handler is:&lt;/p&gt;
&lt;p&gt;&amp;lt;error&amp;gt; app: ERROR 8 [NRF_ERROR_INVALID_STATE]&lt;/p&gt;
&lt;p&gt;static void saadc_timeout_handler(void *p_context) { // ADC for battery status&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; UNUSED_PARAMETER(p_context);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; APP_ERROR_CHECK(nrfx_saadc_sample());&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC values ​​are changing each time you assemble or disassemble or tighten the screws of a mechanical assembly</title><link>https://devzone.nordicsemi.com/thread/446524?ContentTypeID=1</link><pubDate>Mon, 18 Sep 2023 19:09:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95ffa572-5430-4b99-a7b4-7bc428d5e0c6</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Yes, doing the SAADC internal calibration (once or periodically) would help. Couple of tickets which might help, hard to find the best as there are so many:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/81692/continuous-adc-sampling-issue-nrf52840---nano-33-mbed---with-irq"&gt;continuous-adc-sampling-issue&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/95694/trying-to-understand-saadc-changes/404939"&gt;trying-to-understand-saadc-changes&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Edit: AIN4, AIN5 and AIN7 require small caps to GND close to nRF52 pins, maybe 10nF or 100nF as a minimum; also try 12-bit resolution if using 10-bit&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC values ​​are changing each time you assemble or disassemble or tighten the screws of a mechanical assembly</title><link>https://devzone.nordicsemi.com/thread/446521?ContentTypeID=1</link><pubDate>Mon, 18 Sep 2023 18:31:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc4c7073-62f2-4017-8ee8-6b0cba62d265</guid><dc:creator>Laerte Junior</dc:creator><description>&lt;p&gt;I removed r1 and r2 resistors, but the adc values continue changing after any mechanic modifications.&lt;/p&gt;
[quote userid="65515" url="~/f/nordic-q-a/103882/adc-values-are-changing-each-time-you-assemble-or-disassemble-or-tighten-the-screws-of-a-mechanical-assembly/446514"]Edit: If power is removed or restored then the SAADC needs recalibrating, sorry I should have thought of suggesting that[/quote]
&lt;p&gt;I agree, but I&amp;#39;m not using it in my code calibrations functions that found in nrfx_saadc.c. I need use it?&lt;/p&gt;
&lt;p&gt;below my code that read adc values.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;#define AMOSTRAS_DIVISAO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&lt;/p&gt;
&lt;p&gt;void saadc_event_handler(nrfx_saadc_evt_t const *p_event) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ret_code_t err_code;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int16_t sample_ADC;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (p_event-&amp;gt;type == NRFX_SAADC_EVT_DONE){&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;nrf_saadc_value_t *adc_result = p_event-&amp;gt;data.done.p_buffer;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;uint16_t mv = adc_to_mv(adc_result[0]); &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;battery_level = battery_level_in_percent(mv);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;APP_ERROR_CHECK(nrfx_saadc_buffer_convert(adc_result, INPUTS));&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;RESbatt = adc_result[0]; //tensao da bateria&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;sample_ADC = adc_result[1];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(m_scale.calibrating == true)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;vetor_adc[index_vetor++] = sample_ADC;//REScell;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (index_vetor&amp;gt;=AMOSTRAS_DIVISAO)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;index_vetor = 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;m_scale.calibrating = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;adc_cell_sum=0;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i=0; i&amp;lt;AMOSTRAS_DIVISAO; i++) &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;adc_cell_sum += vetor_adc[i];&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;adc_leitura = (adc_cell_sum/AMOSTRAS_DIVISAO); //calculo do offset&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;m_scale.offset = adc_leitura;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;} &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;REScell = sample_ADC;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;err_code = ble_bas_battery_level_update(&amp;amp;m_bas, battery_level, BLE_CONN_HANDLE_ALL);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if ((err_code != NRF_SUCCESS)&amp;amp;&amp;amp;(err_code != NRF_ERROR_INVALID_STATE)&amp;amp;&amp;amp;(err_code != NRF_ERROR_RESOURCES)&amp;amp;&amp;amp;(err_code != NRF_ERROR_BUSY)&amp;amp;&amp;amp;(err_code != BLE_ERROR_GATTS_SYS_ATTR_MISSING))&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;APP_ERROR_HANDLER(err_code);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;the saadc_event_handler function iscalled every 5ms.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC values ​​are changing each time you assemble or disassemble or tighten the screws of a mechanical assembly</title><link>https://devzone.nordicsemi.com/thread/446514?ContentTypeID=1</link><pubDate>Mon, 18 Sep 2023 17:31:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:511afb36-f436-4782-ab7b-711479258f34</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Let&amp;#39;s assume the 3V supply changes (for whatever reason); this will change the differential output of the bridge. Using &lt;span&gt;the 3V supply as the&lt;/span&gt; reference for the&amp;nbsp;SAADC&amp;nbsp;on &lt;span&gt;NRF_SAADC_INPUT_AIN5&amp;nbsp;&lt;/span&gt;which does not change by the same&amp;nbsp;percentage&amp;nbsp;as the bridge supply introduces an unwanted change in bridge output because the bridge supply is not the 3V supply but (350/550)*3=1.9V. Using a similar derived value for the SAADC reference would then track the changing bridge excitation voltage. Worth a try; or just get rid of the two 100R resistors R1 and R2 and see if that helps&lt;/p&gt;
&lt;p&gt;Edit: If power is removed or restored then the SAADC needs recalibrating, sorry I should have thought of suggesting that&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC values ​​are changing each time you assemble or disassemble or tighten the screws of a mechanical assembly</title><link>https://devzone.nordicsemi.com/thread/446510?ContentTypeID=1</link><pubDate>Mon, 18 Sep 2023 16:56:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3157d7c-a9ea-4102-a14f-e424bb814003</guid><dc:creator>Laerte Junior</dc:creator><description>&lt;p&gt;The base is very rigid and very tight. The strain gauges that I&amp;#39;m using already have temperature compensation. Below. the schematic of my project where the bridge circuit is conected.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1695056195443v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ADC values ​​are changing each time you assemble or disassemble or tighten the screws of a mechanical assembly</title><link>https://devzone.nordicsemi.com/thread/446502?ContentTypeID=1</link><pubDate>Mon, 18 Sep 2023 16:18:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3faac2d9-3512-4c99-86ef-b9501d834fa1</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Perhaps check that&amp;nbsp;&lt;span&gt;NRF_SAADC_INPUT_AIN5 is derived from +3V bridge excitation and not INA333 1.5V reference or ensure&amp;nbsp;INA333 1.5V reference tracks&amp;nbsp;+3V bridge excitation otherwise bridge measurement is differential but not not ratiometric and therefore varies with bridge excitation. Also bridge arm resistance (and hence load on the&amp;nbsp;+3V bridge excitation) varies as the assembly is flexed with changes in screw tightness if the base is not rigid.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>