¿ªÔÆÌåÓý

Some calculations on the IF filter and USB filter


 

Hello,

When analyzing the programs KD8CEC or Ubitx V4,5,6 I have a little trouble to understand how the different values of First IF, Second USB, Second LSB and int USB are calculated.
In the KD8CEC program, there are different examples, but I¡¯m having a hard time figuring it out.

The best is an example, and it speaks louder:
Let¡¯s imagine (These are examples) that I have a 45 MHZ filter that has a center frequency of 45002200 htz with a bandwidth of 7.5 KHtz on each side of this frequency, and then an SSB filter of 12000800 htz in center frequency with a bandwidth of 2.5Khz on each side?

What are the calculations to make to find these 4 values.
This will allow the most accurate adjustment of the filter configuration.
So:
First IF= ? Calculation formula
Second USB=?? same
Second LSB=?? same
Init USB=?? same
?
Knowing that in all programs seen, VFOA and VFOB still have the same value (7150000 and 14200000)
?
Thank you
?


 

Actually there¡¯s already literature on it. I¡¯m going to dig again

ex:?Re: #uBITX Firmware KD8CEC - IF-Shift etc. (groups.io)
[email protected] | Need some explanation on v4 sketch

cdt
....


 

Gerard,

Here's a few more old posts on how this works:
/g/BITX20/message/44515
/g/BITX20/message/44278
/g/BITX20/message/35235

Jerry, KE7ER


 

Jerry,
?
Yes, thank you. As I said, I¡¯m going to dig into the question and I found various posts explaining all this.

I would like to take this opportunity to ask you a question.
I always test with the KD8CEC version.
I noticed when turning the encoder at variable speeds that the frequency display could jump in "leaps".
I thought it was due to interference on the encoder because there are bounces.
What intrigues me, is when doing the BFO setting, I can turn the encoder at different speeds, the frequency display is always done in a linear way, that is to say in 5khz increments.
I therefore" wonder, if the program does not manage the encoder differently between BFO calibration and frequency change.
only an Arduino expert can see this in the CEC software

cdt


 

I use my own uBitx code, no idea what the other distributions are doing.

Yes, if the BFO tunes smoothly and the VFO jumps around, that does suggest a problem with the code.
I would expect the BFO and VFO would use the same code when reading the encoder,
first thing to do is see if that is not the case.
It could be that interrupts are active when tuning the VFO,
causing it to misbehave even if it uses the same code.

Jerry, KE7ER


On Sat, Sep 10, 2022 at 09:16 AM, Gerard wrote:
Jerry,
?
Yes, thank you. As I said, I¡¯m going to dig into the question and I found various posts explaining all this.

I would like to take this opportunity to ask you a question.
I always test with the KD8CEC version.
I noticed when turning the encoder at variable speeds that the frequency display could jump in "leaps".
I thought it was due to interference on the encoder because there are bounces.
What intrigues me, is when doing the BFO setting, I can turn the encoder at different speeds, the frequency display is always done in a linear way, that is to say in 5khz increments.
I therefore" wonder, if the program does not manage the encoder differently between BFO calibration and frequency change.
only an Arduino expert can see this in the CEC software

cdt


 

Note that my old posts were in reference to the old v3 uBitx from 2017.
The v5 and v6 uBitx hardware has an IF filter using 11.059 mhz crystals, not 12.000 mhz.
The passband is a couple khz lower than the nominal crystal frequency since we are using the
series resonant mode of the crystal in the filter, not the parallel resonant mode
which is more commonly used in oscillators.

The code in post 44278 assumes we want the BFO frequency always below the 12mhz IF passband
to avoid hetrodynes (and resultant audio tones) between the BFO and an oscillator on the Arduino Nano.
This was solved on v5 and v6 by moving to the 11.059 mhz crystals.
So now that code could be expanded to have four possible cases, where the VFO at clk2 is always high side,
clk1 into the second mixer can be either high or low side as per 44278, and the bfo can now be high or low side also.
Moving the BFO between high and low side will swap the sidebands, just like moving clk1 does.
Moving both the BFO and clk1 to the other side simultaneously will cause no change in the sideband selected.

Jerry, KE7ER


On Sat, Sep 10, 2022 at 09:23 AM, Jerry Gaffke wrote:
I use my own uBitx code, no idea what the other distributions are doing.

Yes, if the BFO tunes smoothly and the VFO jumps around, that does suggest a problem with the code.
I would expect the BFO and VFO would use the same code when reading the encoder,
first thing to do is see if that is not the case.
It could be that interrupts are active when tuning the VFO,
causing it to misbehave even if it uses the same code.

Jerry, KE7ER


 

Jerry,

Thank you for all your precisions.
My Ubitx is homemade.
It uses the MOTHY schematic that I modified a bit.
It is in double sided smd with an integrated CAG + TDA2030 amp.
The advantage of my mounting is that it can use a directly welded USB filter, or one can use removable filters.
I made two for 11MHZ and one for 12MHZ.
But this is not perfect in terms of response, it would be necessary to change some quartz.
The 12mhz is a little better.
The 45MHZ part is a bit different too, and I always feel like I¡¯m on the slope of the filter because the reception is very hard to align.
We¡¯re getting close to winter, il will have more time to look at that.

cdt


 

I have the old 16x2 display.? If that little Nano processor is too busy updating
graphics on the bigger displays, that could also cause trouble when tuning.

Jerry


On Sat, Sep 10, 2022 at 09:23 AM, Jerry Gaffke wrote:
It could be that interrupts are active when tuning the VFO,
causing it to misbehave even if it uses the same code.


 

Jerry,

The KD8CEC software uses the Nextion graphics card that has its own graphics processor for graphics update. Only data is being processed by the Nano.

Still, there is more data processing going on for the other features, so the point of the Nano being pushed to its limit could be true. ?I have not found a tuning problem with the CEC software.?


73
Evan
AC9TU


 

Gerald,

This is probably more than you wanted to know, but...

There is one central encoder reading function in the KD8CEC software "enc_read()". It also uses a polling approach as opposed to interrupt. The approach is a little unusual in that the encoder is connected to two Analog lines not the usual digitals. (I think this might have been borrowed from the original OEM uBITX software) So state changes are discovered by changes in voltage thru the ADC converter. There is also a time constant that is used to ensure that the voltage read is "stable".??

OT follows:
Although clever , it is a real pain in regards to porting KD8CEC code to a different processor. You need to special case each processor based on their voltage reference. Right now, Nano, NanoEvery, and Nano-BLE are happy with the original 500 (out of 1024 number) for "on". but Nano IOT and the Nano? RP Connect the number needs to be set at 200. We see what happens when I get around to trying the Teensy 4...

73
Mark
AJ6CU


 

Hello,
I think that it is only in these lines of code that there is a value to change in order to have a frequence scroll displayed without holes if we turn the encoder a little fast?
there are comments in the programming lines that can help?
it is not of capital importance, for the fun LOL

***
?s = enc_read();
?
? //if time is exceeded, it is recognized as an error,
? //ignore exists values, because of errors
? if (s == 0) {
? ? if (encodedSumValue != 0 && (millis() - encodeTimeOut) > lastEncInputtime)
? ? ? encodedSumValue = 0;
?
? ? lastMovedirection = 0;
? ? return;
? }
? lastEncInputtime = millis();
?
? //for check moving direction
? encodedSumValue += (s > 0 ? 1 : -1);
?
? //check threshold and operator actions (hold dial speed = continous moving, skip threshold check)
? //not use continues changing by Threshold
? //if ((lastTunetime < (millis() - skipThresholdTime)) && ((encodedSumValue *? encodedSumValue) <= (threshold * threshold)))
? if (((encodedSumValue *? encodedSumValue) <= (threshold * threshold)))
? ? return;
?
? lastTunetime = millis();
?
? //Valid Action without noise
? encodedSumValue = 0;
?
? prev_freq = frequency;
? //incdecValue = tuningStep * s;
? //frequency += (arTuneStep[tuneStepIndex -1] * s * (s * s < 10 ? 1 : 3));? //appield weight (s is speed)
? frequency += (arTuneStep[tuneStepIndex -1] * s);? //appield weight (s is speed) //if want need more increase size, change step size
? ??
? if (prev_freq < 10000000l && frequency > 10000000l)
? ? isUSB = true;
? ??
? if (prev_freq > 10000000l && frequency < 10000000l)
? ? isUSB = false;
? ??
? setFrequency(frequency);
? updateDisplay();
}

**


 

Gerald,

Thanks for the pointer! I will give this a try a little later today.

There is a definite "feeling" difference between the encoder working on a nano and that on one of the faster chips. I had played with the threshold for stability and got no where. I quite frankly missed the obvious line comment 10 lines down. :-)

73
Mark
AJ6CU


 

Gerald,

Just reporting back...

Unfortunately, that didn't work.? There is a clear difference between V1.2 and my "V2.0" when you spin the knob fast. In .1.2, nochange in display right away, but eventually it jumps. In my code, it just looses the change in the encoder position.? Oh well, have to keep this issue open. But the code you highlighted is exactly the problem area. Thanks again! (and sorry for hijacking this thread)

73
Mark
AJ6CU


 

Mark,

The N8ME with VU3GAO mods does not have an issue with the v6 stock display.? Since the Nano updates the display, it should have a higher load than the KD8CEC software.? You could look at that code for ideas on implementing the encoder software.

/g/BITX20/filessearch?p=name%2C%2Cn8me%2C20%2C1%2C20%2C0&jump=1


73
Evan
AC9TU


 

Hello Mark,

I came across this. I this it's one of your folder i think
There may be interesting things to discover for those who have a Nextion screen.

You wrote:

There are three main folders here:

  1. Original_KD8CEC - these are the ones that Ian Lee originally designed
  2. User_Contributed_Screens - these are screens that various users have enhanced or created
  3. Resources - currently contains artwork for various size screens that can be leveraged for new screens
It¡¯s a bible for the Nextion screens.
probably useful, because a lot of questions about that.

i download it (150Mo). Will made some tests later

Thank's
cdt

Thank's
?


 

Evan,

Thanks for the suggestion! Will definitely look at that.

I don't like the way the encoder is handled? in KD8CEC (which I believe lifted it from the OEM software) because it is not very portable. Some MCU's turnoff the pullups on analog line after a analogread (think that is true with the Nano BLE and RPConnect). So I had to add extra pinmodes to restore the pullups after every analogread. And of course, with different Vref's scaling on different processors, you can't count on 500 being half the scale...Yecch.

73
Mark
AJ6CU


 

Yes, I have been collecting the screens. They were scattered all over and was hard to find for a new owner of a uBITX. I am sure that there are some hidden gems there. On my todo list to try a few. :-)

73
Mark
AJ6CU?