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 enviroment for no other purpose than to keep things as simple as possible.

  • 2 pins for the bypass relay (to simplify the board layout)
  • 2 pin for the capacitor relay (across load - Region 1 or across source Region 2 see below)
  • 8 pins for the capacitor network
  • 8 pins for the inductor network
  • 2 analog pins for magnitude and phase of the reflection coefficient
  • 1 analog pin for power level input 
  • 1 pin for frequency input
  • 1 pin for gating the frequency measurement (so I am not shipping a high frequncy digital signal all over the printed wiring board)
  • 1 Spare pin
Not much to spare, but it will do.  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

Most aspects of the design are fairly straight forward and I will discuss them second.  But the real time display of SWR and output power need some additional thought and research.  I spent a day and half looking for a good solution with little luck.  I finally decided to go to a library that I had used before, Plotly.  I spent a lot of time reading through API documentation, but eventually, I figured it out.  I will embellish this display, but unless I can think of something better, this is what I am going to go with.


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 recieved
  • 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, ;
I add more documentation to the code and link the Github page.


No comments:

Post a Comment