ダイアル速度を vd，加速を始める速度しきい値を vth として，次式のように変数 L に積算していく．
(1) vd>vth のときのみ， L=L + (vd – vth);
また，速度 vdが 0 のときは，減速用の定数をRdec として，
(2) L=L – Rdec; ただし，L<0 ならL=0;
(3) ステップ=最小ステップ + Racc*L^n;
公開しているソースで言えば，count という変数の絶対値が速度（ vd=|count| ）.
(4) Δf=count*( 最小ステップ + Racc*L^ｎ );
vth=2, Racc=0.002, Rdec=1.0, n=2, 最小ステップ=10[Hz]
“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!
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.
Impressive, wonderful. SP9MRN
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:
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.
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.
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.
Where can I obtain the schema and sketch ??
Where can i get this dds vfo for my Yaesu FT-101F ?
You can download the schematic and sketch from
Tnk´s, thnk´s, thk´s. Josep
WORKS VERY WELL see http://www.carnut.info/FT-7_Yaesu_repairs/FT-7%20Digital%20VFO%20and%20Display/Yaesu_FT-7_digital-VFO-Display.html
Hi.Your name ?Your country ?Your calk sign ?Tnk’s for all info.Josepea3bddEnviado desde mi smartphone Samsung Galaxy.
Thanks for your report. I’m glad it worked well.
My name is Glenn, VK3PE in Melbourne Australia.
I have updated my web page with a little more information on what I did for this great project.
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.
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
Thanks TJ. I will have to look closer at my setup here..
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.
Jim – G3ZQC
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
Hi, No problem. It’s a steep learning curve though. Really clever piece of coding, just wish I could understand it better.
Jim – G3ZQC
Thanks for your report.
Glad to hear that your system works fine.
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.
Jim – G3ZQC
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?
Hi.I have some problem with the “Rotary.h” file.Where can I have the correct sketch ?JosepEnviado desde mi smartphone Samsung Galaxy.
The correct sketch and files can be downloaded from
The set of sketch and files does not contain the file “Rotary.h”.
First of all, “Rotary.h” is not necessary.
Tj Lab, JF3HZB
Hi. Sorry all. The last mail are a mistake. It´s an other project. Sorry. Josep
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
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
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,
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
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?