ADC values ​​are changing each time you assemble or disassemble or tighten the screws of a mechanical assembly

Hello,

I'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 configuration that I'm using:

void saadc_init(void) {
    //  SAADC config & calibrate
    nrfx_saadc_config_t saadc_config = NRFX_SAADC_DEFAULT_CONFIG;
    APP_ERROR_CHECK(nrfx_saadc_init(&saadc_config, saadc_event_handler));
    while (nrfx_saadc_is_busy())
        sd_app_evt_wait();

    // Channels config
    //Bateria
    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);
    APP_ERROR_CHECK(nrf_drv_saadc_channel_init( 0, &battery_config));

    //Celulas de carga
    nrf_saadc_channel_config_t cell_config = NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_DIFFERENTIAL(NRF_SAADC_INPUT_AIN4, NRF_SAADC_INPUT_AIN7);
    cell_config.reference = NRF_SAADC_INPUT_AIN5;
    cell_config.gain = NRF_SAADC_GAIN1_4;
    APP_ERROR_CHECK(nrf_drv_saadc_channel_init( 1, &cell_config));
    
    // double buffering
    APP_ERROR_CHECK(nrfx_saadc_buffer_convert(buffer[0], INPUTS));
    APP_ERROR_CHECK(nrfx_saadc_buffer_convert(buffer[1], INPUTS));
}

The values ​​read from the adc each time I modify the mechanical part

Just electronic boad
<info> app:  -1924.00 <CR><LF>
<info> app:  -1936.00 <CR><LF>
<info> app:  -1930.00 <CR><LF>
<info> app:  -1914.00 <CR><LF>
<info> app:  -1926.00 <CR><LF>
<info> app:  -1920.00 <CR><LF>
<info> app:  -1918.00 <CR><LF>
<info> app:  -1928.00 <CR><LF>
<info> app:  -1886.00 <CR><LF>
<info> app:  -1930.00 <CR><LF>
<info> app:  -1924.00 <CR><LF>
<info> app:  -1930.00 <CR><LF>
<info> app:  -1920.00 <CR><LF>
<info> app:  -1936.00 <CR><LF>
<info> app:  -1920.00 <CR><LF>
<info> app:  -1932.00 <CR><LF>
<info> app:  -1932.00 <CR><LF>
<info> app:  -1924.00 <CR><LF>
<info> app:  -1928.00 <CR><LF>
<info> app:  -1912.00 <CR><LF>
<info> app:  -1930.00 <CR><LF>


Just first metal borad part with the screws
<info> app:  -1850.00 <CR><LF>
<info> app:  -1842.00 <CR><LF>
<info> app:  -1844.00 <CR><LF>
<info> app:  -1828.00 <CR><LF>
<info> app:  -1852.00 <CR><LF>
<info> app:  -1838.00 <CR><LF>
<info> app:  -1846.00 <CR><LF>
<info> app:  -1846.00 <CR><LF>
<info> app:  -1838.00 <CR><LF>
<info> app:  -1850.00 <CR><LF>
<info> app:  -1840.00 <CR><LF>
<info> app:  -1848.00 <CR><LF>
<info> app:  -1838.00 <CR><LF>
<info> app:  -1840.00 <CR><LF>
<info> app:  -1852.00 <CR><LF>
<info> app:  -1842.00 <CR><LF>
<info> app:  -1842.00 <CR><LF>
<info> app:  -1844.00 <CR><LF>
<info> app:  -1834.00 <CR><LF>
<info> app:  -1850.00 <CR><LF>

Just first metal borad part with the screws again
<info> app:  -520.00 <CR><LF>
<info> app:  -492.00 <CR><LF>
<info> app:  -514.00 <CR><LF>
<info> app:  -528.00 <CR><LF>
<info> app:  -504.00 <CR><LF>
<info> app:  -512.00 <CR><LF>
<info> app:  -522.00 <CR><LF>
<info> app:  -514.00 <CR><LF>
<info> app:  -512.00 <CR><LF>
<info> app:  -510.00 <CR><LF>
<info> app:  -510.00 <CR><LF>
<info> app:  -500.00 <CR><LF>
<info> app:  -510.00 <CR><LF>
<info> app:  -500.00 <CR><LF>
<info> app:  -504.00 <CR><LF>
<info> app:  -514.00 <CR><LF>
<info> app:  -512.00 <CR><LF>
<info> app:  -512.00 <CR><LF>
<info> app:  -514.00 <CR><LF>
<info> app:  -504.00 <CR><LF>

Completely mechanical board
<info> app:  -496.00 <CR><LF>
<info> app:  -500.00 <CR><LF>
<info> app:  -500.00 <CR><LF>
<info> app:  -500.00 <CR><LF>
<info> app:  -512.00 <CR><LF>
<info> app:  -514.00 <CR><LF>
<info> app:  -514.00 <CR><LF>
<info> app:  -498.00 <CR><LF>
<info> app:  -488.00 <CR><LF>
<info> app:  -500.00 <CR><LF>
<info> app:  -506.00 <CR><LF>
<info> app:  -486.00 <CR><LF>
<info> app:  -532.00 <CR><LF>
<info> app:  -488.00 <CR><LF>
<info> app:  -496.00 <CR><LF>
<info> app:  -494.00 <CR><LF>
<info> app:  -484.00 <CR><LF>
<info> app:  -510.00 <CR><LF>
<info> app:  -494.00 <CR><LF>
<info> app:  -456.00 <CR><LF>

Dissasselmby all parts and assembly mechanical board again
<info> app:  -436.00 <CR><LF>
<info> app:  -442.00 <CR><LF>
<info> app:  -450.00 <CR><LF>
<info> app:  -434.00 <CR><LF>
<info> app:  -460.00 <CR><LF>
<info> app:  -440.00 <CR><LF>
<info> app:  -444.00 <CR><LF>
<info> app:  -440.00 <CR><LF>
<info> app:  -466.00 <CR><LF>
<info> app:  -458.00 <CR><LF>
<info> app:  -440.00 <CR><LF>
<info> app:  -448.00 <CR><LF>
<info> app:  -450.00 <CR><LF>
<info> app:  -444.00 <CR><LF>
<info> app:  -440.00 <CR><LF>
<info> app:  -440.00 <CR><LF>
<info> app:  -454.00 <CR><LF>
<info> app:  -448.00 <CR><LF>
<info> app:  -444.00 <CR><LF>
<info> app:  -446.00 <CR><LF>

Others values of my electronic circuit:

Brigde: 3V supply using Vref3v (ISL21080CIH330Z-TK)

Using INA333 with gain 1000 and reference with 1.5V supply with Vref1.5V (ISL21080CIH315Z-TK)

The wheatsone bridge using 350ohm strain gauges

Anyone help me if I need change any SAADC configuration?

Regards

Laerte

  • Hi,

    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:

    I tried to do it using the example code of the "continuous-adc-sampling-issue", where I inserted the calibration function in my saadc_init, but now, I have problems with my saadc_event_handler function.

    below, my modified function:

    void saadc_init(void) {
        //  SAADC config & calibrate
        nrfx_saadc_config_t saadc_config = NRFX_SAADC_DEFAULT_CONFIG;
        APP_ERROR_CHECK(nrfx_saadc_init(&saadc_config, saadc_event_handler));
        while (nrfx_saadc_is_busy())
            sd_app_evt_wait();

        // Channels config
        //Bateria
        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);
        APP_ERROR_CHECK(nrf_drv_saadc_channel_init( 0, &battery_config));

        //Celulas de carga
        nrf_saadc_channel_config_t cell_config = NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_DIFFERENTIAL(NRF_SAADC_INPUT_AIN4, NRF_SAADC_INPUT_AIN7);
        cell_config.reference = NRF_SAADC_INPUT_AIN5;
        cell_config.gain = NRF_SAADC_GAIN1_4;
        APP_ERROR_CHECK(nrf_drv_saadc_channel_init( 1, &cell_config));
        
        // double buffering
        APP_ERROR_CHECK(nrfx_saadc_buffer_convert(buffer[0], INPUTS));
        APP_ERROR_CHECK(nrfx_saadc_buffer_convert(buffer[1], INPUTS));

    // Calibrate the SAADC by finding its offset
        NRF_SAADC->TASKS_CALIBRATEOFFSET = 1;
        while (NRF_SAADC->EVENTS_CALIBRATEDONE == 0);
        NRF_SAADC->EVENTS_CALIBRATEDONE = 0;
        while (NRF_SAADC->STATUS == (SAADC_STATUS_STATUS_Busy << SAADC_STATUS_STATUS_Pos));
    }

    This form is correct?

    The returned error of the saadc_timeout_handler is:

    <error> app: ERROR 8 [NRF_ERROR_INVALID_STATE]

    static void saadc_timeout_handler(void *p_context) { // ADC for battery status
        UNUSED_PARAMETER(p_context);
        APP_ERROR_CHECK(nrfx_saadc_sample());
    }

    Regards

Related