CN-0326 pH と温度センサ-SPI 接続

dlenin20

私は(pHと温度用の)CN0326センサを持っています。
それをSPI 経由でArduino ボードに接続しています。
最初にデバイスが検出されません。(Arduino サンプルコードを使用)
どなたか立ち上げるのを手伝っていただけませんか?



Robert_Fay TechForum Lead

EVAL-ADICUP360 EcoSystem を使ってCN0326をArduinoに接続しようとしていますか?

使用している回路図とコードへのリンクを見せていただけますか?

-Robert



dlenin20

Robertさん、

 EVAL-CN026-PMDZ-REV.B のボードのみ使っています。
 これをSPI接続でArduino UNO ボードにつないでいます。
 SPI - Slave(CN0326)         SPI - Master(Arduino)

(添付ファイル example_volt_rtd_ad7793.ino がありません)

readme_txt.txt (10.7 KB)

(添付ファイル ad7793_cpp.c がありません)

(添付資料 ad7793_h.c がありません)

(添付ファイル communication_cpp.c がありません)

(添付ファイル communication_h.c がありません)



dlenin20

Robertさん、

 EVAL-CN026-PMDZ-REV.B のボードのみ使っています。
 これをSPI接続でArduino UNO ボードにつないでいます。
 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

入手できるコード(AD7793 コードのダウンロード)をチェックしています。
-これと共にコード(.ino)と他のコードもコピーしました。

ハードウェアの接続、供給電圧レベル、その他ハードウェアレベルの要件、
それからソフトウェアをチェックしてください。

SPI だけは確認しました。この評価ボードで利用できるI2Cや
UARTのようなプロトコルサポートは他になにかありますか?

サポートされているプロトコルの基本的なテストコードを教えてください。
また、ftp からダウンロードしようとしているとき、ウェブサイトそのものに接続されないのは
この評価ボード用のCDが受信できていないと思いますが、教えてください。

よろしくお願いします。
Lenin

example_volt_rtd_ad7793.ino

/*
この例はAD7793コンバータを用いて2つの測定を連続して実施する方法を示すものです。

  1. AD7793のチャンネル2で、0から0.58Vのレンジで電圧を読み取る(0.58 = 1.17V AD7793内部基準レベルを2で割った値);
  2. 4線式PT100 RTD とAD7793のチャンネル1のレシオメトリック測定回路を使用して繰り返し温度を読み取る(最大144℃まで;
    これより高い温度やPT1000を使用する場合は、ゲインを下げるだけです)。

レシオメトリック測定でRTDを使用すると、(AD7793から供給される)励起電流源の精度やドリフト、RTCセンサのリード抵抗の影響などのエラーの原因が排除されるという利点があります。
ADCを使用した4線式RTDレシオメトリック測定と計算の基本は次の場所にあります。

この例で使用されている回路図と部品仕様は、B. Zhang とA. Buda 「RTD レシオメトリック温度測定のアナログフロントエンド設計の考察」の図7によるものです。
ただし、今の例では、基準抵抗は4.99 KΩ、0.1 %、10 ppm/℃です。

RTD信号調整の詳細については、「完全に統合された4線式RTD測定システム”低電力、高精度、24ビット、シグマデルタADC回路の使用”」Analog DevicesのノートCN-0381を参照してください。

AD7793 とArduino Atmega328 R3 は次のように接続されています。

Arduino R3 ピン# AD7793 ピン# プルアップ抵抗
8 GPIO 3 ~CS 50 KΩ
9 RDY 15 DOUT/~RDY
12 MISO 15 DOUT/~RDY
11 MOSI 16 DIN 50 KΩ
10 CS 未接続
13 SCK 1 CLK 50 KΩ

  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() {
Serial.begin(9600);

 unsigned char answer = AD7793_Init(); /* Initialize AD7793 and check if the device is present */
 Serial.print("AD7793 status = ");
 if (answer == 1) {
   Serial.println("OK");
 }
 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(V);

 Serial.println("Temperature (Celsius)");
 Serial.println("====================");
     
 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)/(2B); / Callender-Van Dusen equation temp > 0C */
Serial.println(temp);
delay(1000);
}

readme_txt.txt

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



reha

こんにちは、
私も同じ問題を抱えています。ArduinoプロジェクトにCN0326を使用する予定ですが、Arduinoの「シンプルですぐにカスタマイズできる」コードが見つかりませんでした。あるいは私が何か見逃しているでしょうか?すべての広告が「フレンドリなArduino」と言っているのに、利用可能なコードが...



Robert_Fay TechForum Lead

rehaさん、こんにちは

CN0326については分かりませんでした。 ADI EVAL-ADICUP360 にはいくつかのアイテムがあるようです。

また、EEWiki に投稿があるようです。
https://www.digikey.com/eewiki/display/microcontroller/EVAL-ADICUP360+Precision+Analog+Development+Platform

-Robert



reha

Robert さん、こんにちは
お返事ありがとうございます。...言いたかったのは、私の目的がLeninと同じだということです。CN-0326 ボードでpHを測定し、ARUDINO IDEでプログラムできるuCで直接使用したいと思っているのです。EVAL ADICUP360には必要のないコンポーネントがたくさん含まれているので使用したくないのです。...




オリジナル・ソース(英語)