The Magic Tune Button

With the advent of the solid state rigs having a tune capability seems almost like having a buggy whip as an accessory to your new Maserati sports car.

After all in the old days you had to tune, dip and load to be able to get maximum power out of your tube rig. Also a sure way to flatten the tube finals is to have them working into a mismatched load. If you were lucky, after tune up with a tube rig, you could go up or down in frequency by say maybe 10 kHz (20 kHz total) and no retuning.

Solid state gear on the other hand is broad banded so no more tune dip and load -- well not entirly true. Given the penchant to operate portable, mobile or away from the normal station setup: The question when away from home is how do you provide that bit of RF that is needed to tune the antenna tuner?

Solid state finals can also be smoked using a mis-matched load with high SWR. Despite what has been stated on the Bitx reflector the IRF510 is not bullet proof and it too can be smoked as a result of mismatching at the load. So now it may be a case of antenna tuning versus rig tuning. Then of course the illuminati will tell you "their latest commercial rigs" have auto tuning capability built into their rig. Yes my KX3 does that too. But what about a roll your own minimalist home brew rig? So some sort of "tune up" signal maybe required.

[While we are at it, there is about 30% of code space still available on the Arduino --so with a port expander and a few stepper motors you may be able to implement auto tune of the Sudden. I dabbled a bit with auto tune using the PIC 16F84 but got lost n the assembly language -- this would be way easier with the Arduino.]

Schemes abound for placing a modern rig into the tune mode. One common (less elegant) way is to scream HOLA or whistle into the microphone, or holding down the key if you have CW capability --few of my rigs are CW capable. Other methods include having a separate RF oscillator or a BFO frequency whose frequency is shifted to the center frequency of the filter and RF is generated for tune up. I did use a separate oscillator in my KWM-4 transceiver.

Still another method is to have an outboard audio oscillator to generate an audio tone and feed that into the balanced modulator. I believe that is done on the uBitx for CW generation. For the Sudden Transceiver the audio tone generation is the method we are using only we have the Arduino be the source for the tone generation. One of the available Arduino libraries is called "toneAC" which can be used for this application. I selected a 988 Hz tone which is the closest tone to 1 kHz.

The process is rather simple. In earlier versions of my Tune Tone Code (I did this all on my own, so it is original), I would simply press a momentary push button and BOOM: The rig would go into transmit, the tone code which is pulsed (easier on the solid state finals) would be produced for a 10 second time period and then stop. The final piece is the rig goes back into receive. In fact for those so inclined to look at the code details (not for information but to pick my code apart) you will see Pin 7 is called LED. This was the pin that was formerly used to trip the PTT switch. Not directly mind you -- but it keyed a small relay to close the PTT.

This is pretty slick; but I have since opted for a simple SPST toggle switch that I call MOX ( old school, manually operated transmit) which is first engaged thus putting rig into transmit and then the momentary push button is engaged. The reason for the MOX is often I would like to put the unit in transmit without having to hold down the PTT such as when you are trouble shooting where both hands might be needed. Thus the MOX can serve two purposes.

Here is the Arduino Code for the Tune mode. But there are some other pieces in the code since we now have the Color TFT Display. The display also indicates that the rig is now in the TUNE Mode by having the word TUNE in red lettering appear on the screen and this is in addition to having a small GREEN LED appear on the screen. You gotta love the Arduino and the Color Displays.

Now some specifics to note. I set it for a 75% duty cycle so that it is on 75% of the time and off 25% of the time. Originally the commenting said 50% and you can make that change. But keep in mind that if you make the "on" duty cycle so low you will hardly get any output. I was experimenting with a 40 /60 ratio and instead of entering 40, I entered 4. When I tested it I thought disaster struck as there was very low output --upon inspection of the code I saw my error and that is when I put the 75 in the code. Output back up to full.

When this code is activated there is specific instructions to use VFO A as the transmitted frequency and the writing of the LED HIGH is in the code but not phyically implemented. If the LED Pin (D7) is connected to a 5 VDC SPST relay you can trip the PTT and the unit will automatically go into transmit.

During the TUNE Cycle the word TUNE appears in RED at a location on the display (Size 1 Text = small). The A0 written HIGH will switch to VFO A if you happen to be on VFO B. A small GREEN Circle (Pseudo LED) is also shown on the Display to show you are transmitting --over kill but the more bells and whistles adds to the "flashiness".

The "else" part of the if/else shuts off the Tone and paints over the RED "TUNE". It also unkeys the PTT if you are using the relay in parallel with the PTT. For those who are EMRFD and uBitx aficionados who like to pick things apart, the if statement lights a GREEN Dot LED but the else does not cover it over such as you did with the RED TUNE which is covered in BLACK.

The reason why this is not required is that elsewhere in the code there is a sub-routine for TRANSMIT that essentially says if Pin D4 (or just 4) is LOW then also provide the GREEN Dot but if Pin D4 is HIGH then the GREEN Dot is covered over in black. The MOX switch because it is in parallel with the PTT when it is engaged drives Pin D4, LOW and the dot appears. When D4 is HIGH then it is covered over. The RED TUNE is only covered in this sub-routine and thus has to be treated when in a non TUNE mode.

I have taken the time to point this out since one has to be very careful about what you do in the ccode and how it is done. Things that seem unrelated are often very dependent. Now you are smart too!

//***************Tune Function Check Mode ********
void CheckMode(){
buttonState = digitalRead(SW1); // creates a 10 second tuning pulse train 75% duty cycle and makes TUNE appear on the screen
if(buttonState != lastButtonState){
if(buttonState == LOW){


//si5351.set_freq(vfoA , SI5351_PLL_FIXED, SI5351_CLK0);
digitalWrite(LED,HIGH);

display.setTextSize(1);
display.setTextColor(RED);
display.setCursor(132, 67);
display.print("TUNE");
digitalWrite(A0, HIGH);


display.fillCircle(152, 57, 3, GREEN);


delay(12);
for(int i = 0; i < 100; i++) {
tone(6, NOTE_B5);
delay(75);
noTone(6);
delay(25);

}

}
else{
digitalWrite(LED,LOW);
display.setTextSize(1); // This prints a Black TUNE over the RED TUNE and makes it disappear from the scereen
display.setTextColor(BLACK);
display.setCursor(132, 67);
display.print("TUNE");


noTone(6);

}


delay(50);

}



}

This is where we drag out the Caveat Emptor (Buyer Beware). Ahead of this subroutine you do have to list the toneAC library link and define the tone note and the tone output pin. Here are three lines from the main sketch:

 

#include <toneAC.h>
#define TONE_PIN 6
#define NOTE_B5 988