nobcha23の日記

PICマイコンやArduinoを使う電子回路遊びを紹介します

74HC04でフランクリン発振する? Can it oscillate by HC04 for Franclin oscillator?

74HCU04フランクリン発振器を使用したArduino制御のLCメーターを作りました。興味があるという人から使ってみての意見をいただいたので、改造改良やってます。

I made the LC meter based on Arduino and 74HCU04. A certain person was interested in it and I'm remodeling to depend on his comments.

1. フランクリン発振安定化待ちのタイミングを追加。(シミュレーションでも気が付いたのですが、この発振器は発振周波数が安定するのに時間がかかります)
To add wait for stabilization of Franclin oscillator.

2.L/C接続要求メッセージの改良。
To improve the message.

3. nH, uH, mH / pF, nF, uF 表記。sprintfのfloat未対応対策でとしてdtostrに替え3.1桁表示とした。
To display the result with 3.1 column of nH, uH, mH / pF, nF, uF.

4.F3表示が邪魔だとのことで、D8をGNDにつなぐとF3表示をやめます。
When D8 is Low, to stop displaying F3.

5.周波数カウンターのアルディーノライブラリーを変更した。
I replaced Arduino frequency counter library to FreqCount.
ということでv2.42です。
I uploaded v2.42 onto GITHUB.

それで新たに基板つくり部品集めと言うことになったのですが、74HC04を手配したとのこと。水晶発振回路などではHC/HCUどちらも使えたような気がしましたが、フランクリン発振回路ではどうでしょうか。
To gather the devices for the new PCB there happened mistaken to order HC04. I wonder to be able to use HC04 as same as HCU04 and I checked operation on LTspice as below.

ということでLTspiceで確かめてみました。残念ながら発振しませんでした。

HC04/HCU04 for Franclin OSC

Arduinoのcメーターを試しました

Arduinoアナログポートをまたいで、コンデンサーつなぐと容量値を測れるという技術紹介があったので、これは面白そうと、自分でも確かめてみました。

The principle of ARDU-C-Meter

元のスケッチではA0とA2なのですが、表示にLCDシールドを使うため、A1とA3にポートをずらしました。(お隣同士のA1とA2に一旦設定したら、端子間浮遊容量により誤差が増えたので、一つ置きにしました)

「アナログポート浮遊容量を利用したコンデンサー値測定法」と言うトリッキーなやりかたです。

A0ポートの浮遊容量(C1=約30pF)とA0-A2間に接続する被測定容量CTとの間の容量比から値を計算するようです。

手元にあったシルバードマイカコンデンサーを測りましたが、そこそこの値が出ます。

33pF
470pF

セラコンのせいか、容量が多すぎなのか表示がふらふらしたりします。

2200pF


Arduinoで電子工作
http://harahore.g2.xrea.com/arduino/arduino.html

Capacitance measurement with the Arduino Uno
https://wordpress.codewrite.co.uk/pic/2014/01/21/cap-meter-with-arduino-uno/

この方式での測定容量値は1~1000pFぐらいまでなので、それ以上には容量充電時間で測る方式に切り替えるらしい。
Capacitance Meter Mk II
https://wordpress.codewrite.co.uk/pic/2014/01/25/capacitance-meter-mk-ii/

スケッチ(LCD Keypad Shieldを使用)

// Refer "Capacitance measurement with the Arduino Uno"
// https://wordpress.codewrite.co.uk/pic/2014/01/21/cap-meter-with-arduino-uno/

const int OUT_PIN = A3; //Changed for LCD Keypad Shield used
const int IN_PIN = A1; //Changed for LCD Keypad Shield used

//Capacitance between IN_PIN and Ground
//Stray capacitance is always present. Extra capacitance can be added to
//allow higher capacitance to be measured.
const float IN_STRAY_CAP_TO_GND = 24.48; //initially this was 30.00
const float IN_EXTRA_CAP_TO_GND = 2.0; // tuned
const float IN_CAP_TO_GND = IN_STRAY_CAP_TO_GND + IN_EXTRA_CAP_TO_GND;
const int MAX_ADC_VALUE = 1023;

//LCD Keypad Shield is used
#include
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7);

void setup()
{
pinMode(OUT_PIN, OUTPUT);
//digitalWrite(OUT_PIN, LOW); //This is the default state for outputs
pinMode(IN_PIN, OUTPUT);
//digitalWrite(IN_PIN, LOW);

Serial.begin(9600);
lcd.begin(16, 2);
}

void loop()
{
//Capacitor under test between OUT_PIN and IN_PIN
//Rising high edge on OUT_PIN
pinMode(IN_PIN, INPUT);
digitalWrite(OUT_PIN, HIGH);
int val = analogRead(IN_PIN);

//Clear everything for next measurement
digitalWrite(OUT_PIN, LOW);
pinMode(IN_PIN, OUTPUT);

//Calculate and print result

float capacitance = (float)val * IN_CAP_TO_GND / (float)(MAX_ADC_VALUE - val);

Serial.print(F("Capacitance Value = "));
Serial.print(capacitance, 3);
Serial.print(F(" pF ("));
Serial.print(val);
Serial.println(F(") "));

lcd.setCursor(0, 0);
lcd.print("Cap = ");
lcd.print(capacitance, 3);
lcd.print(" pF ");


while (millis() % 500 != 0)
;
}

nanaoVNAでブレッドボード使い、フィルターを観測。 I checked the passband characteristics by using nano VNA and the bread board

PICデバッグArduinoデバッグを行う際は、ブレッドボードにお世話になっています。でもブレッドボードではRF実験には無理だろうと決めつけてました。

ところが、WEBを見ているとFMラジオや100MHz領域でブレッドボードを使うOBのブログ、などたくさんあります。

I thought that the bread board was no use for RF experiment because of its stray capacitor and inductance.
According with several OMs' blogs, they used it for RF circuit.


ちょうど今Si4732を使い,各種帯域に対応するラジオを試作しようとしていますので、色々な帯域のフロントエンドフィルター実験をブレッドボードを使いやってみることにしました。ブレッドボードの中にはこんなクリップ金具が仕込まれています。

I'm planning to design the multi band radio with Si4732. To correspond a number of bands, I shall make experiment for the front end filter.

Bread Board clip


やっぱり心配なので、ブレッドボードではどれぐらいの浮遊容量とかインピーダンスあるのか、ざっとnano VNAで調べてみます。以前に作った50オーム治具を使います。

50Ωマッチング抵抗付き治具の部品
<>
コイル治具

Prior to use the bresd board, I checked the stray capacitance and inductsnce for the bread board clip terminals.
I used the 50ohm resister loaded jig for measuring the stray capacitance and inductance with nano VNA.

リード線使い治具をブレッドボード隣同士に接続、クリップ反対側では隣同士をショートします。クリップ往復のインダクタンスがわかるはず。
I connected nano VNA with the breadbosrd neighboring clipa. And I shorted on he other side of clips.

The connection with the breadboard

お隣配線板との容量、配線板の端と反対側端とのインダクタンス。
Within the bread board there are alligning a number of the clips as below.

BB OPEN

It is the capacitance bedween the neighbour clips.

隣通しの配線板で数pFの容量、配線板の端っこと端っこで十数nHぐらいの迷インピーダンスがあるようです。

The length os the clip metals brings some ten nH inductance and the neighboring clips keeps several pF between the both ones.

Shorted


では10MHzのローパスフィルターの実験をします。パラメーターはELSIEでシミュレーションしたものです。

Then I made the experiment for the low pass filter on the bread board.
The coil parameters were driven out by ELSIE simulation.

Circuit

1μHのコイルは手持ちのアミドンコアを使って作ります。T50-6が手近にあったので使いました。ALSから計算し巻き数18tを決めます。
コイル治具を使ってnanoVNAで測ると少しインダクタンスが多くなったので、16tに減らすとちょうどよい値になりました。

I made up 1μH coils from T50-#6 cores. Regarding with ALS value I decided 18 turns but I changed 16 turns after measuring with nano VNA.


コイルが出来上がったところで、ブレッドボードを用いて回路を組み合わせ、VNA SAVERを使って測ってみました。
I assembled the circuit on the bread board and investigated it by nano VNA.

TRY1

ELSIEの結果21.4MHzでの減衰量はよいが、肩の落ちが大きい。
It is coincident of 21.4MHz supression between the result of ELSIE and the output from nano VNA.

ELSIE result

試しにコンデンサーの容量を少なくしてみました。でも肩の落ちがブロードで見直し必要です。

TRY 2

eBAYwww.ebay.com

コイルを測り、コア選別  Identfying cores by measuring coil values

エアバンドのループアンテナ試作にコアを使おうと考えました。ところがジャンク箱に何種類かのトロイダルコアがあるものの整理が悪く、コア材は何なのか、使えるのか不明なため、調べてみることにしました。

先日試作したArduino使用フランクリン発振回路方式のLCメーターとnanoVNAを使ってみます。

Arduino Nanoで作ったLCmeter

nobcha23.hatenablog.com


最新版のLCメーターは測定精度はともかく、数nHまで表示できるので、今回のΦ5・2Tコイルでもなんとか応答します。測定端子のワニ口クリップ配線はおおよそ数nHぐらいあるようですので、測定結果を割り引いて考えないといけません。


次にnanoVNAの方ではCH0でのSパラメーター読み取りでのインダクタンス値を10kHz,10MHz、100MHz、150MHzでの値を参照します。CH0ポートはケーブルで丸筒形ICソケットのピンを使った治具をつなぎますが、その前にケーブル端でキャリブレーションしておきます。

測定用治具

以上の準備をし、LCメーター、nanoVNA+治具を使い、手元のトロイダルコアに2tコイルを巻き、測定した結果が次になります。

測定結果

ここでもともと素性が分かっていたフェライトコアはなるほどの結果。今回探しているコアはカーボニル鉄らしいのが使えそうと判明しました。#7はTDK製のMn-Zn系のコアのはずです。

nano VNAのスミスチャート表示では測定補助用50オーム純抵抗に対して、Qが高ければ、周波数に応じてL分だけしか変化しないので、50オームの円弧をたどるはず。Qが落ちれば、円弧から外れるというのがS11のスミスチャートからみたQ劣化観測ということになりそうです。

今回の結果により#7のコア(アミドンのT37-#6と思われる)が実験試作用に使えそうです。



This time I would like to use a toroidal core for the trial making of an anntena . There are a number of cores in my junk box and I shall identify an adequate one from those. I used the Arduino LC meter and nano VNA to measure the inductance of coils used those cores.

The Arduino LC meter is good to measure the small coil inductance as several decade of nH. There is several error number by the jig and intrinsic circuit. However the gotten value is similar with gotten value by nanoVNA. The nano VNA is cooler than LCM because of measuring depending upon the frequency .

The result of this experiment I found #7(Estimated T25#6) sample being suitable for my next trial.

The list of the measured coils wounded on cores
The jig for nano VNA use
The coils

There are the result of nano VNA meassured. S-parameter trasing shape may be dependent on its core material's nature.

Thia is bare coil.

The bare coil

This is the result for FB-101 ferrite core coil.

FB-101

This is thr result for the carbonol iron dust core.
>

The carbonil iron core
<

PCB from PCBWay


YAHOOショッピング

blog.with2.net

www.youtube.com

シリアル信号線モニター by Arduino

最近友人の会社で制御回路開発を手伝っております。対象の制御回路ではシリアル通信経由で内蔵ユニットを制御するのでデバッグ実験にはシリアル回線モニターが欠かせません。

以前作成したエアバリアブルさん設計のモニターを使ってました。
ローコストLCDシリアル通信モニター(外部クロック版)

今回さらに必要となり、Arduinoで同じようなものを作ってみました。

Arduino Nanoで作ったシリアルモニター

Arduino NANOとi2cインターフェイス液晶をつなぎ、Arduino標準シリアルポートを使います。RX端子にモニター信号を入力します。

Arduino Nano用ヘッダー拡張シールドを使用

通信速度は立ち上げ時にポート設定を参照して、4800,9600,19200,38400を選べるようにしました。



// Serial monitor by using serial monitor
// Received data goes to i2c LCD of 2004
// i2c接続の2004液晶にシリアルポートで受信したデータを流し表示します。
// 電源投入あるいはリセット時のD3・D4入力状態でシリアル通信の速度を
// D3/D4 00:4800,01:9600bps, 10:19.2, 11:38.4kbpsで選びます。
// データが0x0Aだと、カーソルを次の行先頭に移動させます。
#include
int char_count = 0;
char data;
volatile int lcd_cursor;
long Speed[4] = {4800,9600,19200,38400};
int speed_sel;
// LiquidCrystal_I2C型変数の宣言
LiquidCrystal_I2C lcd(0x27, 20 , 4); // 0x27のアドレス,20列4行のLCDを使用
void setup() {
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
speed_sel = digitalRead(3); // Speed D3/D4 00:4800,01:9600, 10:19.2, 11:38.4
speed_sel = (speed_sel << 1) + digitalRead(4);
Serial.begin(Speed[speed_sel]);
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Monitor");
lcd.print(Speed[speed_sel]);
lcd.print(" 2004 ");
lcd_cursor = 1;
lcd.setCursor(0, lcd_cursor);
}
void loop() {
if (Serial.available() > 0) {
data = Serial.read();
char_count++;
lcd.print( data );
if((char_count%20) == 0){
lcd_cursor++;
if(lcd_cursor >= 4) lcd_cursor = 0;
lcd.setCursor(0, lcd_cursor);
delay(1);
}
if(data == 0x0A){
lcd_cursor ++;
if(lcd_cursor>4) lcd_cursor = 0;
lcd.setCursor(0, lcd_cursor);
delay(1);
}
}
}




LC meter debugging LCメーターの実験検討

franclin発振回路を使い、Arduinoで制御するLCメーターを色々と触っています。

LC meter PCB

基板を作って実験を進めています。測定値がなかなか安定しないので原因をLTspiceから推定しました。fanclin発振回路はコルピッツ/ハートレーなどの発振回路と違い、浅いバイアスの増幅回路で動作しているので、発振安定に至る時間が長く、外乱に弱いようです。

LTspiceでみても、発振安定まで電源ONから数百mSかかるようです。

Start-up for Franclin oscillator

なので、Arduinoのスケッチを修正し、発振条件切替ごとに0.5秒程度のDelay()を入れました。スケッチV2.4はGITHUBに掲載しています。


電源ONからキャリブレーション、測定までの操作説明をYOUTUBEに掲載しました。 
youtu.be


I'm trying LC meter of Franklin oscillator by Arduino. I had made PCB and assembled it. I estimated the cause of measuring instability.
Franklin oscillator is based on A-type amplifier on sharrow biassing unlike the Colpitts or Hartley oscillator. By LTspice simulation, .tran result reported slowly winding up of oscillation.

Accordingly, I reedited the sketch of Arduino to take some timing between parameter switching chances.


I will introduce how to operate the LC meter on YOUTUBE.


If you are interested in this circuit, you can purchase the bare PCB from PCBWAY as below.
PCB from PCBWay

nobcha23さんのランキング集計結果

LCMの74HCU04フランクリン発振回路をLTSPICEで試す I simulated 74HCU04 franclin oscillator on LTSPICE

Arduino環境にFranclin発振回路利用LCメーターを移し、基板作りしました。Franclin発振回路どんなが動作しているのかLTSPICEで確かめてみることにしました。

At first I made LC meter with PIC MPU, and I diverted it into Arduino environment recently. I made up PCB.
This time I confirmed the operation of Franclin oscillator by 74HCU04.

74HCU04のフランクリン発振回路をLTSPICEでシミュレートしたのはかなり昔です。
Ever I took it up for LTSPICE.
nobcha23.hatenablog.com


あれからPCが二種類ぐらい変わり、数回クラッシュしているので、データは残ってません。まず74HCU04を探さないといけません。以前引用したNXPのサイトは404です。(10年前の書き込みですが、結構アクセスあるようです)

After then my PCs crashed several times and I lost SPICE library. I accesed the site of NXP but in vain they replied 404.

今回やり直しで、色々ググったら、以前のNXP系のデータが見つかりました。次のようにして、.asyと74HC色々ファイルの.libを取り込みシミュレーションしました。
I serched with GOOGLE, and I found the data based on NXP as below.

(1) スケマチックスは次からDLし、74hcu04.asyのファイル名でLTspiceのsymフォルダ内に入れる。
Got data from below site and saved it as 74hcu04.asy into the holder of LTspice's \sym.

http://ltwiki.org/files/LTspiceIV/lib/sym/Dig_Add/74HC/74hcu04.asy

これが回路図データになり、Componentで出てくる。

(2) シミュレーションデータは次のところにあり、74HC.libで74HC全部sym取り込みlibフォルダ内に入れる。

Got data from below site and saved it as 74HC.lib of fully HC data into the holder of LTspice's \lib.

http://ltwiki.org/files/LTspiceIV/lib/sub/74hc.lib


Edit→SPICE Directiveで呼出せるようSPICEdirective指定する。(74hcu04.asyが74hcu04のシミュレーションデータを呼び出す時に参照。)
Set SPICEdirective of .lib 74hc.lib to call up.
.lib 74hc.lib

(3)74hcu04.asyでは供給でんげんに外部から"Vcc"で5Vを与えないといけない。直流電源を追加しVccをラベル指定。

74hcu04.asy asks power supply as "Vcc" so I add DC voltage of 5V.

(4)動作初期条件を与えないと発振開始しないので、Edit→SPICE Directiveで
.ic V(n003)=1Vとした。

It is nessesary to drive the intial condition of the node voltage to set SPICE Directive of .ic V(n003)=1V.

(5)以上をごにょごにょしてとりあえず発振しました。 It worked well.

74HCU04使用フランクリン発振回路のLTSPICE

次にはF1,F2,F3などを求めたり、誤差要因などを試してみたいと思っております。

Afterword I will try to simulate F1, F2, and F3, I would like to confirm the function of LC meter.

本項続く・・・
Continue.

www.youtube.com