Tuesday, November 12, 2024

500 Watt Antenna Tuner Part 9 - Pre Build Schematics and Board Layout

 I am getting ready to order parts and build the tuner.  To prepare for it, I have updated the blog.  

I am planning to package the tuner on an open breadboard to showcase its construction.  It will be composed of three components (like the early prototype picture that I included in the matching algorithm page).  The three components are the directional coupler, the tuner controller and the RF deck.  

Here are the pages of the tuner controller:


Main/Microcontroller Page


Attenuator/Measurement Page


Controller Board Layout


And here are the pages for the RF Deck:


Main/Interconnect Page



Sunday, November 10, 2024

500 Watt Antenna Tuner Part 8 Software and Microcontroller

 Controller Hardware and Programming Language Selection

This is a new iteration of this page.  I have kept the old page and included it at the end of this blog post series for anyone interested.

With the recommendation of a friend, Mike Rauch K2VPX, I started looking at the Raspberry Pi Pico.  I built a test frequency generator and the frequency measurement function for this tuner.  It worked well and I really liked what I saw.  The documentation is superb.  I also chose its native C programming environment for no other purpose than to keep things as simple as possible.

I also tested an interface between the Raspberry Pi Pico and the Mac over USB and I am satisfied that it works reasonably well.

To conserve pin count and keep the board layout simple, I have chosen the SPI interface and tested the software for driving it.  I am using three NCV7240ADPR2G relay drivers.  I have also decided to put the 3 relay drivers in series as shown by the data sheet.  The Raspberry Pi Pico SPI Chip Select pin makes a low to high transition at the end of each block of data, so it does not meet the requirements of cascading the three relay drivers.  The workaround is to operate the CSN pin software separate from the data transmission using the SPI library.  Here is the pin utilization for the microcontroller

  • 4 pins for the SPI interface.  I am using SPI1 and specific pins to make the board layout easier.
    • RX: GPIO12 (note, GPIO, not pin numbers)
    • CSN: GPIO13
    • SCK: GPIO14
    • TX: GPIO15
  • 2 analog pins for magnitude and phase of the reflection coefficient
    • Phase: GPIO26_ADC0
    • Magnitude: GPIO27_ADC1
  • 1 analog pin for power level input
    • Power: GPIO28_ADC2
  • 1 pin for frequency input
    • Frequency: GPIO10
  • 1 pin for gating the frequency measurement (so I am not shipping a high frequncy digital signal all over the printed wiring board)
    • Measure: GPIO11
Lot's of spare pins left.  The 12 bit A/D convertors and fast floating point arithmetic are both pluses.   But the true winners are the documentation and the SDK.

Design Concepts

My core design idea is to interface the tuner to my Stationmaster software and use its ability to manage the radio, the linear, and the tuner together.  As of right now, I don't have any concrete ideas for a local display.  I might just stick with setting limits on power and SWR and Power measurements and lighting a red LED.  Then the Stationmaster software can interrogate the tuner and display the results.

The Stationmaster software will be interfaced with the Pico over the USB interface.  The commands from the Stationmaster to tuner are formatted as follows:
  • Address (one byte)
  • Command (one byte)
  • Data bytes as needed (zero or more bytes)
  • Terminating semicolon ";" (one byte)
Other than the address byte, this is the same format as the Yaesu radio commands.

The replies to the commands will be formatted as follows:
  • Address (one byte) 
  • Command (one byte) - the same as the command received
  • Data bytes as needed (zero or more bytes) 
  • Terminating semicolon ";" (one byte)
There will be two sets of commands.  One set for normal operation and another set for testing of the tuner.

Operating Commands:
  • Test tuner (to see if the device at this USB port is the tuner) - returns Address, Command, ;
  • Bypass - returns Address, Command, (decrease power or done - one byte), ;
  • Measure power - returns Address, Command, two bytes of data,;
  • Tune - returns Address, Command, (decrease power, increase power, or done), ;
Testing Commands:
  • Read phase - returns Address, Command, two bytes of data, ;
  • Read magnitude - returns Address, Command, two bytes of data, ;
  • Read frequency - returns Address, Command, four bytes of data, ;
  • Read digits (of the A/D convertors) - returns Address, Command, two bytes of data, ;
  • Read volts (of the A/D convertors) - returns Address, Command, two bytes of data, ;
  • Read LC (for positive and negative phases) - returns Address, Command, four bytes of data,;
One of the challenges with this program is to make sure that the code is readable and maintainable and that is when this objective runs into the other objective which is to make for making the board layout as easy as possible.  That resulted in a completely random assignment of capacitor and inductor relays to relay driver pins from the sofware point of view.  The routing of the bits out of the microcontroller to the relay drivers is as follows (for IC numbers, see the schematics in the next section).
Microcontroller => IC3 => IC1 => IC2 => Microcontroller 
So the first 16 bit word that is shipped out drives the pins to IC2, the second word drives the pins in IC1 and the third word drives the pins in IC3.  Here is what I think will make the code easy to read and maintain.

  struct relay{
  	int wordNo; //word 0 to IC2, word 1 to IC1 and word 2 to IC3
  	int pos;    //positiion of the two bits driving the relay
  };
  
  struct relay capRelays[8] = 
  	{
    	{2, 5},
        {2, 3},
        {2, 2},
        (1, 6},
        {1, 4},
        {1, 2},
        {1, 1},
        (0, 6},
    };
    
  struct relay indRelays[8] = 
  	{
    	{0, 3},
        {0, 4},
        {0, 5},
        {1, 0},
        {1, 3},
        {1, 5},
        {1, 7},
        {2, 4},
    };
    
  struct relay bypass[2] =
    {
    	{2, 6}, //input
        {0, 0}, //output
    };
    
  struct relay caps[2] =
    {
    	{2, 7}, //input
        {0, 7}, //output
    };
    
  struct relay comps[2] =
    {
    	{0, 2}, //series capacitor, close to short
        {0, 1}, //shunt inductor, close to engage
    };
  uint16_t words[3] = {0x0000, 0x0000, 0x0000}

The approach will be to locate the "1" position in the relay or capacitor position byte (outcome of the tuning algorithm), index into the capRelays or indRelays respectively, then pick the word number and change the bit positon as indicated by the relay driver datasheet. At least for now, my plan is to change on relay position at time with a little bit of delay between the changes to minimize noise.

To convince myself that the serial connection of the relay drivers works and also to debug the software for driving the relays, I am building a prototype board of the Raspberry Pi Pico, the three relay drivers and a bunch of LEDs and two relays.  It also gives me a chance to test the 5 volts feed circuit that I did not test in my previous prototype build.  Here it is.



 

I add more documentation to the code and link the Github page.




Wednesday, November 6, 2024

500 Watt Antenna Tuner Part 4B Inductor Design

 One of the design challenges that Jeff, K6JCA outlines in his blog is stray inductance of the connecting wires or PCB tracks.  He used hand wiring in his construction, so I thought I might do better with a PCB layout.  I went through a design cycle with six air wound inductors and two powdered iron core inductors and did a few design iterations of the PCB with KiCad.  I did not build the board but extracted the board geometry and estimated the path inductance.  My results were the same as Jeff's.  

I decided to build all my inductors with toroid cores.  This provides me the advantage of packing them closer to each other and help keep the connecting tracks shorter and hence reduce the path inductance.  This is the approach that some of the commercial high power antenna tuners take.

Also, I noticed that some of the commercial high power antenna tuners placed the capacitor and inductor relays on the back side of the board (the same with Jeff's design).  This approach tends to further reduce the path inductance without increasing the PCB cost since I am using through hole relays and calling for solder mask on both sides of the board.  

For high power inductors, the recommended material to use is powdered iron cores (not ferrite), so that is what I will use.

The Mini Ring Calculator for Mac is now available, but I am familiar with the Micrometals on line tool, so, that is what I will use.  I will assume an internal enclosure temperature of 50 degrees C and maximum core temperature increase of 50 degrees C.  That meets the maximum toroid core temperature of 100 degrees C which is fine for intermittent use.  The other factor that I need is the maximum RMS current through the inductor at each frequency.

My simulator (described earlier), calculates maximum current through the inductors and maximum voltage across the inductors, but not the current at maximum voltage.  Fortunately, knowing the maximum voltage, I can calculate the current at this voltage with a spreadsheet.  

The following table is the simulator output that shows peak inductor currents and peak inductor voltages across the HF bands at average 200 watts operating power. 

Ind Current12.8 uH6.4 uH3.2 uH1.6 uH800.0 nH400.0 nH200.0 nH100.0 nH50.0 nH25.0 nH
160m low8.94674422981618140201053
160m high8.904583221789045221163
80m low8.90474437292157783920105
80m high8.900458322178904522116
40m low8.90047443729215778392010
40m high8.90045344430116382412010
20m low8.9000474437292157783920
20m high8.9000466440297160804020
17m low8.900004683512001015125
17m high8.900004713512011025125
15m low8.900004843832291185929
15m high8.900004793862331206030
12m low8.900004814152651397035
12m high8.900004834172661407035
10m low8.900004744372911577839
10m high8.900004724463051668342
6m low8.90000048341726614069
6m high8.80000047643328315075
Max8.946747447447448448343328315075
Max RMS6.3330.2335.2335.2335.2342.2341.5306.2200.1106.153

Inductor Maximum Peak Currents and Voltages Table

Here is the calculated RMS current through each inductor at the maximum voltage across that inductor at a given frequency.

3.2 uH1.6 uH800 nH400 nH200 nH100 nH50 nH25 nH
160m low5.826.296.336.256.256.256.257.50
160m high5.666.266.336.336.196.196.756.75
80m low4.395.876.316.276.276.436.436.43
80m high4.035.666.266.336.336.196.196.75
40m low2.384.395.876.316.276.276.436.43
40m high2.184.285.806.286.326.326.176.17
20m low-2.384.395.876.316.276.276.43
20m high-2.284.315.826.276.276.276.27
17m low--3.625.446.196.266.326.19
17m high--3.655.446.236.326.326.19
15m low--3.245.136.146.326.326.22
15m high--3.145.066.116.306.306.30
12m low--2.724.695.996.286.336.33
12m high--2.724.695.996.306.306.30
10m low--2.384.395.856.316.276.27
10m high--2.244.225.786.296.296.37
6m low---2.724.695.996.306.21
6m high---2.484.515.906.256.25

                            Inductor RMS Current at Maximum Inductor Voltage

As it can be seen from this table, in many instances the inductor current at maximum inductor voltage is the same or near the maximum inductor current value of 6.3 amps.  But in some cases, especially for the higher value inductors, the current is much less than the maximum inductor current.  Here is a table of all the cases where a lower inductor current value can be used.

3.2 uH1.6 uH800 nH400 nH200 nH100 nH50 nH25 nH
160m low 5.82
160m high 5.66
80m low 4.395.87
80m high 4.035.66
40m low 2.384.395.87
40m high 2.184.285.80
20m low -2.384.395.87
20m high -2.284.315.82
17m low --3.625.44
17m high --3.655.44
15m low --3.245.13
15m high --3.145.06
12m low --2.724.695.99
12m high --2.724.695.99
10m low --2.384.395.85
10m high --2.244.225.78
6m low ---2.724.695.99
6m high ---2.484.515.90

Cases With Less Than 6.3 A RMS Maximum Current

I spent a bunch of time playing around with different powdered iron cores to find the smallest ones that met my design criteria.  After finding the ones that did meet my requirements, I tested the next smaller size and in all cases, they failed to meet the temperature rise criteria.  This table is the outcome of this step.  I should also note that I was using 18 AWG wire as the wire input parameter to the program.

The first inductance value is the design target.  But given the AL values (see below) and an integer number of turns, only certain inductance values can be realized.  The second inductance value is the estimated value based on the core properties (AL value).  After these inductors are built and tested, I will list their actual values.

L (nH)CoreAL (nH/N2)TurnsL (nH)I (Arms)f (MHz)P (W)T (deg C)
25T94-172.93266.3301.733
50T94-172.94466.3302.647
100T130-174.051006.3304.749
200T184-178.752106.3307.743
400T184-178.774106.37.33.422
400T184-178.774106.014.355.532
400T184-178.774105.521.457.039
400T184-178.774104.7307.042
800T184-178.7108506.37.36.135
800T184-178.7108504.414.355.231
800T184-178.7108503.718.24.628
800T184-178.7108503.321.54.427
800T184-178.7108502.8304.829
3200T184-178.71416606.046.436
3200T184-178.71416604.47.35.031
3200T184-178.71416602.414.352.618
3200T184-178.72033104.442.320
3200T184-178.72033102.47.33.017

Inductor Design Using 12 AWG Wire

The parameter AL needs an explanation.  The formula for the number of turns from the RF design book is:
\begin{equation}N = 100 \times \sqrt {\frac {L}{A _{L}}}\end{equation}
Where N is the number of turns and L is inductance in micro Henries, N in turns and AL in micro Henries per hundred turns squared.  
Important to note that Amidon publishes its AL values in micro Henries per 100 turns squared while Micrometals publishes them in nano Henries per turns squared.  So, while using the Micrometals data, drop the 100 in the formula and use nano Henries for L.

It is worth mentioning that 2 and 6 material that could potentially be useful in this application have much higher AL values for their larger cores that can support the required power levels.  These higher AL values make it much harder to get close to the desired inductance values with any accuracy.

I built a few of these inductors and the inductance was not anywhere near what I expected.  To simplify the task of experimenting and finding out what is going on, I switched to 22 AWG magnet wire (working with 12 AWG wire is very yard).  The graph below is a plot of the AL value vs. the measured inductance for a T187-17 core which has a specified AL value of 8.7 nH per turns squared.

Toroid AL value vs. Measured Inductance

It is clear from the graph that for smaller inductors (less turns), the wire inductance dominates.  But as the number of turns increase since the AL value changes with the square of the number of turns, we asymptotically approach the specified AL value.  

After my experience with 12 AWG wire (which I had picked when I was going to use air core inductors), I decided to consider a thinner gauge wire since using a toroid allowed me to use less turns.  I experimented with a number of different wire gauges and 18 AWG wire seemed to meet the power loss requirements well.  I built a number of inductors to the exact number of turns predicted by the formula (and the design tool), tested them and then took off the turns needed to obtain the required inductance.  Below is a plot of designed turns vs. the experimental turns.


Measured Turns vs. Calculated Turns

Armed with this data, I was ready to run through the design process.  In the first iteration, I used the same turns as the table with the 12 AWG wire and recorded the result.  But then I reduced the turns ratio according to the above graph equation as follows:

L (nH)CoreDesigned TurnsMeasured Turns
25T94-1731
50T94-1742
100T130-1753
200T184-1753
400T184-1774
800T184-17108
1600T184-171412
3200T184-172018

Specific Inductance Calculated and Measured Turns From the Graph

With these new number of turns, I calculated the power loss in the core.  What is significant in this table is the number of turns (taken from the above table) and the power dissipation (P) and temperature rise (T).  I have intentionally left off the 25 nH inductor from this list in the hope of using the PCB trace inductance in is place.

L(nH)CoreAL (nH/N2)TurnsL (nH)I (Arms)f (MHz)P (W)T (deg C)
50T94-172.91466.3300.718
100T130-174.021006.3301.536
200T184-178.732106.3305.335
400T184-178.754106.37.33.625
400T184-178.754106.014.355.234
400T184-178.754105.521.456.038
400T184-178.754104.7305.938
800T184-178.788506.37.36.642
800T184-178.788504.414.355.133
800T184-178.788503.718.24.429
800T184-178.788503.321.54.027
800T184-178.788502.8304.028
1600T184-178.7121660647.044
1600T184-178.71216604.47.35.435
1600T184-178.71216602.414.352.619
3200T184-178.71833104.446.641
3200T184-178.71833102.47.32.820

Power Dissipation and Temperature Rise for the Designed Inductors

What remains is the building and testing of the inductors.  It is important to know the parasitic capacitance of each inductor.  So, let's look at the reactance of an inductor, measured at low frequencies in parallel with a capacitor:
\begin{equation}Z = \frac {j \omega L_{0}\frac {1}{j\omega C}}{j \omega L_{0} + \frac {1}{j \omega C}}\end{equation}
After a bit of algebra:
\begin{equation}Z = \frac {j \omega L_{0}}{1- \omega ^{2} L _{0}C}\end{equation}
Staying away from the resonance frequency of the inductor, we know that:
\begin{equation}\omega ^{2} L _{0}C \lt 1\end{equation}
\begin{equation}L = \frac {L_{0}}{1- \omega ^{2} L _{0}C}\end{equation}
Which we can solve for L0.  Hence:
\begin{equation}L_{0} = \frac {L}{1+ \omega ^{2} LC}\end{equation}
But to solve for L0, we need to know C, so we make measurement in two different frequencies, say 3 MHz and 30 MHz.  We can write the equation for L at two different frequencies and divide the two sides by each other we get:
\begin{equation}L_{1}-\omega _{1}^{2}L_{0}L_{1}C = L_{0}\end{equation}
\begin{equation}L_{2}-\omega _{1}^{2}L_{0}L_{2}C = L_{0}\end{equation}
\begin{equation}L_{1}=(\omega _{1}^{2}L_{1}C+1) L_{0}\end{equation}
\begin{equation}L_{2}=(\omega _{1}^{2}L_{2}C+1) L_{0}\end{equation}
\begin{equation}\frac{L_{1}}{L_{2}}=\frac{\omega_{1}^{2}L_{1}C+1}{\omega_{2}^{2}L_{2}C+1}\end{equation}
Solving for C we get:
\begin{equation}C=(\frac{1}{L_{2}}-\frac{1}{L_{1}})\frac{1}{\omega_{1}^{2}-\omega_{2}^{2}}\end{equation}

Plugging the numbers into a spreadsheet with the above formulas we get:

Design L (nH)Turns3 MHz30 MHzCalc C pFL0 nH
32001831736900433156
16001215382079431538
800879979835798
400539141030391
200321722016217
1002919191
501555555
251282828

In the last three rows, the Nano VNA gave a lower inductance at 30 MHz than 3 MHz though the reactances were the same.  So, I used the reactance values to calculate the inductance.  The parasitic capacitance for these three inductors is negiligible.

 And finally, here is a picture of the inductors: