TA2003,Si5351a,Si4732などを組み合わせたエアバンド受信機の基板をデバッグしています。
始めに見つかったバグはRF基板からの電源入力供給すると異常電流が流れることでした。この原因はパネル部基板でRAWと+12V電源入力端子をつないでいたからでした。RF部基板からの+5VがPANEL部のLT1117を逆流し、Arduino pro miniに流れ込んでいたようです。ともかくRAWと+12V-VINのパターンをカットしたら治りました。
I’m going to debug the airband receiver PCB combining with TA2003, Si5351a, Si4732 and peripherals. The first found bug was to source irregal current from RF PCB to Panel PCB. This was caused by connection RAW with +12V in. The +5V supply of RF PCB may go reversely from LT1117 into RAW. I cut the connection trace and resolved.
次にはSi4732が動かなくて原因を探っていました。 Arduinoは以前作成したpro mini/ATmega328P搭載の1602A表示PANEL部を使っています。
The next issues are no starting og Si4732. I'm using the Panel PCB with mini/ATmega328P and 1602A.
I took up i2c scanning sketch and Si5351a/i2cLCD worked well.
で、原因は次の二つでした。
i2cスキャンに応答しないし、32.768kHz水晶が発振していないので焦りましたが、原因究明できました。
I found two issues for this.
1.アースべたパターン指定でSi4732のGND端子はべたパターンとつながっていたが、べたパターンは浮いていた。回路図エディタでGNDピン#15をGND接続した後、最後にべたパターンをGND指示したはずなので、なんだかおかしい。べたパターン指定後、念のためのVIAホール指定が不足していたのは不注意だった。I edited Si4732 #15 to connect to GND and after then I added the solid patern for this area. However KiCAD may discard this connection. I unfortunately missed to add the via holes for this solid patern.
2.RESET端子#9につながるArduinoポートがPINMODE指定なしでRESET端子が浮いてGNDレベルになっていた。3.3V/5V問題あるが、とりあえず5Vでプルアップ。
Reset node of #9 is open condition of GND when Arduino Pinmode not active.
I had reported "C meter refered with stray capacitance of ArduinoMPU nodes" ever. That can measure small value. This time I tryed the other way to measure charging time( time constant ) by using the internal resister of Arduino. We can use it as command of pinMode(DIGITAL_WRITE_PIN, INPUT_PULLUP);. Someone said the value is 10 - 30 k ohm. Once I failed but I tried again and finished.
My approach is next.
1. To calibrate by the standard capacitor of 104J and draw the value of the internal resister of Arduino.
2. To calculate with gotten time constant of RC circuit.
接続概念図は次です。The block diagram is here.
まずは内部プルアップ抵抗値がいくらなのか、この容量計試作で標準コンデンサーにする104Jポリプロピレンコンデンサをはじめとし、手持ちコンデンサーで確かめることにします。これは容量計試作のスケッチ内に入れた標準Cでのキャリブレーション関数を利用します。
To divert the function of get_R() in the sketch, I draw the internal pull up resister value out, according with my stock capacitors as below.
部品表記 フランクリン 取得プルアップ
発振LCM 抵抗値
Part name LCM data Resiter value gotten
104J 102.8nF 42.56kΩ OK
683K 70.7nF 44.47kΩ
473J 49nF 45.46kΩ
333J 32.9nF 44.12kΩ
47μ電解 45.55kΩ
102K 999.5pF 27.39kΩ NG
τ=63.2%RCになる電圧判定をADC取得値で行っており、ADCのサンプルレートが25kサンプル/秒(40μS)なので、10000pF以下は時間関係からして測れません。また、電解コンの容量がでかいものはかなり時間(1000μFで30秒ぐらい)かかります。 I'm using ADC data for judging to go over tau: time constant value. And ADC is working 25k samples per second so we can not measure less than several thousand pF. It takes half minute to measure 1000μF.
続く試作アイデアとしては、先の浮遊容量利用容量計とこの内部プルアップ抵抗利用容量計をLOWレンジ、HIGHレンジにし「Arduino UNOとLCD Keypadシールドだけで作るC容量計」かなと思います。
There is the other trial idea to combine these capacitance meter for lower and higher range.
// Measure time when C is charging up 63.2% of 5V full
// A2 port INPUT-PULL resister shall be calibrated at first
// Created by nobcha 2023.09.04-07
// remain issue: over time?
#include
// Capacitance between ANALOG_READ_PIN and Ground
// DIGITAL_WRITE_PIN will charge and discharge
float capacitance;
//Pullup resistance will vary depending on board.
//Calibrate this with known capacitor.
//const double E = 5.00; // GPIO voltage
//const double V = E * 0.632;
const int MAX_ADC_VALUE = 1023;
double R;
const int TAU = 0.632 * MAX_ADC_VALUE;
int KEY;
//LCD Keypad Shield is used
#include
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7);
// Momorize internal resister value
#include
#define R_ADDR 0
unsigned int internal_r;
unsigned long charge_time, start_time;
Serial.begin(9600);
Serial.println("C meter 2 V2.0") ; lcd.begin(16,2); lcd.setCursor(0,0); lcd.print("C meter 2 V2.0 ") ;
delay(2000);
EEPROM.get( R_ADDR, R ); // recover R value
void loop() { lcd.setCursor(0,0); lcd.print("Set C A1&A2--A3 ") ;
Serial.println("Set C A1&A2--A3") ;
while( (KEY=analogRead( KEYPAD_PIN))>880); // Get key input
lcd.setCursor(0,1); lcd.print("wait ") ;
Serial.println("wait") ;
if (KEY<80){ // If right arrow key, to calibrate
get_R_print(); // Shall be set the standard capacitor of 0.1uF
Serial.print("R=") ;
Serial.print(R, 03l) ;
Serial.println("ohm") ;
float get_C(void){
//Capacitor under test between OUT_PIN and IN_PIN
//Rising high edge on OUT_PIN
pinMode(ANALOG_READ_PIN, OUTPUT);
digitalWrite(ANALOG_READ_PIN, LOW);
2.2MΩ利用の充電時間計測のCメータで手持ちフィルムコンや電解コンを測ります。ところが、またや伏兵。電解コンで大容量になると2.2MΩでは何十秒もかかります。I checked my keeping film capacitors and aluminum capacitors. I found that the large aluminum capacitors ask much time to charge with 2.2mega ohm.
// Capacitance between ANALOG_READ_PIN and Ground
// DIGITAL_WRITE_PIN will charge and discharge
float capacitance;
//Pleae connect pullup resistance of 2.2Mohm.
//const double E = 5.00; // GPIO電圧実測値
//const double V = E * 0.632;
#define MAX_ADC_VALUE 1023
float R = 2200000;
const int TAU = 0.632 * MAX_ADC_VALUE;
int KEY;
//LCD Keypad Shield is used A0 for key
#include
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7);
#define KEYPAD_PIN A0
I had reported "C meter refered with stray capacitance of ArduinoMPU nodes" ever. That can measure small value. This time I tryed the other way to measure charging time( time constant ) by using the internal resister of Arduino. We can use it as command of pinMode(DIGITAL_WRITE_PIN, INPUT_PULLUP);. Someone said the value is 10 - 30 k ohm.
My approach is next.
1. To calibrate by the standard capacitor and draw the value of the internal resister of Arduino.
2. To calculate with gotten time constant of RC circuit.
接続概念図は次です。The block diagram is here.
ところが、内部抵抗値が安定しません。推定ですが、どうも他の端子状態の影響を受けるようで、15-30KΩの範囲で変化します。But in vain the experiment was no use. the internal resister of Arduino may not be stable.
ここで方針変更。充電用の抵抗2.2MΩは外付けにします。 I changed plan to add 2.2mega ohm outside.
こんな構成です。The block diagram is here.
前回の「アナログポート浮遊容量を利用したコンデンサー値測定法」の時、ポートの浮遊容量が30pFぐらいはあるとのことでしたが、今回は測定用アナログポートと充電放電用ポートも並列につながり、もっともっと容量は多そうです。I got the data of open circuit and it is about 100pF because there are two nodes tied.