How to Handle More Than One Band!
[Arduino Code Snippet ADDED to this post]
So you have just homebrewed a new QRP transceiver and it doesn't matter if it is SSB or CW and as a bonus have included two bands. Now the problem how to switch all the needed circuits so that with a simple DPDT Toggle switch -- the magic happens!
But let us back up in the sewer so we get the full aroma. Switching bands entails several actions including switching the LO range (I am presuming a digital LO) as well as the Band Pass and Low Pass Filters. One half of our DPDT can be dedicated to the Arduino Input for band change while the other half of the switch can "Power On" sets of relays to select the one of two bands.
Above is a two band LPF with the yellow core being the 20 Meter Section and the red core the 40 Meter Section. The two black relays are SPDT. and the Yellow relay is a DPDT.
By my wiring convention I made it so the NC contacts on the DPST are connected to the 40M Section and the NO to the 20M Section. The Center Leaf on the Left DPST is connected to the IRF510. Thus the LPF is always connected to the IRF510. In simple terms the LPF is not in the Receive Loop. This avoids hot switching the LPF to the IRF510.
The DPST relay on the right side of the LPF's has its center Leaf connected to the NO Contacts of the DPDT (yellow) Relay. (Again NC = 40M and NO = 20M)
For the DPDT (TR Relay) I simply bridged (connected together) both sets of contacts as we are running 5 watts through that relay. The Center Leaf of the Yellow relay goes to the bulkhead mounted antenna connector. The NC contacts of the yellow relay are connected to the Receive side of the transceiver. That follows that the NO side of the (TR Yellow Relay) is connected to the output side of the LPF Relay.
Wiring is as follows the two DPST relays are powered from the Toggle switch! So "power on" switches bands. That switch at the same time switches the Arduino to the new band. The Yellow (TR) Relay has juice applied at all times BUT only grounded through the PTT switch (or MOX) control on transmit. Thus normal action has it so on receive the signal from the antenna is passed onto the receive section But on transmit the antenna is connected to the selected LPF.
Purposefully I did not draw a schematic as that is left to the reader. If you can't draw a schematic from what I have described, don't build the filter and consider stamp collecting!
Critical Path items! The base for this assembly is single sided copper vector board where the top surface is a ground plane and all connections to ground are simply soldered to the top of the board. All network connections are made on the under insulated side. Prior to passing connections that are not grounded through the board, I take a small drill bit and ream out the area around the penetration hole so there are no shorts to ground. Connections made to ground are not reamed. Look at the Right Side DPST in the lower right hand corner and you will see the reamed hole.
Secondly I use the W3NQN filter design as that specifically addresses the 2nd harmonic issue. The QST article which can be found on the internet gives the constants for all of the ham bands. I found it best to simulate the circuit in LT Spice and if you are a Nano VNA aficionado you can test the network after it is built to check your work.
Next is some code snippets to show how the Arduino Code is arranged to respond to a LOW condition on either Pins A0 or Pin 5. This is not a standalone sketch but shows some of the elements needed to be added to existing sketches that start by identification that two pins will be used to detect a band change and then when a condition is identified for each LOW that becomes the start up frequency sent to the Si5351. I did not write this code but a ham in VK land was kind enough to furnish this to me.
A ham friend here in the US is already looking at using the Nextion touch screen so that you touch a button on the screen and it is automatic band change. An additional output pin on the Arduino would trigger a transistor switch to cause the relays on the BPF and LPF to toggle between the bands.
READ THIS IS NOT A COMPLETE SKETCH! THIS IS JUST ADDED ELEMENTS TO BAND CHANGE. ADDING MORE BANDS AND START UP FREQUENCIES IS NOT DIFFICULT. Added bands require changing a few parameters.
/* Sample code added to your sketch to give two band operation. Pins A0 an 5 are the input pins driven LOW to change bands
The two numbers 16198500 and 23201500 are the start up frequencies for 40 and 20M with a 9 MHz IF
*/
int SWBANDS = 0;
int BSW = 0;
const int MAXBANDS = 2; // the number of bands we are using
const int SWBAND[MAXBANDS]={A0,5}; // 40m on A0,20m on 5
const int_fast32_t rxfreqs[MAXBANDS]={16198500L,23201500L}; // the default starting frequency for each band
int lastband=0; // used to keep track of the last band used
void setup() {
int lp;
int pin;
for (lp=0;lp<MAXBANDS;lp++) // set up each bandswitch position
{
pin=SWBAND[lp];
pinMode(pin,INPUT_PULLUP);
digitalWrite(pin,HIGH);
}
}
void loop() {
CheckBand();
}
//************************************************************************************ Band Switch Check
void CheckBand()
{
unsigned char lp; // temporary variable we will use to step through each of the bandswitch pins
int bandpin; // and temporary variable to store the reading from the current bandpin
for (lp=0;lp<MAXBANDS;lp++) {
bandpin=digitalRead(SWBAND[lp]); // read the bandpin
if (bandpin==LOW) { // if it is low we do a small delay before checking it again - this is a dodgy way of doing a debounce
delay(5); // might need to change this to 50
Serial.print("Pin low detected: ");Serial.println(lp);
}
bandpin=digitalRead(SWBAND[lp]); // after the delay, we get the pin state again, so we can see if the state has changed
if (bandpin==LOW) { // okay, if we are still low, then it is probably safe to assume that the switch is fully engaged, and the contacts have settled.
if (lastband!=lp) { // check to see if we were already on this band
Serial.print(lp);Serial.print(" low and not lastband (");Serial.print(lastband);Serial.print(")");
lastband=lp; // we were not, so we need to set lastband to this band, so the next time around we won't actually change the frequency
rx=rxfreqs[lp]; // and finally we can change the frequency
Serial.print(" new band: ");Serial.print(lp);Serial.print(" new freq: ");Serial.println(rx);
break; // the break here drops us out of the loop - after all, we have changed frequencies so we don't need to waste time checking the other switch positions
}
}
}
delay(100); // I've added this line as you had a delay at the end of the change band code previously - not sure if its required or not? 90% sure it can be removed
}
This project has five bands using the code.
73's
Pete N6QW
Wow what revelations about the emperor (with miniscule e) from Bob Woodward. It is said: Trump Lied, People Died as I heard quoted this morning! We should all get White Hats with the letters TLPD. Hey all you MAGA guys still think he is your man?