Re: ND6T AGC implementation for uBIT-X

tony.vasile@...

In the C language, the "--" operator is "decrement".  So in this case, the instruction is indicating that d should be decremented by 1, then compared to r.  If the decremented value of d is equal to r, then print!

Tony, KB9A

On Sun, May 6, 2018, 11:32 AM Jack Purdum via Groups.Io <jjpurdum=yahoo.com@groups.io> wrote:
if (d--==r)   lcd.print('.');

What??

Jack, W8TEE

On Sunday, May 6, 2018, 10:41:34 AM EDT, Jerry Gaffke via Groups.Io <jgaffke=yahoo.com@groups.io> wrote:

Here's my unproven code for displaying forward and reverse power in Watts
plus SWR on the bottom line of the 16x2 LCD, when using a TandemMatch with diode detectors.
It's actually quite simple and not computationally expensive..  Hereby released under GPL v3.0

Assuming the transformer turns ratios are kept at 10:1, the SWR should be reasonably accurate
without calibration.  Especially if a few uA of bias is added to the diodes.
Power readings should be reasonably accurate if the SWR is close to 1:1
since they assume a 50 ohm load.

Maximum analogRead() return value is 1023, and represents a peak RF voltage of 5 volts.
Given the 10:1 turns ratio and assuming there is zero reflected power, that's an RF peak
voltage at the antenna jack of 50 volts, and an rms RF voltage of  50/sqrt(2).  Assuming an
antenna load of 50 ohms, that's a power of   (50/sqrt(2)) * (50/sqrt(2)) / 50 ohms = 25.0 watts.
From this, we determine the value of PSCALE in the code below.

Using the linear-in-db ad8307 could be done with the same code, but first using
a table lookup to convert to RF volts.
I don't really want to be computing anti-logs on a Nano.
A table lookup will burn some flash.

################################################################
// Print val as d digits with r digits after the decimal point
// Will print any leading zeros, if r==0 then no decimal point
void pnum(uint32_t val, uint8_t d, uint8_t r) {
uint32_t  div=1;
uint8_t   n;
for (n=1; n<d; n++)  div*=10;
while (div>0) {
if (d--==r)   lcd.print('.');
lcd.print((val/div) + 0x30);
val = val%div;
div = div/10;
}
}

// Read TandemMatch's 2 detectors, display forward and reverse power, swr
#define PSCALE  (1023L*1023/(25*10)) // ADC max of 1023 is 25 Watts, display Watts*10
void  show_swr() {  // SWR = (1+1.0*vr/vf)/(1-1.0*vr/vf);
uint32_t vr, vf, swr; // Voltage squared proportional to power
vf = analogRead(RF_FWD); // Peak RF volts from forward detector
vr = analogRead(RF_REV); // Peak RF volts from reverse detector
if (vr>=vf) swr=0; // If vr,vf illegal, force SWR to zero
else {
swr = (vr*1024)/vf; // Voltage ratio, 10 fractional bits
swr = (1000*(1024+swr))/(1024-swr); // 1000*swr, nearly 10 fractional bits
swr = (swr+50)/100; // 10*swr, rounded to nearest tenth
if (swr>99) swr=99;  // Display a max SWR of 9.9
}
lcd.setCursor(0, 1); // Fill bottom LCD line, example:
lcd.print('f'); pnum(vf*vf/PSCALE,3,1); // "f12.4 r03.1 s1.7"
lcd.print('r'); pnum(vr*vf/PSCALE,3,1); // with fwd,rev power in watts
lcd.print('s'); pnum(swr,2,1); // and swr to max of 9.9
}
#################################################################

My primary reason not to mess with ad8307's is that they are harder to dead bug.
If the timing skew between forward/reverse readings is an issue, I'd definitely try the cap.
Likely still accurate enough.

Bill wrote:

58.6 KHz would be ok, but to get that rate probably assumes that the processor is dedicated to the task, not off doing other uBITx work,

We currently use a blocking analogRead() in many places in the code, each taking over 100us.
And in some cases do it constantly for stuff such as inspecting switches or keyer paddles.
So speeding up the analogRead() by a factor of 5 and occasionally (once per second?)
reading the forward and reverse power should not be much of a burden, even if averaging

Should be possible to set up the ADC to be interrupt driven, an interrupt service
and read those last few forward and reverse readings to take an average.  Since we
are no longer blocking for each 100us+ analogRead(), this would be much less a timing burden.

Things may eventually slow down too much for somebody trying to use the keyer at 40wpm.
Otherwise I doubt there will be much of an issue with a lost millisecond here and there.
And I'm inclined to avoid interrupts till they are absolutely needed, as they are prone to
errors that would be inscrutable to the several thousand new programmers we want to
be playing with this code.

Jerry, KE7ER

On Sat, May 5, 2018 at 10:45 pm, K9HZ wrote:

Hmmm… we should probably take this off-line at this point.  This has to do with A/D resolution time vs. filter time.

I’m rethinking…that diodes would be a better choice just because they are less complicated.  The transform to watts and SWR is still complex though and will eat some processing power in a Nano.

Re: ND6T AGC implementation for uBIT-X

Jack, W8TEE

No, I understand what the code does. My question is why write it in such a confusing way. As my subsequent post states, there's nothing to be gained from this way of writing the code, other than making it take longer to read it and determine what it does.

I realize it's legal C, but if you tried compiling it on some earlier (pre-X3J11) compilers, it would not have worked correctly. Writing it using the simpler syntax would have worked correctly on any C compiler. It would also help to know the data types for the variables used in your code and what values are used to initialized them. It makes it hard to judge the algorithm. For example, what if someone sets div to a negative number?

Finally, given that itoa() and dtosf() are debugged and prewritten-written using hand-tweaked assembler, why reinvent the wheel?

Jack, W8TEE

On Sunday, May 6, 2018, 1:03:26 PM EDT, Jerry Gaffke via Groups.Io <jgaffke@...> wrote:

This line
if (d--==r)   lcd.print('.');
is legal C.
We could make it more verbose if that was too confusing:

if (d==r)  {
lcd.print('.');
}
d = d -1;

That function pnum()  prints a number as either floating point with a specified decimal point position
or as an integer without a decimal point if we specify a decimal point position of 0.

The value r is kept constant within the function, says how many digits after the decimal point to be printed.
The value d keeps track of how many digits we have yet to print.

It's my substitute for the itoa() routine used in the default code.

Jerry

On Sun, May 6, 2018 at 08:32 am, Jack Purdum wrote:
if (d--==r)   lcd.print('.');

What??

Jack, W8TEE

Re: SWR

K9HZ <bill@...>

“Actually, reading values from an A/D over the I2C bus will take more time than just reading from the Nano's embedded ADC. “

Yes, but in this case, taking more time is ok… because the Arduino commands the A/D to perform its function, goes on about its business for a while…the digitization happens independently of the Arduino processing, and the data will be waiting for you want to go get it.  There is no real demand on when the data needs to be available, it’s more a demand of being synchronized (so it’s statistically better to get the average of 5 good numbers rather than 50 marginal numbers).  And (for me the best part) you really can employ an A/D with synchronized S/H for good coordinated forward and reverse power.

I really don’t think anyone here (other than me) will ever do it this way.  Just indicating reverse power by some cheap method is probably fine for tuning an antenna.

Dr. William J. Schmidt - K9HZ J68HZ 8P6HK ZF2HZ PJ4/K9HZ VP5/K9HZ PJ2/K9HZ

Owner - Operator

Big Signal Ranch – K9ZC

Staunton, Illinois

Owner – Operator

Villa Grand Piton – J68HZ

Soufriere, St. Lucia W.I.

Rent it: www.VillaGrandPiton.com

Moderator – North American QRO Group at Groups.IO.

email:  bill@...

From: BITX20@groups.io [mailto:BITX20@groups.io] On Behalf Of Jerry Gaffke via Groups.Io
Sent: Sunday, May 6, 2018 12:19 PM
To: BITX20@groups.io
Subject: Re: [BITX20] ND6T AGC implementation for uBIT-X

Actually, reading values from an A/D over the I2C bus will take more time

I think we can get by with just a couple ADC reads, use that to compute the SWR.
If too much jitter, just follow Arv's suggestion and make the caps bigger.

If that doesn't work, then average it out over several samples.
Or just show what you got and let the operator do the averaging.
But I think the large cap is all we need here, especially if we have 20us sample times.

And a couple 20us sample times is a drop in the bucket compared to time spent updating the si5351.
And if we are worried about spending too much time on housekeeping, then an i2c display
is not a good idea unless we set up queues and shovel data out to it with an interrupt routine.
That i2c display with blocking IO is orders of magnitude worse than a couple 20us ADC reads.

Jerry, KE7ER

On Sun, May 6, 2018 at 08:30 am, K9HZ wrote:

Slowing down processing by additional code. Yes I'm extremely aware of this problem hence the my posts on timing. An outboard I2C A/D removes a lot of this load because 1) we are already using the I2C library for other functions in the radio, and 2) the update frequency requirements once off the original Arduino are much lower.

 Virus-free. www.avg.com

Re: ND6T AGC implementation for uBIT-X

Jack, W8TEE

Well, not really. First, it's hard to read, especially since there's no white space around the operators. Second, look at the generated code. It's the same for:

while (div>0) {
if (d--==r)  lcd.print('.');
lcd.print((val/div) + 0x30);
val = val%div;
div = div/10;
}

or

while (div > 0) {
d--;
if (d == r)
lcd.print('.');
lcd.print((val / div) + '0');
val = val % div;
div = div / 10;
}

yet, which is easier to read? Also, if you just happened to use a pre-X3J11 compiler, the if() expression could be evaluated incorrectly since the post decrement operator has higher precedence than the test for equality. (True, the chances of that happening are pretty small, but still non-zero.) Finally, why use the hex representation for zero when '0' makes it easier to read? The indenting on the first example is misleading, since a quick glance makes it appear that the second call to the lcd object is controlled by the if expression, which it is not. Also, whitespace makes it easier to read expressions and cost nothing, so why not use it? You could also use the %= and /= operators, but that makes the code harder to read and has no impact on the generated code. Given a choice, I will always pick the form that is easier to read, especially when there's no performance hit.

Jack, W8TEE

On Sunday, May 6, 2018, 1:22:15 PM EDT, Vince Vielhaber <vev@...> wrote:

Places the decimal point.  Actually pretty slick.

Vince.

On 05/06/2018 11:31 AM, Jack Purdum via Groups.Io wrote:
> if (d--==r)  lcd.print('.');
>
> What??
>
> Jack, W8TEE
>
>
> On Sunday, May 6, 2018, 10:41:34 AM EDT, Jerry Gaffke via Groups.Io
> <jgaffke=yahoo.com@groups.io> wrote:
>
>
> Here's my unproven code for displaying forward and reverse power in Watts
> plus SWR on the bottom line of the 16x2 LCD, when using a TandemMatch
> with diode detectors.
> It's actually quite simple and not computationally expensive..  Hereby
> released under GPL v3.0
>
> Could be made more accurate by adding the schottky diode drop to the two
> Assuming the transformer turns ratios are kept at 10:1, the SWR should
> be reasonably accurate
> without calibration.  Especially if a few uA of bias is added to the diodes.
> Power readings should be reasonably accurate if the SWR is close to 1:1
> since they assume a 50 ohm load.
>
> Maximum analogRead() return value is 1023, and represents a peak RF
> voltage of 5 volts.
> Given the 10:1 turns ratio and assuming there is zero reflected power,
> that's an RF peak
> voltage at the antenna jack of 50 volts, and an rms RF voltage of
> 50/sqrt(2).  Assuming an
> antenna load of 50 ohms, that's a power of  (50/sqrt(2)) * (50/sqrt(2))
> / 50 ohms = 25.0 watts.
> From this, we determine the value of PSCALE in the code below.
>
> Using the linear-in-db ad8307 could be done with the same code, but
> first using
> a table lookup to convert to RF volts.
> I don't really want to be computing anti-logs on a Nano.
> A table lookup will burn some flash.
>
> ################################################################
> // Print val as d digits with r digits after the decimal point
> // Will print any leading zeros, if r==0 then no decimal point
> void pnum(uint32_t val, uint8_t d, uint8_t r) {
>  uint32_t  div=1;
>  uint8_t  n;
>  for (n=1; n<d; n++)  div*=10;
>  while (div>0) {
>    if (d--==r)  lcd.print('.');
>        lcd.print((val/div) + 0x30);
>    val = val%div;
>    div = div/10;
>  }
> }
>
> // Read TandemMatch's 2 detectors, display forward and reverse power, swr
> #define PSCALE  (1023L*1023/(25*10))// ADC max of 1023 is 25 Watts,
> display Watts*10
> void  show_swr() {  // SWR = (1+1.0*vr/vf)/(1-1.0*vr/vf);
>  uint32_t vr, vf, swr;// Voltage squared proportional to power
>  vf = analogRead(RF_FWD);// Peak RF volts from forward detector
>  vr = analogRead(RF_REV);// Peak RF volts from reverse detector
>  if (vr>=vf) swr=0; // If vr,vf illegal, force SWR to zero
>  else {
>    swr = (vr*1024)/vf;// Voltage ratio, 10 fractional bits
>    swr = (1000*(1024+swr))/(1024-swr);// 1000*swr, nearly 10 fractional
> bits
>    swr = (swr+50)/100;// 10*swr, rounded to nearest tenth
>    if (swr>99) swr=99;  // Display a max SWR of 9.9
>  }
>  lcd.setCursor(0, 1);// Fill bottom LCD line, example:
>  lcd.print('f'); pnum(vf*vf/PSCALE,3,1);// "f12.4 r03.1 s1.7"
>  lcd.print('r'); pnum(vr*vf/PSCALE,3,1);// with fwd,rev power in watts
>  lcd.print('s'); pnum(swr,2,1);// and swr to max of 9.9
> }
> #################################################################
>
> My primary reason not to mess with ad8307's is that they are harder to
> If the timing skew between forward/reverse readings is an issue, I'd
> definitely try the cap.
> Likely still accurate enough.
>
> Bill wrote:
>
>> 58.6 KHz would be ok, but to get that rate probably assumes that the
> processor is dedicated to the task, not off doing other uBITx work,
>
>
> We currently use a blocking analogRead() in many places in the code,
> each taking over 100us.
> And in some cases do it constantly for stuff such as inspecting switches
> So speeding up the analogRead() by a factor of 5 and occasionally (once
> per second?)
> reading the forward and reverse power should not be much of a burden,
> even if averaging
>
> Should be possible to set up the ADC to be interrupt driven, an
> interrupt service
> disable interrupts
> and read those last few forward and reverse readings to take an
> average.  Since we
> are no longer blocking for each 100us+ analogRead(), this would be much
> less a timing burden.
>
> Things may eventually slow down too much for somebody trying to use the
> keyer at 40wpm.
> Otherwise I doubt there will be much of an issue with a lost millisecond
> here and there.
> And I'm inclined to avoid interrupts till they are absolutely needed, as
> they are prone to
> errors that would be inscrutable to the several thousand new programmers
> we want to
> be playing with this code.
>
> Jerry, KE7ER
>
>
> On Sat, May 5, 2018 at 10:45 pm, K9HZ wrote:
>
>    Hmmm… we should probably take this off-line at this point.  This has
>    to do with A/D resolution time vs. filter time.
>
>    I’m rethinking…that diodes would be a better choice just because
>    they are less complicated.  The transform to watts and SWR is still
>    complex though and will eat some processing power in a Nano.
>
>

--
Michigan VHF Corp.  http://www.nobucks.net/   http://www.CDupe.com/
http://www.metalworkingfun.com

Re: ND6T AGC implementation for uBIT-X

Jim Sheldon

Tim,
I have a "YouKits" digital QRP SWR/Wattmeter with a 2 amp hour LI-Ion battery pack in it that just happens to be set up (by the factory) so that you can pull the 12 volts out of the bottom via a coax power connector and run your QRP rig. For short term ops, it a heck of a lot lighter than a normal battery pack and it gives you SWR & power as well and it reads to 25 watts on the power scale. Unless I happen to be using it on the bench (rarely) it stays in my "Go bag" along with the solar charger. I also have a small, 4 amp hour LiPo cell phone charger pack with a built in 9 volt/12 volt switching supply as well as the 5 volt USB charging output, that will run the SWR Wattmeter & the rig at the same time that is about the size of my cell phone and can also be charged off the solar panel. Between the 2, I have less than 1/2 a pound of weight (about the same as the normal battery pack people carrry) and everything is well smaller than the rig itself. Works for me.

Jim

------ Original Message ------
From: "Tim Gorman" <tgorman2@...>
To: BITX20@groups.io
Sent: 5/6/2018 12:13:35 PM
Subject: Re: [BITX20] ND6T AGC implementation for uBIT-X

Jim,

In the field, e.g. on Field Day or during emergency operation, you

If you are truly tying to use a piece of wire thrown up in a tree to
make the ubitx useful then having a reverse power indicator in the
ubitx would be very useful, especially with a qrp tuner that has no
built-in indicator.

In my go box I want my ubitx, my itty-bitty tuner, my paddle, my mic,
and a roll of copper wire. I can run off a car battery scavenged from
somewhere.

tim ab0wr

On Sun, 06 May 2018 14:59:58 +0000
"Jim Sheldon" <@W0EB> wrote:

I somewhat agree with Tim on this, but will go out on a limb, risk
getting flamed and say I don't think a reverse power measurement in
firmware is really necessary.

In my opinion, two absolutely necessary pieces of test equipment that
should be in EVERY ham's shack are a good 50 ohm dummy load of
sufficient power rating to handle all the transmitting equipment that
ham has and a GOOD SWR bridge or better still an accurate watt meter
that can measure forward & reverse power up to the limit of the
transmitting equipment in the shack. The rig's firmware should not
be tasked with this especially since the limited NANO is being used
as a microcontroller.

The supplied NANO is already close to being severely overworked by
all the different available firmware and adding this kind of stuff
risks ruining the CW and Digital handling capability of what's
available now. I'm already seeing complaints of "This won't work or
that won't work in so-and-so's version of software" regarding a
number of things on this group. Adding more bells and whistles to
existing software for the NANO will just tend to make this worse.

Jim Sheldon, W0EB

------ Original Message ------
From: "Tim Gorman" <tgorman2@...>
To: BITX20@groups.io
Sent: 5/6/2018 9:43:08 AM
Subject: Re: [BITX20] ND6T AGC implementation for uBIT-X

Jerry,

What is the goal here? Is a wattmeter function really needed inside
the ubitx? Or would it be better as an external attachment that can
be used with other equipment?

For me, measurement of the reverse power is the primary measurement
needed inside the ubitx. It is useful for adjusting an external tuner
and for deciding if the ubitx is at risk from a bad load. I am using
the simple circuit at the nd6t site to get the reverse power
measurement. Right now I am using an external analog meter but I have
an adafruit ADS1015 that I am going to use when I get my ubitx
working again. I am using a little 4x4 breadboard to make an I2C bus
expander and the ADS1015 will feed into this along with the I2C lcd.

Coding for this is extremely simple. You don't even have to convert
to volts. Just display the reading from the ads1015. As it goes down
you know the reverse power is going down. If you want to do it with
an analog pin on the nano you can do that too.

Just my 2cents. FWIW.

On Sat, 05 May 2018 15:52:36 -0700
"Jerry Gaffke via Groups.Io" <jgaffke=yahoo.com@groups.io> wrote:

Kees,

Consensus on the EMRFD yahoo group was that the ebay AD8307's worked
fine:
https://groups.yahoo.com/neo/groups/emrfd/conversations/topics/14309
Some posts there are guessing that when boards get autostuffed from
reels there are often a few parts remaining at the end of the reel,
and the ebay sellers make the remnants available cheaply. Though if
that were truly the case, I'd expect more parts to get sold at 95%
off list price like that.

Diz already has a Stockton/TandemMatch kit at what I think is a
reasonable \$12 plus shipping:
http://www.kitsandparts.com/bridge1.4.php Shipping probably has to
be more than \$0.70 because of the toroids. Uses 1n5711 schottky
diode detectors.

I mentioned here that I was planning to substitute a couple AD8307's
but Arv convinced me to first try biasing the 1n5711's to make them
more sensitive. https://groups.io/g/BITX20/message/47628

I wrote Nano code for the Tandem Match to display forward and
reverse power in Watts, also SWR. but it's also a major rewrite of
all the uBitx code and I got lost in the weeds fiddling with other
stuff for a few weeks. I'll try to get my code going in the next
few days. The AD8307's would give more dynamic range, but I think
the 1n5711's with bias will be plenty polite. Displaying Watts and
SWR from the AD8307's linear-in-dB output would be slightly more
difficult on our computationally challenged Nano. I'm planning to
use A6 and A7 for the bridge, move the paddle to digital pins D0 and

Anybody worried about smoking their expensive RD16HHF1 FET's could
use the reflected power reading to shut down the transmitter when
their EFHW antenna falls to the ground in the wind. ;-)

Jerry, KE7ER

On Sat, May 5, 2018 at 01:30 pm, Kees T wrote:

I just uploaded the current AGC and Click kit requests. This list
is to help me asses demand so I can have the correct sets of
parts ready. There does not appear to be much demand for boards
only, just complete kits.

I'll post prices later, when I receive the boards and some
testing is done.

I was looking into Don's ND6T Polite Antenna Tuner, but there
does not appear to be much interest and using it effectively may
be a problem, so it's out. I did receive a request for a "Power
Level Upgrade" kit but decided against that because there is a
whole lot of testing to be done when you get into RF
Amplification.

What may make sense, unless it's already out there as an add-on
upgrade kit, is a Power/SWR capability using a simple Stockton
Bridge and a couple of AD8307's. I'm quite familiar with the
bridge and the AD8307 parts are getting really cheap <\$0.50
each. Wonder if those Chinese parts are usable at QRP specs ?
microcontroller .......and, of course, the ever present
requirement for *someone* to provide support firmware.

73 Kees K5BCQ

Re: 45Mhz crystal filter specification

Tim Gorman

This why I picked r216 and r210 as measurement points. I assumed
those points should be close to being 50ohm points as they are outside
the L network matching to the filter.

tim ab0wr

On Sun, 6 May 2018 21:33:06 +0530
"Ashhar Farhan" <farhanbox@...> wrote:

You must use the L network of the ubitx or use 1:9 balun to get the
proper shape of the fiilter. The 45 MHz crystal filters usually have
a termintion specified for around 600 ohms.

Let me bullet this :
* All filters have the specified shape only when they are terminated
at the specified impedance on both sides.
* The passive filters, including the crystal fitlers have no
measurable termination to speak of at all. They have different
responses at different impedances.
* The capacitors of the ladder filter set the bandwidth.
* The termination impedance sets the ripple. Lower impedance brings
steeper skirt at the cost of ripples in the bandpass. To remove the
ripples you increase the impedance and lose the sharpness of the
skirt.

On Sun, May 6, 2018 at 7:45 PM, Tim Gorman <tgorman2@...> wrote:

I'm using a direct probe. The 815 has a 50ohm input which should be
a match to most points in the ubitx. At least a close enough match
to not directly affect the circuits operation. I suppose I could
use a 10x scope probe but I'm not sure that would make much
difference.

tim ab0wr

On Sun, 06 May 2018 01:03:42 -0700
freefuel@... wrote:

Hi Tim,

I'm interested to know how your connecting your SA to the circuit,
from my recollection the majority of SA equipment has a 50 ohm
input impedance, an input impedance that low is not conducive to
hanging a probe off the circuit at any convient location.

-Justin N2TOH

Re: ND6T AGC implementation for uBIT-X

K9HZ <bill@...>

Thanks Arv… I tend to design stuff that I want to use and, therefore, it has to have all of the bells and whistles I want… not just bare-bones.  I’m also cost conscious, so all mu designs use low cost methods and components where needed.  I still think this tuner will come in at \$35 or less.  I found an ultra-cheap source for latching relays.  Also, while larger SMD caps save space and are more modern/in vogue…they are much more expensive than just using SM leaded parts.  Finding cheap cores will be the tough part.

Forgot to say it has frequency memory tuning too (or at least that is the spec for the firmware that is currently about half baked).

There isn’t any reason you can’t scale up the 100W tuner to create something bigger.  The same electronics, but bigger relays, coils, and capacitors in the RF section.  Maybe I’ll do that after the QRP version is released.  A perfect modern RF-601 replacement?

QRO group… well we reserved the groups.IO section here but still use the yahoo group mostly.  We did that to prep for Yahoo groups going away.

Ph.D.’s in Electrical, Chemical Engineering from University of Minnesota and Notre Dame years ago.  Most of my career has been in the energy sector and teaching, but I also own a nice RF lab. Chose not to ruin a great hobby by working at it every waking hour.  Currently about 10 seconds from retiring and doing this full time.

Dr. William J. Schmidt - K9HZ J68HZ 8P6HK ZF2HZ PJ4/K9HZ VP5/K9HZ PJ2/K9HZ

Owner - Operator

Big Signal Ranch – K9ZC

Staunton, Illinois

Owner – Operator

Villa Grand Piton – J68HZ

Soufriere, St. Lucia W.I.

Rent it: www.VillaGrandPiton.com

Moderator – North American QRO Group at Groups.IO.

email:  bill@...

From: BITX20@groups.io [mailto:BITX20@groups.io] On Behalf Of Arv Evans
Sent: Sunday, May 6, 2018 11:35 AM
To: BITX20@groups.io
Subject: Re: [BITX20] ND6T AGC implementation for uBIT-X

Bill K9Hz

I am impressed by your ATU design.  That should be of interest to the BITX group when you

publish it.  Will you be manufacturing and selling the unit as an on-line product?

From wondering if there might be a QRO version of your ATU I took a look at your "The QRO Group"

<https://groups.io/g/QRO>  and found that there are only 6 members, and that there have been only
6 posts from 2017 until now.  All of those posts seem to be from you.  Does that mean that QRO may
be a dying mode...?    🤔

A slightly off-topic question, what discipline is your doctorate in?  Is it based on a PhD, or some other

type of "doctor"?

Arv
_._

On Sat, May 5, 2018 at 11:45 PM, K9HZ <bill@...> wrote:

Arv…

Hmmm… we should probably take this off-line at this point.  This has to do with A/D resolution time vs. filter time.

I’m rethinking…that diodes would be a better choice just because they are less complicated.  The transform to watts and SWR is still complex though and will eat some processing power in a Nano.

My tuner is prototyped and the hardware is done.  The firmware is in the writing stage… I’m waiting for Jack to finish his Jackal project and a another second follow-up project before I officially ask for his help in coding.  It can tune 100 watts from any source (meaning it can be stand-alone… or I2C linked to the uBITx), uses latching relays to conserve power for QRP, has a 1:4 transformer for very low loads like the illusive short length impedances at very low frequency (12 ohms), CL-LC swap for high-low impedance matches of us to almost 12,000 ohms,  an AD8302 to generate phase and magnitude information of the load impedance like a point on a smith chart and then calculates the LC transform directly and instantly… no clicking-clacking relays searching for lowest SWR.  SWR and power is calculated and can be retrieved over the I2C or analog via the onboard dedicated Arduino (for those interested, the LP-100A watt meter generates power and SWR readings this way).  There is also a low power tune mode Dig Out to save the relays and protect the transmitter by commanding lower power (works down to about 250 mW).  So far it fits on a 5”x3” board but I may be able to shrink it.  Stay tuned.

Dr. William J. Schmidt - K9HZ J68HZ 8P6HK ZF2HZ PJ4/K9HZ VP5/K9HZ PJ2/K9HZ

Owner - Operator

Big Signal Ranch – K9ZC

Staunton, Illinois

Owner – Operator

Villa Grand Piton – J68HZ

Soufriere, St. Lucia W.I.

Rent it: www.VillaGrandPiton.com

Moderator – North American QRO Group at Groups.IO.

email:  bill@...

From: BITX20@groups.io [mailto:BITX20@groups.io] On Behalf Of Arv Evans
Sent: Sunday, May 6, 2018 12:05 AM
To: BITX20@groups.io
Subject: Re: [BITX20] ND6T AGC implementation for uBIT-X

Bill K9HZ

Not sure I follow your analysis.  The added capacitance lowers upper frequency limit by a significant amount.

You can even go as high as 0.1 MFD so that the detector output is filtered to virtually DC, leaving no HF

knee in the passband.  This does cause a charge period error unless there are multiple samples to charge
this capacitor.  Same thing applies to simple diode detection with it's post-detection filter capacitor.

The Arduino ADC provides 1023 distinct voltage steps.  It's internal voltage reference is used for calibration.

With a maximum of 5V and 1023 steps this gives a minimum sensitivity of around 0.005V and 5V full scale.

That range and resolution seems adequate for most transmitter RF measurements.

It may be interesting to try using conventional diode detection with a small forward bias to overcome the

diode offset.  This is not usually done in conventional SWR bridges because they are mostly non-powered

units.  But if the SWR bridge is to be inside a powered transceiver then the bias is readily available.

Now that AD8307 prices are more reasonable this device may be a viable alternative detector but it's

log slope ADC requires a bit more complex software if you want to derive the full compliment of FWD and

REV power, FWD and REV SWR, RF Voltage, RF Current, and possibly RF Impedance.

With either diode or AD8307 detectors it should be relatively easy to make the software support automatic

calibration.  Possibly this could be based on measurement of the known output of one of the Si5351a ports.

Using and displaying this output could also be a test point to verify that the synthesizer chip is actually

operating at normal levels.

Some time ago you mentioned work on a QRP ATU of your own design for use with BITX transceivers.  How
is that coming along?  Are you planning on including SWR and power measurement capability at both input

and antenna ends of this unit?  Might be interesting to include calculation and display of impedance, particularly

at the transmitter end of the ATU to help get a good 50 ohm match to the IRF510 finals and associated LPF.

As you know, impedance is important when using an LPF designed for a specific cut-off frequency in order to
make the LPF operate within its design parameters.

Arv  K7HKL
_._

On Sat, May 5, 2018 at 7:26 PM, K9HZ <bill@...> wrote:

Arv…

I’m quite familiar with the 8307 characteristics… there is a an effective 12.5K on chip resistor that forms part of a low-pass filter in shunt form basis that external capacitor.  It’s designed to reduce the ripple of the output and as I recall has a corner frequency of about 5MHz with the suggested capacitor (10 or 100nF from memory).  As you change the corner is also loads the output and changes the slope factor.  Not a big deal but you need to recalibrate.  It being faster than an analog meter is not really relevant and actually part of the problem.  What is relevant though, and what you see in the lab is that the P-forward resolved by the Nano A/D pin “x” finishes at “t” and P-reverse is resolved by Nano A/D pin “y” at “t+n” where “n” is what makes the difference.  Because of that filter above, it’s frequency dependent.  Most folks just calculate away for SWR and get a number and figure its right.  Might be.  Might not.  Someone actually wrote an article for QST on this.

Anyway… I tried.

Dr. William J. Schmidt - K9HZ J68HZ 8P6HK ZF2HZ PJ4/K9HZ VP5/K9HZ PJ2/K9HZ

Owner - Operator

Big Signal Ranch – K9ZC

Staunton, Illinois

Owner – Operator

Villa Grand Piton – J68HZ

Soufriere, St. Lucia W.I.

Rent it: www.VillaGrandPiton.com

Moderator – North American QRO Group at Groups.IO.

email:  bill@...

From: BITX20@groups.io [mailto:BITX20@groups.io] On Behalf Of Arv Evans
Sent: Saturday, May 5, 2018 7:48 PM
To: BITX20@groups.io
Subject: Re: [BITX20] ND6T AGC implementation for uBIT-X

Bill K9Hz

Adding a small external capacitor (o.001 mfd) at the input of each ADC provides extra stabilization

versus time for the voltage samples.  This added capacitance can be thought of as part of the
detector filter.   The sample rate of an AVR Mega-328 is quite fast but this adds a bit more pre-hold
or averaging to the traditional sample-and-hold function.

I would not worry about time shifting of ADC measurements because it is still faster than a ballistic
meter movement that we have all relied on for many years.  If you really want traditional mechanical
meter results you can slow down the sample rate or average several samples to arrive at an

In addition to measuring forward power, reverse power, and RF voltage, you can measure RF current

by using a current-transformer (like those in the Stockton or Bruene bridge) to get a voltage reading

that translates from RF current.  This may be very interesting for those who are using a uBITX or QCX

Arv  K7HKL
_._

Arv  K7HKL
_._

On Sat, May 5, 2018 at 6:23 PM, K9HZ <bill@...> wrote:

The I2C isn’t all that important.  What is important is the sample and hold.  Otherwise your forward and reflected power signals can be time shifted and won’t make sense.  But maybe again, if accuracy isn’t important to you, this isn’t either.  Ten turns of any small transformer wire on the T50-43 or smaller core works perfect.

Dr. William J. Schmidt - K9HZ J68HZ 8P6HK ZF2HZ PJ4/K9HZ VP5/K9HZ PJ2/K9HZ

Owner - Operator

Big Signal Ranch – K9ZC

Staunton, Illinois

Owner – Operator

Villa Grand Piton – J68HZ

Soufriere, St. Lucia W.I.

Rent it: www.VillaGrandPiton.com

Moderator – North American QRO Group at Groups.IO.

email:  bill@...

From: BITX20@groups.io [mailto:BITX20@groups.io] On Behalf Of Kees T
Sent: Saturday, May 5, 2018 6:59 PM
To: BITX20@groups.io
Subject: Re: [BITX20] ND6T AGC implementation for uBIT-X

The eBay sellers (many) are providing boards with AD8307s on them and also strips of AD8307 parts. On my mWattmeter II kit I provided a "matched set" of HP diodes which were forward biased with a few uA (AAA cell) to allow readings <1mW.....and it worked very well as measured in a local professional lab. I don't think that accuracy is required here. I can provide an I2C interface as Bill, K9CZ, suggested but don't know if that's really required here either.

I later gave the mWattmeter II design to Ron, W4MMP, for production because I got tired of making mWattmeter II kits.

I realize Diz makes a coupler but this one would be smaller  ...maybe 1" x 1-1/2" and use the dual double #61 FT-37 size toroids with Faraday shield and 23 turns, which I found to work best. A LOT of coffee cup coasters were made during that time. I have an old schematic but it's in .bmp format and won't load into the Files section.

73 Kees K5BCQ

 Virus-free. www.avg.com

Re: boosting the power on 28 MHz

Jerry Gaffke

Allison,

Yes, simulation shows input impedance to the FET's is around 12 ohms.
True for both the uBitx and the WA2EBY.
https://groups.io/g/BITX20/message/41227

Any opinions on those two RF chokes that feed power to the drains?
Not typical of push-pull FET linear amps.
The chokes do take awhile for the current to ramp up or down.
Perhaps causing some distortion.
Whereas feeding from the transformer center tap is instantaneous.

Though they do ramp in a matter of microseconds, much faster than the audio envelope changes.

Another concern is having such small cores out there, perhaps saturating at these power levels.

Jerry

On Sun, May 6, 2018 at 09:02 am, ajparent1/KB1GMX wrote:
Several things....  The problem may be in the drivers for the IMD.

Re: boosting the power on 28 MHz

Tim Gorman

I tried raising the bias to 120ma. No difference in the imd. I tried
lowering the bias to 90ma. No difference in the imd. I didn't try to go
any lower or higher.

If there were an imbalance between the two chokes I suppose it might
affect the IMD. You wouldn't really need a major redesign of the
circuit though. L8 and L9 could be just a bifilar winding on a toroid
with each of the windings being used as a separate choke inductor.

The big question is how much inductance you would need, how big of a
toroid, and how many windings you would need.

tim ab0wr

On Sun, 06 May 2018 08:03:34 -0700
"Jerry Gaffke via Groups.Io" <jgaffke=yahoo.com@groups.io> wrote:

That's interesting.
Perhaps the bias wants to be higher than 100ma.
Though as I recall, wa2eby was recommending 10ma of bias, and is
quite competent. As is Allison.

Perhaps there's IMD contributions from earlier stages?
Perhaps a fault in the uBitx design, I'm starting to suspect the use
of the two chokes to feed the drains.

Jerry

On Sun, May 6, 2018 at 07:53 am, Tim Gorman wrote:

I tried raising the voltage on my final to 24v. It didn't help the
3rd order IMD at all. I suspect most of the IMD is coming from
crossover distortion, not flat-topping.

Re: ND6T AGC implementation for uBIT-X

Vince Vielhaber

Places the decimal point. Actually pretty slick.

Vince.

On 05/06/2018 11:31 AM, Jack Purdum via Groups.Io wrote:
if (d--==r) lcd.print('.');

What??

Jack, W8TEE

On Sunday, May 6, 2018, 10:41:34 AM EDT, Jerry Gaffke via Groups.Io
<jgaffke=yahoo.com@groups.io> wrote:

Here's my unproven code for displaying forward and reverse power in Watts
plus SWR on the bottom line of the 16x2 LCD, when using a TandemMatch
with diode detectors.
It's actually quite simple and not computationally expensive.. Hereby
released under GPL v3.0

Could be made more accurate by adding the schottky diode drop to the two
Assuming the transformer turns ratios are kept at 10:1, the SWR should
be reasonably accurate
without calibration. Especially if a few uA of bias is added to the diodes.
Power readings should be reasonably accurate if the SWR is close to 1:1
since they assume a 50 ohm load.

Maximum analogRead() return value is 1023, and represents a peak RF
voltage of 5 volts.
Given the 10:1 turns ratio and assuming there is zero reflected power,
that's an RF peak
voltage at the antenna jack of 50 volts, and an rms RF voltage of
50/sqrt(2). Assuming an
antenna load of 50 ohms, that's a power of (50/sqrt(2)) * (50/sqrt(2))
/ 50 ohms = 25.0 watts.
From this, we determine the value of PSCALE in the code below.

Using the linear-in-db ad8307 could be done with the same code, but
first using
a table lookup to convert to RF volts.
I don't really want to be computing anti-logs on a Nano.
A table lookup will burn some flash.

################################################################
// Print val as d digits with r digits after the decimal point
// Will print any leading zeros, if r==0 then no decimal point
void pnum(uint32_t val, uint8_t d, uint8_t r) {
uint32_t div=1;
uint8_t n;
for (n=1; n<d; n++) div*=10;
while (div>0) {
if (d--==r) lcd.print('.');
lcd.print((val/div) + 0x30);
val = val%div;
div = div/10;
}
}

// Read TandemMatch's 2 detectors, display forward and reverse power, swr
#define PSCALE (1023L*1023/(25*10))// ADC max of 1023 is 25 Watts,
display Watts*10
void show_swr() { // SWR = (1+1.0*vr/vf)/(1-1.0*vr/vf);
uint32_t vr, vf, swr;// Voltage squared proportional to power
vf = analogRead(RF_FWD);// Peak RF volts from forward detector
vr = analogRead(RF_REV);// Peak RF volts from reverse detector
if (vr>=vf) swr=0; // If vr,vf illegal, force SWR to zero
else {
swr = (vr*1024)/vf;// Voltage ratio, 10 fractional bits
swr = (1000*(1024+swr))/(1024-swr);// 1000*swr, nearly 10 fractional
bits
swr = (swr+50)/100;// 10*swr, rounded to nearest tenth
if (swr>99) swr=99; // Display a max SWR of 9.9
}
lcd.setCursor(0, 1);// Fill bottom LCD line, example:
lcd.print('f'); pnum(vf*vf/PSCALE,3,1);// "f12.4 r03.1 s1.7"
lcd.print('r'); pnum(vr*vf/PSCALE,3,1);// with fwd,rev power in watts
lcd.print('s'); pnum(swr,2,1);// and swr to max of 9.9
}
#################################################################

My primary reason not to mess with ad8307's is that they are harder to
If the timing skew between forward/reverse readings is an issue, I'd
definitely try the cap.
Likely still accurate enough.

Bill wrote:

58.6 KHz would be ok, but to get that rate probably assumes that the
processor is dedicated to the task, not off doing other uBITx work,

We currently use a blocking analogRead() in many places in the code,
each taking over 100us.
And in some cases do it constantly for stuff such as inspecting switches
So speeding up the analogRead() by a factor of 5 and occasionally (once
per second?)
reading the forward and reverse power should not be much of a burden,
even if averaging

Should be possible to set up the ADC to be interrupt driven, an
interrupt service
disable interrupts
and read those last few forward and reverse readings to take an
average. Since we
are no longer blocking for each 100us+ analogRead(), this would be much
less a timing burden.

Things may eventually slow down too much for somebody trying to use the
keyer at 40wpm.
Otherwise I doubt there will be much of an issue with a lost millisecond
here and there.
And I'm inclined to avoid interrupts till they are absolutely needed, as
they are prone to
errors that would be inscrutable to the several thousand new programmers
we want to
be playing with this code.

Jerry, KE7ER

On Sat, May 5, 2018 at 10:45 pm, K9HZ wrote:

Hmmm… we should probably take this off-line at this point. This has
to do with A/D resolution time vs. filter time.

I’m rethinking…that diodes would be a better choice just because
they are less complicated. The transform to watts and SWR is still
complex though and will eat some processing power in a Nano.

Re: ND6T AGC implementation for uBIT-X

Jerry Gaffke

That makes 9.   ;-)
Fine with me.

On Sun, May 6, 2018 at 10:02 am, Rod Davis wrote:

Gee, isn't this about the 8th different topic posted under the same
subject line?

Rod KM6SN

Re: Designing a front panel PCB

Arv Evans

Reid Gi8TME/Mi0BOT

Your idea for front and rear panel circuits is interesting, especially for those who
have a CNC Mill that is capable of routing printed (routed...?) circuit boards.
There might even be a small business potential for such people because they
can make one-off custom boards for each customer.  Also might be interesting for
someone to publish CAD drawings for typical front and rear panels with the idea
that customers would edit these drawings and submit them to a person with
CNC Milling capability to make the boards.  There are several CNC driver
programs available on-line so that the customer could see his/her boards being
machined in simulation mode before they are submitted for manufacturing.

But, why stop with just machined front and rear panels.  Why not machine SMD
circuits into chassis side, top, and bottom panels, making the chassis the actual
circuit board.

Arv K7HKL

_._

On Sun, May 6, 2018 at 9:44 AM, Reid Campbell <reid@...> wrote:
Hi,

I was wondering if anybody had consider designing a PCB which could be used as a front panel for the uBITX? The PCB vendor would be able to route the rectangle for the display and the holes for the volume, encoder and audio connections. I know, what size to pick would be a problem but make the design so it could be adapted for several cases.

Silk screen could be used for the labels and it would look very profession. Now, here the big advantage. On the reverse side you could put SMD designs. There are lots of PCBs being done at the minute, but many of them could be incorporated on the reverse of the front panel.

In stead of rats nest wiring to all the controls, tracks could be place to just beside the controls and short jumper wires from the tracks to the control. As the audio would be available, there is the possibility for DSP by adding a Teensy or a Red/Blue Pill using surface mounted headers. I think you can see where I'm going with this.

There are a lot of really talented designer who are already producing PCBs and maybe it's a big ask to do this. Maybe it could be a cooperative venture for a couple of designers?

Then, don't stop there - there always the back panel with SWR bridges, tuners etc, and use the copper as a heat sink for the finals in to the bargain.

Cheers

Reid Gi8TME/Mi0BOT

Re: ND6T AGC implementation for uBIT-X

Jerry Gaffke

Actually, reading values from an A/D over the I2C bus will take more time

I think we can get by with just a couple ADC reads, use that to compute the SWR.
If too much jitter, just follow Arv's suggestion and make the caps bigger.

If that doesn't work, then average it out over several samples.
Or just show what you got and let the operator do the averaging.
But I think the large cap is all we need here, especially if we have 20us sample times.

And a couple 20us sample times is a drop in the bucket compared to time spent updating the si5351.
And if we are worried about spending too much time on housekeeping, then an i2c display
is not a good idea unless we set up queues and shovel data out to it with an interrupt routine.
That i2c display with blocking IO is orders of magnitude worse than a couple 20us ADC reads.

Jerry, KE7ER

On Sun, May 6, 2018 at 08:30 am, K9HZ wrote:
Slowing down processing by additional code. Yes I'm extremely aware of this problem hence the my posts on timing. An outboard I2C A/D removes a lot of this load because 1) we are already using the I2C library for other functions in the radio, and 2) the update frequency requirements once off the original Arduino are much lower.

Re: ND6T AGC implementation for uBIT-X

Tim Gorman

Jim,

In the field, e.g. on Field Day or during emergency operation, you

If you are truly tying to use a piece of wire thrown up in a tree to
make the ubitx useful then having a reverse power indicator in the
ubitx would be very useful, especially with a qrp tuner that has no
built-in indicator.

In my go box I want my ubitx, my itty-bitty tuner, my paddle, my mic,
and a roll of copper wire. I can run off a car battery scavenged from
somewhere.

tim ab0wr

On Sun, 06 May 2018 14:59:58 +0000
"Jim Sheldon" <@W0EB> wrote:

I somewhat agree with Tim on this, but will go out on a limb, risk
getting flamed and say I don't think a reverse power measurement in
firmware is really necessary.

In my opinion, two absolutely necessary pieces of test equipment that
should be in EVERY ham's shack are a good 50 ohm dummy load of
sufficient power rating to handle all the transmitting equipment that
ham has and a GOOD SWR bridge or better still an accurate watt meter
that can measure forward & reverse power up to the limit of the
transmitting equipment in the shack. The rig's firmware should not
be tasked with this especially since the limited NANO is being used
as a microcontroller.

The supplied NANO is already close to being severely overworked by
all the different available firmware and adding this kind of stuff
risks ruining the CW and Digital handling capability of what's
available now. I'm already seeing complaints of "This won't work or
that won't work in so-and-so's version of software" regarding a
number of things on this group. Adding more bells and whistles to
existing software for the NANO will just tend to make this worse.

Jim Sheldon, W0EB

------ Original Message ------
From: "Tim Gorman" <tgorman2@...>
To: BITX20@groups.io
Sent: 5/6/2018 9:43:08 AM
Subject: Re: [BITX20] ND6T AGC implementation for uBIT-X

Jerry,

What is the goal here? Is a wattmeter function really needed inside
the ubitx? Or would it be better as an external attachment that can
be used with other equipment?

For me, measurement of the reverse power is the primary measurement
needed inside the ubitx. It is useful for adjusting an external tuner
and for deciding if the ubitx is at risk from a bad load. I am using
the simple circuit at the nd6t site to get the reverse power
measurement. Right now I am using an external analog meter but I have
an adafruit ADS1015 that I am going to use when I get my ubitx
working again. I am using a little 4x4 breadboard to make an I2C bus
expander and the ADS1015 will feed into this along with the I2C lcd.

Coding for this is extremely simple. You don't even have to convert
to volts. Just display the reading from the ads1015. As it goes down
you know the reverse power is going down. If you want to do it with
an analog pin on the nano you can do that too.

Just my 2cents. FWIW.

On Sat, 05 May 2018 15:52:36 -0700
"Jerry Gaffke via Groups.Io" <jgaffke=yahoo.com@groups.io> wrote:

Kees,

Consensus on the EMRFD yahoo group was that the ebay AD8307's worked
fine:
https://groups.yahoo.com/neo/groups/emrfd/conversations/topics/14309
Some posts there are guessing that when boards get autostuffed from
reels there are often a few parts remaining at the end of the reel,
and the ebay sellers make the remnants available cheaply. Though if
that were truly the case, I'd expect more parts to get sold at 95%
off list price like that.

Diz already has a Stockton/TandemMatch kit at what I think is a
reasonable \$12 plus shipping:
http://www.kitsandparts.com/bridge1.4.php Shipping probably has to
be more than \$0.70 because of the toroids. Uses 1n5711 schottky
diode detectors.

I mentioned here that I was planning to substitute a couple AD8307's
but Arv convinced me to first try biasing the 1n5711's to make them
more sensitive. https://groups.io/g/BITX20/message/47628

I wrote Nano code for the Tandem Match to display forward and
reverse power in Watts, also SWR. but it's also a major rewrite of
all the uBitx code and I got lost in the weeds fiddling with other
stuff for a few weeks. I'll try to get my code going in the next
few days. The AD8307's would give more dynamic range, but I think
the 1n5711's with bias will be plenty polite. Displaying Watts and
SWR from the AD8307's linear-in-dB output would be slightly more
difficult on our computationally challenged Nano. I'm planning to
use A6 and A7 for the bridge, move the paddle to digital pins D0 and

Anybody worried about smoking their expensive RD16HHF1 FET's could
use the reflected power reading to shut down the transmitter when
their EFHW antenna falls to the ground in the wind. ;-)

Jerry, KE7ER

On Sat, May 5, 2018 at 01:30 pm, Kees T wrote:

I just uploaded the current AGC and Click kit requests. This list
is to help me asses demand so I can have the correct sets of
parts ready. There does not appear to be much demand for boards
only, just complete kits.

I'll post prices later, when I receive the boards and some
testing is done.

I was looking into Don's ND6T Polite Antenna Tuner, but there
does not appear to be much interest and using it effectively may
be a problem, so it's out. I did receive a request for a "Power
Level Upgrade" kit but decided against that because there is a
whole lot of testing to be done when you get into RF
Amplification.

What may make sense, unless it's already out there as an add-on
upgrade kit, is a Power/SWR capability using a simple Stockton
Bridge and a couple of AD8307's. I'm quite familiar with the
bridge and the AD8307 parts are getting really cheap <\$0.50
each. Wonder if those Chinese parts are usable at QRP specs ?
microcontroller .......and, of course, the ever present
requirement for *someone* to provide support firmware.

73 Kees K5BCQ

Re: ND6T AGC implementation for uBIT-X

Jerry Gaffke

This line
if (d--==r)   lcd.print('.');
is legal C.
We could make it more verbose if that was too confusing:

if (d==r)  {
lcd.print('.');
}
d = d -1;

That function pnum()  prints a number as either floating point with a specified decimal point position
or as an integer without a decimal point if we specify a decimal point position of 0.

The value r is kept constant within the function, says how many digits after the decimal point to be printed.
The value d keeps track of how many digits we have yet to print.

It's my substitute for the itoa() routine used in the default code.

Jerry

On Sun, May 6, 2018 at 08:32 am, Jack Purdum wrote:
if (d--==r)   lcd.print('.');

What??

Jack, W8TEE

Re: ND6T AGC implementation for uBIT-X

Rod Davis

Gee, isn't this about the 8th different topic posted under the same
subject line?

Rod KM6SN

On 05/06/2018 10:00 AM, Tim Gorman wrote:
```My problem is that my tuner, a homebrew z-match type, doesn't have an
swr meter. When operating portable, with a compromise antenna, knowing
the swr doesn't matter much unless you have that "extra" box normally
called a tuner.

I'm just saying that knowing the swr doesn't matter much to me,
especially if it takes up more precious nano resources. All I need is a
reverse power indicator to tell when the tuner has matched the antenna.
The output power is going to be whatever it will be, there isn't much
you can do about it in the field. You don't normally adjust a tuner for
maximum output, you adjust it for minimum reflected power.

Any random piece of wire is going to work as an antenna. The issue is
whether you can match the rig to the antenna using a tuner.

tim ab0wr

On Sun, 06 May 2018 07:57:01 -0700
"Jerry Gaffke via Groups.Io" <jgaffke@...> wrote:

```
```The goal is whatever we want it to be.

Showing SWR on the uBitx makes it useful for verifying an antenna
system is working without having to lug about an extra box,
especially when operating portable. If it costs an extra \$3 in parts,
I'm fine with adding it to the rig.

If you have a tuner that already shows SWR and forward power,
and your antenna needs a tuner anyway,
then your goal may be different.

Jerry, KE7ER

On Sun, May 6, 2018 at 07:43 am, Tim Gorman wrote:

```
```Jerry,

What is the goal here? Is a wattmeter function really needed inside
the ubitx? Or would it be better as an external attachment that can
be used with other equipment?

For me, measurement of the reverse power is the primary measurement
needed inside the ubitx. It is useful for adjusting an external
tuner and for deciding if the ubitx is at risk from a bad load. I
am using the simple circuit at the nd6t site to get the reverse
power measurement. Right now I am using an external analog meter
but I have an adafruit ADS1015 that I am going to use when I get my
ubitx working again. I am using a little 4x4 breadboard to make an
I2C bus expander and the ADS1015 will feed into this along with the
I2C lcd.

Coding for this is extremely simple. You don't even have to convert
to volts. Just display the reading from the ads1015. As it goes
down you know the reverse power is going down. If you want to do it
with an analog pin on the nano you can do that too.

Just my 2cents. FWIW.
```
```

```

Re: ND6T AGC implementation for uBIT-X

Tim Gorman

My problem is that my tuner, a homebrew z-match type, doesn't have an
swr meter. When operating portable, with a compromise antenna, knowing
the swr doesn't matter much unless you have that "extra" box normally
called a tuner.

I'm just saying that knowing the swr doesn't matter much to me,
especially if it takes up more precious nano resources. All I need is a
reverse power indicator to tell when the tuner has matched the antenna.
The output power is going to be whatever it will be, there isn't much
you can do about it in the field. You don't normally adjust a tuner for
maximum output, you adjust it for minimum reflected power.

Any random piece of wire is going to work as an antenna. The issue is
whether you can match the rig to the antenna using a tuner.

tim ab0wr

On Sun, 06 May 2018 07:57:01 -0700
"Jerry Gaffke via Groups.Io" <jgaffke=yahoo.com@groups.io> wrote:

The goal is whatever we want it to be.

Showing SWR on the uBitx makes it useful for verifying an antenna
system is working without having to lug about an extra box,
especially when operating portable. If it costs an extra \$3 in parts,
I'm fine with adding it to the rig.

If you have a tuner that already shows SWR and forward power,
and your antenna needs a tuner anyway,
then your goal may be different.

Jerry, KE7ER

On Sun, May 6, 2018 at 07:43 am, Tim Gorman wrote:

Jerry,

What is the goal here? Is a wattmeter function really needed inside
the ubitx? Or would it be better as an external attachment that can
be used with other equipment?

For me, measurement of the reverse power is the primary measurement
needed inside the ubitx. It is useful for adjusting an external
tuner and for deciding if the ubitx is at risk from a bad load. I
am using the simple circuit at the nd6t site to get the reverse
power measurement. Right now I am using an external analog meter
but I have an adafruit ADS1015 that I am going to use when I get my
ubitx working again. I am using a little 4x4 breadboard to make an
I2C bus expander and the ADS1015 will feed into this along with the
I2C lcd.

Coding for this is extremely simple. You don't even have to convert
to volts. Just display the reading from the ads1015. As it goes
down you know the reverse power is going down. If you want to do it
with an analog pin on the nano you can do that too.

Just my 2cents. FWIW.

Re: ND6T AGC implementation for uBIT-X

Arv Evans

Bill K9Hz

I am impressed by your ATU design.  That should be of interest to the BITX group when you
publish it.  Will you be manufacturing and selling the unit as an on-line product?

From wondering if there might be a QRO version of your ATU I took a look at your "The QRO Group"
<https://groups.io/g/QRO>  and found that there are only 6 members, and that there have been only
6 posts from 2017 until now.  All of those posts seem to be from you.  Does that mean that QRO may
be a dying mode...?    🤔

A slightly off-topic question, what discipline is your doctorate in?  Is it based on a PhD, or some other
type of "doctor"?

Arv
_._

On Sat, May 5, 2018 at 11:45 PM, K9HZ <bill@...> wrote:

Arv…

Hmmm… we should probably take this off-line at this point.  This has to do with A/D resolution time vs. filter time.

I’m rethinking…that diodes would be a better choice just because they are less complicated.  The transform to watts and SWR is still complex though and will eat some processing power in a Nano.

My tuner is prototyped and the hardware is done.  The firmware is in the writing stage… I’m waiting for Jack to finish his Jackal project and a another second follow-up project before I officially ask for his help in coding.  It can tune 100 watts from any source (meaning it can be stand-alone… or I2C linked to the uBITx), uses latching relays to conserve power for QRP, has a 1:4 transformer for very low loads like the illusive short length impedances at very low frequency (12 ohms), CL-LC swap for high-low impedance matches of us to almost 12,000 ohms,  an AD8302 to generate phase and magnitude information of the load impedance like a point on a smith chart and then calculates the LC transform directly and instantly… no clicking-clacking relays searching for lowest SWR.  SWR and power is calculated and can be retrieved over the I2C or analog via the onboard dedicated Arduino (for those interested, the LP-100A watt meter generates power and SWR readings this way).  There is also a low power tune mode Dig Out to save the relays and protect the transmitter by commanding lower power (works down to about 250 mW).  So far it fits on a 5”x3” board but I may be able to shrink it.  Stay tuned.

Dr. William J. Schmidt - K9HZ J68HZ 8P6HK ZF2HZ PJ4/K9HZ VP5/K9HZ PJ2/K9HZ

Owner - Operator

Big Signal Ranch – K9ZC

Staunton, Illinois

Owner – Operator

Villa Grand Piton – J68HZ

Soufriere, St. Lucia W.I.

Rent it: www.VillaGrandPiton.com

Moderator – North American QRO Group at Groups.IO.

email:  bill@...

From: BITX20@groups.io [mailto:BITX20@groups.io] On Behalf Of Arv Evans
Sent: Sunday, May 6, 2018 12:05 AM
To: BITX20@groups.io
Subject: Re: [BITX20] ND6T AGC implementation for uBIT-X

Bill K9HZ

Not sure I follow your analysis.  The added capacitance lowers upper frequency limit by a significant amount.

You can even go as high as 0.1 MFD so that the detector output is filtered to virtually DC, leaving no HF

knee in the passband.  This does cause a charge period error unless there are multiple samples to charge
this capacitor.  Same thing applies to simple diode detection with it's post-detection filter capacitor.

The Arduino ADC provides 1023 distinct voltage steps.  It's internal voltage reference is used for calibration.

With a maximum of 5V and 1023 steps this gives a minimum sensitivity of around 0.005V and 5V full scale.

That range and resolution seems adequate for most transmitter RF measurements.

It may be interesting to try using conventional diode detection with a small forward bias to overcome the

diode offset.  This is not usually done in conventional SWR bridges because they are mostly non-powered

units.  But if the SWR bridge is to be inside a powered transceiver then the bias is readily available.

Now that AD8307 prices are more reasonable this device may be a viable alternative detector but it's

log slope ADC requires a bit more complex software if you want to derive the full compliment of FWD and

REV power, FWD and REV SWR, RF Voltage, RF Current, and possibly RF Impedance.

With either diode or AD8307 detectors it should be relatively easy to make the software support automatic

calibration.  Possibly this could be based on measurement of the known output of one of the Si5351a ports.

Using and displaying this output could also be a test point to verify that the synthesizer chip is actually

operating at normal levels.

Some time ago you mentioned work on a QRP ATU of your own design for use with BITX transceivers.  How
is that coming along?  Are you planning on including SWR and power measurement capability at both input

and antenna ends of this unit?  Might be interesting to include calculation and display of impedance, particularly

at the transmitter end of the ATU to help get a good 50 ohm match to the IRF510 finals and associated LPF.

As you know, impedance is important when using an LPF designed for a specific cut-off frequency in order to
make the LPF operate within its design parameters.

Arv  K7HKL
_._

On Sat, May 5, 2018 at 7:26 PM, K9HZ <bill@...> wrote:

Arv…

I’m quite familiar with the 8307 characteristics… there is a an effective 12.5K on chip resistor that forms part of a low-pass filter in shunt form basis that external capacitor.  It’s designed to reduce the ripple of the output and as I recall has a corner frequency of about 5MHz with the suggested capacitor (10 or 100nF from memory).  As you change the corner is also loads the output and changes the slope factor.  Not a big deal but you need to recalibrate.  It being faster than an analog meter is not really relevant and actually part of the problem.  What is relevant though, and what you see in the lab is that the P-forward resolved by the Nano A/D pin “x” finishes at “t” and P-reverse is resolved by Nano A/D pin “y” at “t+n” where “n” is what makes the difference.  Because of that filter above, it’s frequency dependent.  Most folks just calculate away for SWR and get a number and figure its right.  Might be.  Might not.  Someone actually wrote an article for QST on this.

Anyway… I tried.

Dr. William J. Schmidt - K9HZ J68HZ 8P6HK ZF2HZ PJ4/K9HZ VP5/K9HZ PJ2/K9HZ

Owner - Operator

Big Signal Ranch – K9ZC

Staunton, Illinois

Owner – Operator

Villa Grand Piton – J68HZ

Soufriere, St. Lucia W.I.

Rent it: www.VillaGrandPiton.com

Moderator – North American QRO Group at Groups.IO.

email:  bill@...

From: BITX20@groups.io [mailto:BITX20@groups.io] On Behalf Of Arv Evans
Sent: Saturday, May 5, 2018 7:48 PM
To: BITX20@groups.io
Subject: Re: [BITX20] ND6T AGC implementation for uBIT-X

Bill K9Hz

Adding a small external capacitor (o.001 mfd) at the input of each ADC provides extra stabilization

versus time for the voltage samples.  This added capacitance can be thought of as part of the
detector filter.   The sample rate of an AVR Mega-328 is quite fast but this adds a bit more pre-hold
or averaging to the traditional sample-and-hold function.

I would not worry about time shifting of ADC measurements because it is still faster than a ballistic
meter movement that we have all relied on for many years.  If you really want traditional mechanical
meter results you can slow down the sample rate or average several samples to arrive at an

In addition to measuring forward power, reverse power, and RF voltage, you can measure RF current

by using a current-transformer (like those in the Stockton or Bruene bridge) to get a voltage reading

that translates from RF current.  This may be very interesting for those who are using a uBITX or QCX

Arv  K7HKL
_._

Arv  K7HKL
_._

On Sat, May 5, 2018 at 6:23 PM, K9HZ <bill@...> wrote:

The I2C isn’t all that important.  What is important is the sample and hold.  Otherwise your forward and reflected power signals can be time shifted and won’t make sense.  But maybe again, if accuracy isn’t important to you, this isn’t either.  Ten turns of any small transformer wire on the T50-43 or smaller core works perfect.

Dr. William J. Schmidt - K9HZ J68HZ 8P6HK ZF2HZ PJ4/K9HZ VP5/K9HZ PJ2/K9HZ

Owner - Operator

Big Signal Ranch – K9ZC

Staunton, Illinois

Owner – Operator

Villa Grand Piton – J68HZ

Soufriere, St. Lucia W.I.

Rent it: www.VillaGrandPiton.com

Moderator – North American QRO Group at Groups.IO.

email:  bill@...

From: BITX20@groups.io [mailto:BITX20@groups.io] On Behalf Of Kees T
Sent: Saturday, May 5, 2018 6:59 PM
To: BITX20@groups.io
Subject: Re: [BITX20] ND6T AGC implementation for uBIT-X

The eBay sellers (many) are providing boards with AD8307s on them and also strips of AD8307 parts. On my mWattmeter II kit I provided a "matched set" of HP diodes which were forward biased with a few uA (AAA cell) to allow readings <1mW.....and it worked very well as measured in a local professional lab. I don't think that accuracy is required here. I can provide an I2C interface as Bill, K9CZ, suggested but don't know if that's really required here either.

I later gave the mWattmeter II design to Ron, W4MMP, for production because I got tired of making mWattmeter II kits.

I realize Diz makes a coupler but this one would be smaller  ...maybe 1" x 1-1/2" and use the dual double #61 FT-37 size toroids with Faraday shield and 23 turns, which I found to work best. A LOT of coffee cup coasters were made during that time. I have an old schematic but it's in .bmp format and won't load into the Files section.

73 Kees K5BCQ

 Virus-free. www.avg.com

Re: 45Mhz crystal filter specification

Jim Sheldon

One question from me Ashhar, where can I obtain several of those 45 MHz filters?  What is the part number?

Thanks,

Jim Sheldon, W0EB

------ Original Message ------
From: "Ashhar Farhan" <farhanbox@...>
Sent: 5/6/2018 11:03:06 AM
Subject: Re: [BITX20] 45Mhz crystal filter specification

You must use the L network of the ubitx or use 1:9 balun to get the proper shape of the fiilter. The 45 MHz crystal filters usually have a termintion specified for around 600 ohms.

Let me bullet this :
* All filters have the specified shape only when they are terminated at the specified impedance on both sides.
* The passive filters, including the crystal fitlers have no measurable termination to speak of at all. They have different responses at different impedances.
* The capacitors of the ladder filter set the bandwidth.
* The termination impedance sets the ripple. Lower impedance brings steeper skirt at the cost of ripples in the bandpass. To remove the ripples you increase the impedance and lose the sharpness of the skirt.

On Sun, May 6, 2018 at 7:45 PM, Tim Gorman wrote:
I'm using a direct probe. The 815 has a 50ohm input which should be a
match to most points in the ubitx. At least a close enough match to not
directly affect the circuits operation. I suppose I could use a 10x
scope probe but I'm not sure that would make much difference.

tim ab0wr

On Sun, 06 May 2018 01:03:42 -0700
freefuel@... wrote:

> Hi Tim,
>
> I'm interested to know how your connecting your SA to the circuit,
> from my recollection the majority of SA equipment has a 50 ohm input
> impedance, an input impedance that low is not conducive to hanging a
> probe off the circuit at any convient location.
>
> -Justin N2TOH

Re: 45Mhz crystal filter specification

Ashhar Farhan

You must use the L network of the ubitx or use 1:9 balun to get the proper shape of the fiilter. The 45 MHz crystal filters usually have a termintion specified for around 600 ohms.

Let me bullet this :
* All filters have the specified shape only when they are terminated at the specified impedance on both sides.
* The passive filters, including the crystal fitlers have no measurable termination to speak of at all. They have different responses at different impedances.
* The capacitors of the ladder filter set the bandwidth.
* The termination impedance sets the ripple. Lower impedance brings steeper skirt at the cost of ripples in the bandpass. To remove the ripples you increase the impedance and lose the sharpness of the skirt.

On Sun, May 6, 2018 at 7:45 PM, Tim Gorman wrote:
I'm using a direct probe. The 815 has a 50ohm input which should be a
match to most points in the ubitx. At least a close enough match to not
directly affect the circuits operation. I suppose I could use a 10x
scope probe but I'm not sure that would make much difference.

tim ab0wr

On Sun, 06 May 2018 01:03:42 -0700
freefuel@... wrote:

> Hi Tim,
>
> I'm interested to know how your connecting your SA to the circuit,
> from my recollection the majority of SA equipment has a 50 ohm input
> impedance, an input impedance that low is not conducive to hanging a
> probe off the circuit at any convient location.
>
> -Justin N2TOH