Post Go back to editing

EVAL-CN0391-ARDZ Shield: Having trouble increasing the SPS reading rate from the attached thermocouples

Hello,

I am using the  EVAL-CN0391-ARDZ Shield and communicating with it through Arduino UNO. I would like to use the shield and K-type thermocouples to achieve high rate temperature measurements, and I have followed the example provided on the Wiki page https://wiki.analog.com/resources/eval/user-guides/arduino-uno/reference_designs/demo_cn0391 but I cannot seem to get the SPS rate increased to a desired amount. 

I understand that the Shield is using the AD7124-8 chip, so I have also followed the data sheet https://www.analog.com/media/en/technical-documentation/data-sheets/ad7124-8.pdf and tried to change the power mode from low to full in hope that it would increase the sampling rate. According to the data sheet, the full power mode allows the total sampling rate of the 4 channels to be 19200 SPS. However, I am getting nowhere close to a higher sampling rate than 2Hz, and this is just using one channel.

So far, using the provided example https://github.com/analogdevicesinc/arduino/tree/master/Arduino%20Uno%20R3/examples/CN0391_example, I have tried changing the delay time, setting the power mode to full by changing the 0 to 3 (according to the data sheet for AD7124-8 on page 81) in the setValue function, and comment out all the other Serial.print so I can increase the SPS rate,

// Set _ADC_Control 0x01
	regNr = AD7124_ADC_Control;            //Select _ADC_Control register
	setValue = AD7124_ReadDeviceRegister(regNr);
	setValue |= AD7124_ADC_CTRL_REG_DATA_STATUS; // set data status bit in order to check on which channel the conversion is
	setValue |= AD7124_ADC_CTRL_REG_REF_EN;
	setValue |= AD7124_ADC_CTRL_REG_POWER_MODE(3);  //set low power mode
	setValue &= 0xFFFF;
	AD7124_WriteDeviceRegister(regNr, setValue);    // Write data to _ADC
	delay(ms_delay);

but I have seen no improvements on the SPS rate. Even with low power, according to the data sheet, the output data rate can reach up to 2400 SPS, so I would like to know what I can do to increase my data output rate from the thermocouples.

Kind regards,

Oscar

  • Hi, 

    I will be moving here to its proper community. Someone here may be able to assist you. 

    Q&A - Reference Circuits - EngineerZone (analog.com)

    Thanks,

    Jellenie

  • Hi Oscar, 

        The CN0391 example code configures the part for power line rejection (50/60Hz) . 
        You will need to change the filter settings for a different output data rate. See datasheet section starting page 55. 
        The filter is configured in CN0391.cpp function CN0391_init()

        There is also a 100ms delay in CN0391_read_channel that you will need to modify for your application. 

    Hope it helps,

    -Logan

  • Hello Logan,

    Thank you for your replay. I managed to locate the filter configuring function in the file as well as read the datasheet. From the datasheet, it states that the FS needs to be changed accordingly in the CN0391_init() function to adjust the SPS. As shown in the code, I have changed the FS in two places within the function,

     // Set AD7124_Filter_0 0x21
       regNr = AD7124_Filter_0;
       setValue = AD7124_ReadDeviceRegister(regNr);
       setValue |= AD7124_FILT_REG_FILTER(2);                     // set SINC3
       setValue |= AD7124_FILT_REG_FS(48);                     //FS = 48 => 50 SPS LOW power
       setValue &= 0xFFFFFF;
       AD7124_WriteDeviceRegister(regNr, setValue);// Write data to _ADC
       
       // Set AD7124_Filter_0 0x21
       regNr = AD7124_Filter_1;
       setValue = AD7124_ReadDeviceRegister(regNr);
       setValue |= AD7124_FILT_REG_FILTER(2);                     // set SINC3
       setValue |= AD7124_FILT_REG_FS(48);                     //FS = 48 => 50 SPS
       setValue &= 0xFFFFFF;
       AD7124_WriteDeviceRegister(regNr, setValue);// Write data to _ADC
    

    and if I understand correctly, the comment also suggest that changing the FS to 48 will result in 50 SPS. However, I still got half a second sampling rate even though I have changed the delay, the ms_delay and display_refresh to 1ms. I have also tried with different power modes as well as changing the FS to different values but the results are the same.

    Could you instruct me further on my problem? Is there something else I may have overlooked?

    Thanks in advance.

    Oscar

  • I would also like to point out that in the datasheet, it states that the SINC4 is set as default in the chip, but the code in the example suggests that the SINC3 has been set which is a bit confusing.  

  • Hello Logan,

    Would you be able to assist with my follow up question.

    Kind regards

    Oscar

  • Hello Logan

    were you able to figure out how to increase the sps?
    I changed the filter to 7, as described in the data sheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ad7124-8.pdf.

    However, the rate just increases to around 1/43ms, so around 340 ms for all 8 channels.

    Do you know how to change it properly?
    Thank you in davance!

    Kind regards

    Paul

     // Set AD7124_Filter_0 0x21
       regNr = AD7124_Filter_0;
       setValue = AD7124_ReadDeviceRegister(regNr);
       setValue |= AD7124_FILT_REG_FILTER(7);                     // set SINC3
       setValue |= AD7124_FILT_REG_FS(20);                     //FS = 48 => 50 SPS LOW power
       setValue &= 0xFFFFFF;
       AD7124_WriteDeviceRegister(regNr, setValue);// Write data to _ADC
       
       // Set AD7124_Filter_0 0x21
       regNr = AD7124_Filter_1;
       setValue = AD7124_ReadDeviceRegister(regNr);
       setValue |= AD7124_FILT_REG_FILTER(7);                     // set SINC3
       setValue |= AD7124_FILT_REG_FS(20);                    //FS = 48 => 50 SPS
       setValue &= 0xFFFFFF;
       AD7124_WriteDeviceRegister(regNr, setValue);// Write data to _A