VFO(6)

ディジタルVFOの場合,周波数ステップの切替えが必須かと思う.
ただ,実際操作してみるとステップ切替え操作はかなり煩わしいもので,なんとかしたいと思っていた.
切替え頻度を減らすにはパルス数の多いエンコーダを使えばよさそうだが,今一つスッキリ解決するような気がしない.それにエンコーダが高価.

そこで,特に目新しいものではないが回転速度を検出してそれに応じて連続的に周波数ステップを変化させるようにしてみた.ここに動画をUPしておく

今回試した方法は次のとおり.
ダイアル速度を vd,加速を始める速度しきい値を vth として,次式のように変数 L に積算していく.
(1) vd>vth のときのみ, L=L + (vd – vth);

また,速度 vdが 0 のときは,減速用の定数をRdec として,
(2) L=L – Rdec;   ただし,L<0 ならL=0;

次に,Lの値からRaccを加速率の定数として次式でステップ数を決める.

(3) ステップ=最小ステップ + Racc*L^n;

現状,n=2 としているが,他の定数も含め操作感に関わる値なので,いろいろと調整するといいと思う.また際限なくステップが大きくなるのを回避するためには,Lの上限を設定すればいい.

ダイアルの速度の検出は簡単で,エンコーダカウント値の絶対値が速度そのものなので,特に何か処理が必要なことはない.
公開しているソースで言えば,count という変数の絶対値が速度( vd=|count| ).
理由は,count はメインループの1回の処理時間当たりのカウント値なので,その絶対値はダイアルの速度に比例したものとなるため.

結局,メインループの処理1回で変化させる周波数Δfは,

(4)    Δf=count*( 最小ステップ + Racc*L^n );

動画は,
vth=2, Racc=0.002, Rdec=1.0, n=2, 最小ステップ=10[Hz]
で動作させたもの.

個人的には,ステップ切替えスイッチは無くてもいい,と思えるくらいの操作感になっていると思う.

VFO(6)」への32件のフィードバック

  1. Paul Taylor 2019年3月8日 / 3:55 AM

    “Since the speed of the dial is easy to detect”, how?

    Do you use a relative timer such as millis() and find the difference between subsequent calls? Or some other mechanism?

    The dial is brilliant, well done!

    VK3HN.

    いいね

  2. uebo 2019年3月8日 / 1:26 PM

    Thanks!
    The rotary encoder(RE) interface process is counting RE pulse and updating the valiable “RE_count” independently of main loop.
    In main loop, copying the value of “RE_count” to the local variable “count” and immediately clearing “RE_count”.
    Thereby the unit of “count” is [Encoder pulse number]/[Period of the main loop], that means its dimension is speed or velocity.

    JF3HZB.

    いいね

  3. MAc 2019年3月8日 / 6:52 PM

    Impressive, wonderful. SP9MRN

    いいね

  4. uebo 2019年3月9日 / 10:55 AM

    Thanks!

    いいね

  5. Glenn P 2019年4月1日 / 12:25 PM

    Hi, I love this project but can’t seem to find the ESP32 dev kit board.

    I did find this board on ebay that looks very similar. Although has less pins bought out.
    eBay item number:
    222445989691

    Is it possible to use this board? I tried uploading the sketch to it but with no success. It “fails to connect to ESP32, packet header problem”.

    I did install the ESP32 into the Arduino IDE. I used “ESP32 dev module” as the board. Then left the defaults except choosing the Port number.

    Glenn
    vk3pe

    いいね

  6. Glenn P 2019年4月1日 / 1:28 PM

    Update, I managed to upload now and have a display running OK. Had to hold down the BOOT button on the module for it to upload. My module is missing pins 17 & 16 for the Encoder so I used 34 & 35 which works. ie changed the 2 #defines for the A/B. Using a cheap encoder of 16 positions I think from eBay which misses every 2nd count. ie it counts in 20Hz not 10Hz at moment.

    glenn
    vk3pe

    いいね

  7. uebo 2019年4月4日 / 1:55 AM

    Operating BOOT button may be unnecessary by adding a 10uF capacitor between EN pin and GND.
    Since RX2 is IO16, TX2 is IO17,
    maybe you don’t need to change the pin assignment of the encoder.

    いいね

  8. Josep M Mallafre 2019年4月10日 / 5:36 AM

    Hola.
    Where can I obtain the schema and sketch ??
    Thnk´s
    Josep
    EA3BDD

    いいね

  9. Josep Mallafre 2019年4月10日 / 7:21 PM

    Hi.
    Where can i get this dds vfo for my Yaesu FT-101F ?
    Thnk´s
    Josep
    EA3BDD

    いいね

  10. Josep Mª Mallafré Sala 2019年4月11日 / 3:30 AM

    Hi.

    Tnk´s, thnk´s, thk´s. Josep

    ea3bdd

    いいね

  11. ea3bdd 2019年4月11日 / 5:08 PM

    Hi.Your name ?Your country ?Your calk sign ?Tnk’s for all info.Josepea3bddEnviado desde mi smartphone Samsung Galaxy.

    いいね: 1人

  12. uebo 2019年4月12日 / 1:45 AM

    Thanks for your report. I’m glad it worked well.

    いいね

  13. Glenn P 2019年4月25日 / 8:48 AM

    TJ, there is a problem with the code for this project:-

    With the default freq_step set to 10Hz

    Moving the encoder one way increases the frequency output in 10Hz steps but rotating the other way (anticlockwise) the output frequency decreases in 1Hz steps. NOT 10Hz steps.

    If I change the Increments value to 1000Hz, (#define freq_step 100;) clockwise moves the frequency output up in 1KHz steps OK,
    BUT anticlockwise moves the 1KHz AND 1Hz steps of the output frequency at the same time.

    I do not understand the code enough to know why this occurs. Can you please have a look at this.
    I put in a Serial.println to output the current frequency to the serial output. That is how I am seeing this fault.

    glenn
    vk3pe

    いいね

  14. uebo 2019年4月25日 / 9:18 PM

    I have confirmed the operation of the VFO system.
    However, the problem with your system could not be found here.

    If the freq_step is set to 10Hz, it is impossible the step becomes 1Hz with this program code.
    Since I cannot confirm such defect, It is difficult for me to identify the cause.

    In fact, I received the output of si5351 with a receiver.
    As a result, the frequency has changed very smoothly without any problems in my system.

    The difference between your and my system is about the encoder.
    It may be the cause of the problem.

    It seems that you can not use IO16, 17
    How about the following settings

    #define PULSE_INPUT_PIN 4 //Encoder A
    #define PULSE_CTRL_PIN 19 //Encoder B

    Tj Lab
    JF3HZB

    いいね: 1人

  15. Glenn P 2019年4月26日 / 8:12 AM

    Thanks TJ. I will have to look closer at my setup here..
    Glenn
    vk3pe

    いいね

  16. Jim - G3ZQC 2019年5月3日 / 5:06 PM

    Great project, even better than the videos. I bought the ESP32-DevkitC, but it uses the ESP32-WROVER-B module. As I discovered this doesn’t support pins 16 & 17 (even though they are brought out to pins). I changed to 26 & 27 and it works fine. Now to find a project I can use it in.

    Many thanks

    Jim – G3ZQC

    いいね: 1人

  17. Josep Mª Mallafré Sala 2019年5月4日 / 6:03 AM

    Hi. Tnk´s for information. It´s important for us. We are not very experts but with your information and that of Glenn we go ahead and learning. At the moment everything works for us. We hope to be successful. Josep ea3bdd

    いいね

  18. Jim Smith 2019年5月4日 / 6:37 PM

    Hi, No problem. It’s a steep learning curve though. Really clever piece of coding, just wish I could understand it better.
    73
    Jim – G3ZQC

    いいね

  19. uebo 2019年5月5日 / 12:12 AM

    Jim,
    Thanks for your report.
    Glad to hear that your system works fine.

    Tj Lab
    JF3HZB

    いいね

  20. James Smith 2019年5月7日 / 4:54 PM

    Hi,
    I did have a slight concern. The first encoder I tried was a mechanical one with detents (clicks). Each ‘click’ produced approximately 4 frequency steps. I assume the PCNT produces a count pulse for each change of state from encoder A and encoder B. I took the liberty of replacing the PCNT code with an interrupt driven scheme. Now I only get one frequency step per ‘click’. I replaced the mechanical encoder with a 120ppr optical one, and it works really well.
    Now to find a project worthy of the vfo.
    73

    Jim – G3ZQC

    いいね

  21. uebo 2019年5月8日 / 2:13 PM

    Jim,
    Thanks for the useful information.
    For using mechanical rotary encoders, as you did,
    I also think good to count pulses with interrupt driven.
    Yet, It’s comfortable to use the 120p/rev encoder, isn’t it?

    Tj Lab,JF3HZB

    いいね

  22. ea3bdd 2019年5月12日 / 7:06 PM

    Hi.I have some problem with the “Rotary.h” file.Where can I have the correct sketch ?JosepEnviado desde mi smartphone Samsung Galaxy.

    いいね

  23. Josep Mª Mallafré Sala 2019年5月13日 / 5:17 AM

    Hi. Sorry all. The last mail are a mistake. It´s an other project. Sorry. Josep

    いいね

  24. Henk 2019年6月16日 / 6:11 AM

    The same phenomenon occurs with me, I have flipped hardware A and B moderately, so that the encoder is flipped from left to right. But here too the steps down are slower than up. Therefore, it cannot be the decoder. It must be something in the software, but it cannot yet figure out what it is.
    The encoder that I use is an optical 600n. this decoder needs at least 7 volts (5v regulator internal), but because A and B are open collectors, it gives no problems with the ports of the ESP32

    いいね

  25. henkpe1hbw 2019年6月17日 / 5:33 PM

    Equal steps up and down solved!

    Find this line in Alternative Loop (core0)

    afstp=(long)(0.5 + (float)(count)*((float)freq_step + Racc*L*L) );

    and chance it to

    afstp=(long)(0 + (float)(count)*((float)freq_step + Racc*L*L) );

    The up and down steps are equal now

    いいね

  26. Josep Mª Mallafré Sala 2019年6月17日 / 6:53 PM

    Hi. Thnk´s for info. The Circular dial is working !!. Now we are whith the circuit for output to FT-7. A lot of problems with the schematic. Heave you an definitive schematic or is the same as alwais ?? Some photo would be helpful Thnk´s, thnk´s thnk´s josep ea3bdd

    . The schematic that we have,

    いいね

  27. Josep 2019年6月17日 / 7:19 PM

    Hi.
    Thnk´s for info.
    The Circular dial is working !!.
    Now we are whith the circuit for output to FT-7.
    A lot of problems with the schematic.
    Heave you an definitive schematic or is the same as alwais ??
    Some photo would be helpful
    Thnk´s, thnk´s thnk´s
    josep
    ea3bdd

    いいね

  28. Glenn P 2019年6月27日 / 10:03 AM

    How do you make the Font’s ? Some friends and I would like to have some other Font sizes for our implementation into a VFO project using your Sketch as a basis.

    Is there a program to generate other Fonts?

    いいね

コメントを残す

以下に詳細を記入するか、アイコンをクリックしてログインしてください。

WordPress.com ロゴ

WordPress.com アカウントを使ってコメントしています。 ログアウト /  変更 )

Google フォト

Google アカウントを使ってコメントしています。 ログアウト /  変更 )

Twitter 画像

Twitter アカウントを使ってコメントしています。 ログアウト /  変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト /  変更 )

%s と連携中