Porting of examples on EVAL-CN0428-EBZ to AD5940 with ad5940lib

Hi,

I would like to use the AD5940 chip with a custom design in order to provide pH measures on water. To achieve this, I ported the ad5940lib  to our MCU to communicate with the chip through SPI and I successfully run the examples on the ad5940-examples repository.

To evaluate the capability of the AD5940 chip to perform pH measures, I previously tested the EVAL-CN0428-EBZ board with the "Water Quality" example and I obtained satisfactory results.

Now, I would like to port this example to our platform with the AD5940 chip (preferably using the ad5940lib) but I found some difficulties in this process, in particular:

  1. The EVAL-CN0428-EBZ uses the ADuCM355 instead of the AD5940 and the API used to configure the chip is completely different respect to the ad5940lib;
  2. The repository aducm355-examples is still empty, so I can make no comparison with the configuration of the ADuCM355 using the ad5940lib;
  3. I can't see any useful example in the ad5940-examples repository to perform pH measures;

Is there any possibility to get the pH measure example ported to the ad5940lib? If not, do you suggest to implement the application using the ad5940lib anyway or do you think there is a simpler approach to get the example work?

Thank you.

Parents
  • 0
    •  Analog Employees 
    on Jan 23, 2020 4:57 PM

    Hello,

    I might be able to give you a partial answer here and someone else might be able to add if they have additional experience. I was a designer on the CN0428. I haven't ported the CN0428 to AD5940, but if all you need is the pH measurement piece of it, I think it should translate pretty easily just by matching the ADC configuration. I think the best starting point is probably ad5940_ADCMeanFIFO.

    To break the CN0428 measurement routine down into steps:

    1. The pH electrode is buffered by LTC6078 and then routed to an analog input

      - See the CN0428 schematic for protection resistance and analog low-pass filter

    2. The ADC converts the voltage at the analog input

      - The relevant function in the CN0428 source code is called SnsMeasure() in the M355WqEcTests.c file, and you can probably match the adc configuration from there.

      - The key is that the ADC samples at 800kSPS, the SINC3 OSR is 4, and the SINC 2 OSR is 1333, which is an overall 150 SPS. Then 15 consecutive samples are averaged to get 10 SPS. This number was chosen because it gets you an integer division of 50 and 60Hz for a little extra power-line rejection (in addition to the notch being enabled). If you wanted to do more averaging with the stats block like in the 5940 example project, it couldn't hurt. But you may still want to test doing some averages in firmware to get to an integer division of 50 and 60Hz like the CN0428.

    3. The adc code is converted to pH in firmware, and temperature compensation and calibration are applied

      - In the CN0428 source code, this is the Wq_CalculatePH() function in the M355WqCmd.c file. This would be something you could copy/modify for your microcontroller.

    Sorry if this isn't the ideal answer. But I hope it helps.

    Thanks,
    Scott

Reply Children
No Data