Wednesday, February 15, 2017

A Practical Problem ~ How to make your hombrew rig do TUNE?

(A note from Pete -- I can see the number of hits on each post and was somewhat surprised that the secrets of homebrewing got nearly 500 hits and the troubleshooting one just over 150. So that is helpful and very telling --we like to build stuff; but don't like to fix it. That is the last time that troubleshooting will be discussed by me. I know how to do it --do you?)

How to make your Rig do TUNE?

So you asked has Pete been in the house too long because of all the rain in California and now has gone bonkers?  Everyone knows for SSB only rigs (like the stock Bitx40) you simply whistle into the microphone or yell the standard "HOLA"  into the microphone! Others will ask why do you even want to tune your radio? VU2ESE's Bitx40 instructions basically say plug in the microphone and talk it up.
Well having your SSB only rig be able to TUNE has some very practical and necessary applications. The CW ops are smiling now as they think --just hold the key down for about 10 seconds and you are in TUNE.
The "why" is now unveiled. Firstly if you have homebrewed your own rig, then you need to make adjustments so that the performance is optimized such as tuning the Band Pass Filter or setting drive levels to intermediate stages or even adjusting the bias on your IRF510. Of course you would never do this "on air" but into a dummy load. That is a lot of whistling or shouting HOLA. CW ops are still smiling!
Thus rig adjustment for best performance is probably the 1st use and the second after that  is the adjustment of the rig to the antenna. So OK, you have one of those fancy auto tuners and you let the tuner do the hard work. But if you are like me and have no such devices, then you need to be able to provide a tune signal to make the adjustments -- thusly reason #2. Perhaps a third is maintenance --suppose you suspect you are not getting full smoke to the antenna --then you would want to put your rig in TUNE and see what the output looks like.
So how does one generate a TUNE signal. Mind you the TUNE doesn't have to be at full power but just enough to put a couple of watts of RF into a dummy load or into your antenna system. So how is it done?
Method #1. In an SSB only radio if there is a way to unbalance the carrier in the balanced modulator then a simple unbalancing will output the carrier. This seems like an antithesis of its purpose. We work hard in our rigs to make the carrier "go away" --we get nervous when the carrier suppression is only 65 dB down and now we want to undo that. Well many of the old boat anchor radios had a carrier balance control right on the front panel so you could make that adjustment. Now with our packaged Double Balanced Mixer a bit harder to do. The SBL-1 however can be unbalanced --read EMRFD for a way as described by W6JFR (yes me in another life). But you cannot do this in a casual manner --so not for everyone.
Method #2 which offers some bonus features in that you effectively can add CW to your SSB only transceiver. In my KWM-4 I added CW by having a separate CW oscillator tuned to the center frequency of the filter and that signal was fed to a keyed buffer stage. This CW oscillator was only turned on when you hit the key and was held on for a short period of time. The output from the keyed buffer was fed to a relay where it was injected into the 1st  bilateral IF stage bypassing the filter. From there the signal went to the RxTx mixer stage. Sorry CW ops this is not QSK and is like semi-break in with delay. Clunky for the ardent CW op --yes but it would do CW with an offset since on receive  the Rx was set to USB. This same approach could be used for TUNE. Just hold down the key. The real hard part of this was the control and sequencing circuitry. But it did work. I have made one CW contact on the KWM-4 and it worked flawlessly. I had to do the CW contact for proof of concept.
Method #3. Since my primary interest is SSB --- how would you do this? Many early transceivers  used a tone for generating CW and that same tone keyed the VOX which put the rig into transmit. The Collins KWM-2 used this approach as did others. Staring me in the face was the Arduino and I said why can't I let the Arduino do all of the heavy lifting. I researched generating tones with the Arduino and it was possible to do just that. For the earlier IDE's there is a library called "toneAC" that must be in your library section of the Arduino folder. Now the rub --you will have to find a later version of this library to work with the IDE 1.6.0 and above.

So that is step one. Next you will have to include the following in your sketch: #include <toneAC.h>  Now I picked a tone that was close to 1000 Hz and the best I could do was 988 Hertz. That to needs to be in the sketch in this form  #define NOTE_B5 988 Finally you need to designate a tone pin --where will the output be on the Arduino and you will need this statement const int tonepin = 4; //tune up tone  We will also need to start the cycle and thus an input pin --in the set up you must write code for the pinMode and to define a status for the pin so that it is HIGH. We picked pin 12 and called that SW1 which is really a push button.

#include <toneAC.h>
#define NOTE_B5 988
const int tonepin = 4; //tune up tone
const int SW1 =12; // provides the TUNE function
const int LED = (some free pin number); //attach mini relay to parallel PTT contacts

In the setup()

     pinMode(SW1, INPUT); //Tune

So how does generating a tone work and how does this cause a TUNE signal? Essentially the sequence is to momentarily hit a panel mounted Push Button which we call SW1. There is a call function in the loop that constantly looks to see if the push button has been pushed which would be a signal that Pin 12 is LOW. From there the call function starts and the main loop is on hold. In the most current use I have pretty much used up all of the Arduino pins so had to come up with a bit of a work around.

When I first used this approach I was not constrained for pins and here is the sequence of what happened. The PB is engaged and the loop takes over and recognizes the button was pushed and immediately moves to the call function. Another free pin was designated as a Push To Talk pin and so upon initiation would go HIGH to which a 5 VDC mini relay was connected whose contacts were in parallel with then normal PTT contacts --the rig would now be placed into transmit. Next a message would appear on the screen, that the rig was in TUNE. Finally the tone was generated at 988 Hz, But there was a loop counter inside the loop that would turn the 988 Hz tone on and off for a specific number of cycles and thus a pulsed tone. That was the "if" part of the call function. The else part is where the word Tune is once again painted on the face of the display only it is the color of the background and thus "disappears". The pin driving the 5 VDC mini relay goes low and the PTT un-keys and the receiver comes to life. The pulsed tone is better than a constant tone as it is easier on the finals and is helpful during a antenna tune where the SWR is high. Below is an example of the rig in the TUNE mode. Pretty cool?

In one of my current projects I was short of pins so I just paralleled a panel mounted switch that is in parallel with the PTT. After engaging the (MOX) switch the rig is in transmit and I simply press the momentary PB and we are in tune. The "MOX" switch on the panel is nice if your are testing microphones so you don't have to hold down the PTT.

But wait you are NOT done. That beautiful 988 Hz tone is a SQUARE wave and perhaps a bit hard on some of the circuitry downstream. On the internet I found a square wave to sine wave RC network that uses three 1.5K resistors and three 10 NF caps. --almost like a phase shift network --well it does knock of the corners but is no pure sine wave.

Here is the call function code: //For Check Mode --ie TUNE If you have added the 5 VDC relay to one of the pins you need to add digitalWrite(LED, HIGH) in the "if" part and digitalWrite(LED,LOW) in the "else" part. I simply called the PTT pin LED and you will also have to declare the LED pin number and the initial setup() add  pinMode(LED, OUTPUT); and initial state digitalWrite(LED, LOW);

     void CheckMode(){
      buttonState = digitalRead(SW1); // creates a 10 second tuning pulse train50% duty cycle       makes TUNE appear on the screen
       if(buttonState != lastButtonState){
       if(buttonState == LOW){
     tft.setTextColor(WHITE); // This puts a white TUNE on a black background
     tft.setCursor(126, 110); 
     for(int i = 0; i < 100; i++) {
     tone(4, NOTE_B5);
         tft.setTextSize(2);    // This prints a black TUNE over the white TUNE and makes it disappear  from the screen
         tft.setCursor(126, 110);
Pete N6QW.

This is a useful tool but does require some noodling.