Post Go back to editing

pH and conductivity on a EVAL-AD5940ELCZ (AD5940 chip)

Dear Support,

I'm using with success the CN0428 Water Quality Measurement System with your evaluation software: it's great!

Now, for the project I'm developing I will prefer the AD5940 component to be used with a companion MCU. I've downloaded from your ftp server the examples pack related to the EVAL-AD5940ELCZ, they are very easy to understand and to implement, but I have not been able to find any example regarding the measurement of pH and conductivity, although the BNC suitable for this is present on the board.

Now, since the porting of your examples from ADuCM355 (CN0428) to the EVAL-AD5940ELCZ is not so fast, I wonder if you can provide me with the example code to carry out these measurements on the EVAL-AD5940ELCZ board in an easy and fast way to validate the product.


Stefano T

privacy hint
[edited by: Stefano T at 8:38 AM (GMT 0) on 28 Nov 2019]

Top Replies

  • Hi Stefano,

    Thank you for you query. Our latest examples for the AD5940 are located on GitHub.Unfortunately we do not currently have example projects available specifically for pH and conductivity measurements. However we do have a number of application level and block level examples that can be used and modified to carry out pH and conductivity measurements. In the mean time ADI will work to develop custom examples and add them to the SDK.

  • Hi MLambe,

    I have arrived at the same point as Stefano: I'm building a project that will measure pH, EC, and DO on a single card.  By the time I adapted the CN0428 circuitry to my card and connected it with isolators for I2C and all the other control signals to my control MCU, the cost and complexity went through the roof - and the knowledge required to get everything working well included knowing two different MCUs on an intimate basis!  While I'm sure the system would work well, the complexity and cost are too much for my target market.  Also the textual interface to the sensors isn't really needed in this context.

    It looks like the 5940 eval board has the identical sensor interfaces as CN0428, so this should be a software issue only.  I would also vote for any assistance AD can provide in moving the pH and EC code from CN0428 to the AD5940.

  • Hi, 

    Thank you for your feedback. I think Micheal mentioned that they would consider it in the future software update but I am not sure how long the development may take or when are they planning to do this. We will follow up the team regarding this matter and we will let you know if we have an update. 



  • Thanks!  In the meantime, I'm designing my application based on the reference design in the EVAL-AD5940 so when I get around to the software, it will be compatible with that board, but have similar functions to that available in CN0428 (excluding the command interpreter since my entire system is Modbus based..)  I'll look to share that code when it's done.

  • Hello MLambe, 

    I will be working on an ad5941 which will be a companion chip to an MCU.
    I'm going to use this AD5941 to do a conductivity measurement, I can't find an example in the git repo.
    Have you developed an example of conductivity measurement or would you have an example to provide me?


  • Hi,

    Ready code for pH measurement is not available for A5941. 

    Reference may be taken from AD5940_EIS , AD5940_Impedance and AD5940_Amperometry

  • HI, I am trying to do  PH measurements for the AD5941 along with Amperometric readings. I do not want to do them simultaneously. But have been struggling to create code for it. Did you perhaps manage to get it working? Do you have any tips or maybe some code that you can share?

    Thanks in advance

  • Hi Akila, what do you mean by taking reference? Could you possibly elaborate more on how to set up the AD5941 to do PH measurement.

    I am working with a EVAL-AD5941ELCZ board. 

    I have tried taking the output from the High Z Channel. Which is connected to AFE4 to the ADC. But the results were very unpredictable and did not seem correct.

    I have also tried setting up a sequencer and FIFO for doing the reading but again the results were unpredictable.

    Please could you give some guidance on how to move forward. 

  • Hi,

    AD5940 and ADuCM355 have same analog front end, same library files and functions . (Only difference is ADuCM355 has built in cortex M3 processor).

    Below water quality measurement example explains pH, ORP and conductivity measurements taken by ADuCM355: 

    aducm355-examples/examples/ApplicationExamples/M355_WaterQuality at master · analogdevicesinc/aducm355-examples (

    The above example does EIS measurements for calculating pH and conductivity of water. 

    AD5940_EIS example is available in Github: ad5940-examples/examples/AD5940_ECSns_EIS at master · analogdevicesinc/ad5940-examples (

    In case you are opting for CN0428:

    GUI for CN0428:

    Below are the EIS outputs obtained with loads= resistors mentioned:


    Console output:

    Please wait for sensor startup and initialization:


    Sensor in site 1: 0x04 initialization error. Address 0x0A!

    Water Quality Sensor in site 2 initialized successfully. Address 0x0B!

    Sensor in site 3: 0x04 initialization error. Address 0x0C!

    Water Quality Sensor in site 4 initialized successfully. Address 0x0D!


    Sensor Site: 2!


    Available commands:

    help                   - Display available commands

    sensortype <type>      - Change the type of sensor that is connected (default:pH).

                              <type> = ph, conductivity, orp

    measuretemp            - Measure and print current temperature value

    measuresensor          - Make sensor measurement for configured sensor (pH, conductivity, orp)

    measureeis             - Perform EIS sweep on sensor and estimate sensor health

                              add optional argument bode to print bode instead of nyquist plot

    printhealth            - Print sensor health value from last EIS measurement

    printtemp              - Print temperature without updating (i.e., temp of last sensor meas)

    printconfig            - Print configuration (sensortype, hizmode, temperature enabled)

    printserialnumber      - Print ADuCM355 unique ID (can be used to store calibrations)

    enabletemp <en>        - Enable/disable temperature sensor channel.

                              <en> = 1 to <en> = 0 to disable

    enablehizmode <en>     - Enable/disable high-impedance TIA. Ensure S2 matches this setting

                              <en> = 1 to <en> = 0 to disable

    setmineisfreq <freq>   - Set minimum frequency for eis measurement

    setmaxeisfreq <freq>   - Set minimum frequency for eis measurement

                              <freq> = 0.1 to 200000 or full to set to full range

    renamesensor <name>    - Rename the sensor.

                              <name> = new name (<16 characters)

    switchsensor <site>    - Switch to sensor board at <site>.

                              <site> = 1, 2, 3, 4. Channel num of the sensor board to switch to


    Switching to site 4

    Unknown command!


    Min EIS Frequency set to 5.00 Hz


    Max EIS Frequency set to 5000.00 Hz


    Starting EIS Measurement. This will take about 30 seconds.

    Impedance Result:













    Min EIS Frequency set to 0.10 Hz


    Max EIS Frequency set to 500.00 Hz


    Starting EIS Measurement. This will take about 30 seconds.

    Impedance Result:
















    Note: Measurement at 50Hz (49.9934 Hz) is ignored (power supply rejection).