CN-0326 pH and Temperature Sensor - SPI connectivity

I’ve CN0326 sensor (for pH and Temperature) .
I’m connecting it to Arduino board via SPI.
I’m not getting device detection first. (used arduino sample code)
Can anybody help me to get started?

Are you using the ADI EVAL-ADICUP360 EcoSystem to try to connect the CN0326 to your Arduino?

Can you share your schematic and a link to the code you are using?


Dear Robert,

 We have only EVAL-CN0326-PMDZ-REV.B board.
 I'm just connecting it to Arduino UNO board for SPI connectivity.

     SPI - Slave(CN0326)         SPI - Master(Arduino)

(Attachment example_volt_rtd_ad7793.ino is missing)

readme_txt.txt (10.7 KB)

(Attachment ad7793_cpp.c is missing)

(Attachment ad7793_h.c is missing)

(Attachment communication_cpp.c is missing)

(Attachment communication_h.c is missing)

Dear Robert,

 We have only EVAL-CN0326-PMDZ-REV.B board.
 I'm just connecting it to Arduino UNO board for SPI connectivity.

     SPI - Slave(CN0326)                 SPI - Master(Arduino)

     Pin-1 (CS_N) ->                Pin-10 (CS)
     Pin-2 (DIN)       ->                Pin-11 (MOSI)
     Pin-3 (DOUT)             ->                Pin-12 (MISO)
     Pin-4 (SCLK)   ->                Pin-13 (SCK)
     Pin-5 (GND)       ->                Gnd
     Pin-6 (VCC)           ->                3.3V

Code I’m checking with existing with: (downloads for AD7793 code)
- I’m copied the code(.ino) herewith and other files also.

Pls. check Hardware connections, supply voltage level, any more
requirement in hardware level and then software.

I’ve tried only with SPI. Is there any more protocol support like I2C
or UART available in this evaluation board?

Please give basic testing code for supported protocols.
And let me know the CD for this Evaluation board is not received; when
I’m trying to download from ftp, it is not connecting to website itself.

Thanks & Regards,


This example shows how to use an AD7793 converter to perform successively two measurements:

  1. a single voltage reading in the range from 0 to 0.58 V on AD7793 channel 2 (0.58 = 1.17V AD7793 internal reference divided by 2);
  2. a repeated temperature reading using a 4-wire PT100 RTD and a ratiometric measurement circuit on AD7793 channel 1 (up to 144 C;
    for higher temperature or to use PT1000, simply lower the gain).

Using RTDs in a ratiometric measurement has the advantage in that it eliminates sources of error such as the accuracy and drift of
the excitation current source (provided by the AD7793) and the influence of the RTC sensor lead resistance.
The basics for 4-wire RTD ratiometric measurement and calculation using an ADC can be found at:

The schematics and part specifications used in this example are according to Figure 7 in
“Analog Front-End Design Considerations for RTD Ratiometric Temperature Measurements” by B. Zhang and A. Buda:
However, in the present example, reference resistor is 4.99 Kohm, 0.1%, 10 ppm/C.

For additional details about RTD signal conditioning, see "Completely Integrated 4-Wire RTD Measurement System
“Using a Low Power, Precision, 24-Bit, Sigma-Delta ADC circuit”, Note CN-0381 from Analog Devices:

The AD7793 and the Arduino Atmega328 R3 are connected in the following way :

Arduino R3 pin# AD7793 pin# Pullup resistors
8 GPIO 3 ~CS 50 KOhm
11 MOSI 16 DIN 50 KOhm
10 CS not connected
13 SCK 1 CLK 50 KOhm

  Ph. Sonnet, May 1, 2019
#include <AD7793.h>
#include <Communication.h>
#include <SPI.h>

unsigned long conv; /* The 24 bit output code resulting from a conversion by the ADC and read from the data register */
float Vref; /* The external reference voltage applied between pins REFIN(+) and REFIN(-)and resulting from the excitation current flowing through the reference resistor  */
float GAIN; /* Gain of the AD7793 unternal instrumentation amplifier */
float V; /* The voltage read on the analog input channel 2 (should be between -0.57 +0.57 when gain is set to 1) */
float RREF = 4990.0; /* The reference resistor: here, 4.99 Kohm, 0.1%, 10ppm/C */
float RRTD; /* The measured resistance of the RTD */
float temp; /* The temperature read on the analog input channel 1 */
float R0 = 100.0; /* RTD resistance at 0C */
float A = 3.9083E-3; /* Coefficient for t in the Callender-Van Dusen equation for temperature > 0C */
float B = -5.775E-7; /* Coefficient for t squared in the Callender-Van Dusen equation for temperature > 0C */

void setup() {
     unsigned char answer = AD7793_Init(); /* Initialize AD7793 and check if the device is present */
     Serial.print("AD7793 status = ");
     if (answer == 1) {
     else {
       Serial.println("Device is not present");
     AD7793_Reset(); /* Sends 32 consecutive 1's on SPI in order to reset the part */
     AD7793_SetChannel(AD7793_CH_AIN2P_AIN2M); /* Selects channel 2 of AD7793 */
     AD7793_SetGain(AD7793_GAIN_1); /* Sets the gain to 1 */
     AD7793_SetIntReference(AD7793_REFSEL_INT); /* Sets the reference source for the ADC. */
     conv = AD7793_SingleConversion();
     Vref = 1.17; /* This is the internal reference voltage provided by the AD7793, expressed in volt */
     GAIN = 1.0;
     V = 1000 * (conv - 8388608.0) / (8388608.0 * GAIN/Vref); /* Computes the read voltage from the conversion code, in mV */
     Serial.print("Voltage (mV) = ");

     Serial.println("Temperature (Celsius)");
     AD7793_Reset(); /* Sends 32 consecutive 1's on SPI in order to reset the part */
     AD7793_SetChannel(AD7793_CH_AIN1P_AIN1M); /* Selects channel 1 of AD7793 */
     AD7793_SetGain(AD7793_GAIN_32); /* Sets the gain to 32 */
     GAIN = 32.0;
     /* As the gain of the internal instrumentation amplifier has been changed, Analog Devices recommends performing a calibration  */
     AD7793_Calibrate(AD7793_MODE_CAL_INT_ZERO, AD7793_CH_AIN1P_AIN1M); /* Performs Internal Zero calibration to the specified channel. */
     AD7793_Calibrate(AD7793_MODE_CAL_INT_FULL, AD7793_CH_AIN1P_AIN1M); /* Performs Internal Full Calibration to the specified channel. */
     AD7793_SetIntReference(AD7793_REFSEL_EXT); /* Sets the voltage reference source for the ADC */
     AD7793_SetExcitDirection(AD7793_DIR_IEXC1_IOUT1_IEXC2_IOUT2); /*Sets the direction of the internal excitation current source */

     AD7793_SetMode(AD7793_MODE_CONT);  /* Continuous Conversion Mode */
     AD7793_SetExcitCurrent(AD7793_EN_IXCEN_210uA);/* Sets the current of the AD7793 internal excitation current source */
     delay(1000); /* Allows excitation current to settle before starting conversions*/

void loop() {
     conv = AD7793_ContinuousSingleRead();
     RRTD = RREF * (conv - 8388608.0) / (8388608.0 * GAIN); /* Computes the RTD resistance from the conversion code */
     temp = (sqrt(sq(A) - 4*B*(1.0 - RRTD/R0))-A)/(2*B);    /* Callender-Van Dusen equation temp > 0C */


How to implement the AD7793 library (Ph. Sonnet, Mach 29, 2019)

I have the same issue. I plan to use CN0326 for an Arduino project but I could not find and “simple, ready to customize” code for Arduino. or am I missing any? Because all the adverts says “it is arduino friendly” but no “complete” code available…

Hello @reha,

I am not showing anything with just the CN0326. It does look like there are some items with the ADI EVAL-ADICUP360

Also looks like we have a post on our EEWiki as well .


Hi Robert
many thanks for your reply… point is my goal is the same as Lenin mentioned. I would like to us CN-0326 board to measure pH and use it directly with uC which can be programmed in ARDUINO IDE: I don’t want to use EVAL-ADICUP360 because it contains a lot of components that I don’t need…