Topics

logic mod for filter selection #ubitx #arduino

ajparent1/KB1GMX
 

While doing other things I realized I needed one IO pin for a differently arranged user interface.

Looking at the relay tree it is notable there are only 4 used states and one that is don't care.
That don't care allowed me to remove C155, R151, and Q17.  That is replaced with two diodes
to the collector of both Q18 and Q19 (cathode to the collectors) and anodes to the former
Q17 collector.  what that does is any time Q18 or Q19 is active KT1 is activated.   
If that seems odd the relays are a partial decoding tree so if we encode the controls correctly
we get the needed result and one free IO pin.  To make it work Relay KT1 must be activated 
when we leave the 20-30mhz region for 20/17M or lower.  Since to go lower than 20mhz we
must have a signal the TXC is used as that controls the 40/80M relay KT3 but means nothing
unless KT2 is activated  Using two diodes as a logical OR we can then use Q18 and Q19
to force KT1 to be active.  So for 20M and down KT1 is active and the other three select
what bands below that.  I got the IO pin and the firmware got simpler.

The code of course changes from:
/**
 * Select the properly tx harmonic filters
 * The four harmonic filters use only three relays
 * the four LPFs cover 30-21 Mhz, 18 - 14 Mhz, 7-10 MHz and 3.5 to 5 Mhz
 * Briefly, it works like this, 
 * - When KT1 is OFF, the 'off' position routes the PA output through the 30 MHz LPF
 * - When KT1 is ON, it routes the PA output to KT2. Which is why you will see that
 *   the KT1 is on for the three other cases.
 * - When the KT1 is ON and KT2 is off, the off position of KT2 routes the PA output
 *   to 18 MHz LPF (That also works for 14 Mhz) 
 * - When KT1 is On, KT2 is On, it routes the PA output to KT3
 * - KT3, when switched on selects the 7-10 Mhz filter
 * - KT3 when switched off selects the 3.5-5 Mhz filter
 * See the circuit to understand this
 */
void setTXFilters(unsigned long freq){
  if (freq >= 21000000L){ 
    digitalWrite(TX_LPF_A, 0);
    digitalWrite(TX_LPF_B, 0);
    digitalWrite(TX_LPF_C, 0);
  }
  else if (freq >= 14000000L){ 
    digitalWrite(TX_LPF_A, 1);
    digitalWrite(TX_LPF_B, 0);
    digitalWrite(TX_LPF_C, 0);
  }
  else if (freq >= 7000000L){  
    digitalWrite(TX_LPF_A, 1);
    digitalWrite(TX_LPF_B, 1);
    digitalWrite(TX_LPF_C, 0);    
  }
  else {
    digitalWrite(TX_LPF_A, 1);
    digitalWrite(TX_LPF_B, 1);
    digitalWrite(TX_LPF_C, 1);    
  }
}

To this.

/**
 * this version version uses two diodes to get rid of needing TX-A
 * and takes advantage of TX_LPF_C having an meaningless state
 * unless KT2 is active (TX_LPF_B=1). 
 *  tx-b   tx-c  band
 *  0       0    10m
 *  0       1    20M   we enable TX-A, and get 20m, KT2 is not active.
 *  1       0    40m   make KT2 active and KT3 selects 40 or 80m. 
 *  1       1    80m
*/  
void setTXFilters(unsigned long freq){
  
  if (freq >= 20000000L){ 
    digitalWrite(TX_LPF_B, 0);  // 10m
    digitalWrite(TX_LPF_C, 0);
  }
  else if (freq >= 14000000L){ 
    digitalWrite(TX_LPF_B, 0);  // 20M
    digitalWrite(TX_LPF_C, 1);
  }
  else if (freq >= 7000000L){  
    digitalWrite(TX_LPF_B, 1);  // 40m
    digitalWrite(TX_LPF_C, 0);    
  }
  else {
    digitalWrite(TX_LPF_B, 1);  // 80m
    digitalWrite(TX_LPF_C, 1);    
  }
}

Allison

Nick VK4PP
 

Lovely solution!

Also don't forget about D0 and D1.

73 Nick Vk4PLN

Don, ND6T
 

Bravo! An elegant solution!
I've been eying those feeds to the 1602 display. When the display is not being programmed (which is most of the time) they could be available for some things. -Don

ajparent1/KB1GMX
 

FYI the diodes used were 1n4148/914.

Ruse the data bus for the display, you can do that.  Its better to keep them as
digital outputs but I've done that to get three outputs so that I can scan
multiple encoders with buttons and one input per encoder/button. 

The code for that is common-bus-encoders-master.  It works very well.
Not using it for bitx but handy for another project.

/*
CommonBusEncoders.cpp
Created by : Jacques Bellavance, March 26, 2017
Released into the public domain.
 
This library is designed to use multiple encoders with the least amount of digital pins.
The first encoder requires 4 pins. the remaining ones require only one extra pin per encoder.
For use with quadratic encoders with 2 or 4 steps per detent,
and need to be actuated by hand. This Library does not use interrupts.
See the Tutorial for more information
*/