12 November 2013

Transverter sequencer with Arduino

Even if not explicitly mentioned, I decided my 70 MHz transverter needs a switching sequencer. Any existing solution I could find online uses either discrete components and ICs or a microcontroller I cannot handle (PICxx series).

Given the widespread availability of Arduino derivatives, their low cost (< 10 USD) and their extreme flexibility, I preferred to go down this route. Besides, an Arduino board allows for easy firmware changes (just plug it to an USB port of a computer!) and can be programmed for CAT communication with the FT-817 and alike (FT-857, FT-897, FT-100).

The sequencer code uses a level change interrupt (on INT0) to monitor the PTT line output on the CAT port ("TX GND"). This line goes to logical low level when the PTT is pressed

Once a transition RX-to-TX is debounced and detected, the main loop switches in sequence the IF input attenuator (not needed in RX), the transverter PTT and enables RF output on the radio (pulling down the "TX INH" line). Small delays allow for each change to be applied by the involved circuitry, being the relay the slowest to react. The TX-to-RX transition reverses the sequence described above.

At startup the sequencer inhibits RF output and configures itself in RX mode.

This is not rocket science at all.

If another output is needed it is just a matter of adding few lines of code. An extension to the code should allow to switch the RTX to the IF center frequency (29.200 MHz USB in my case) as well as make sure the FT-817 RF power is the lowest possible. Then drive a status LED, monitor the transverter PA temperature, ...





 

// RTX transverter simple sequencer for Arduino-like boards
// by Paolo IK1ZYW. Version 2013-11-12.
//
// You will not find much of rocket science in here.
// Handle with care.
// Code is published for reference purposes, not for commercial
// or hobbystic use. Use solely at your own risk.


int txgnd=2; // AKA INT0 on pin Digital 2
int txinh=12; // on pin Digital 12
int relay1=10; // on pin Digital 10
int xvptt=9; // on pin Digital 9
int oldstate=LOW; // an helper variable

volatile int state = LOW; // LOW == RX, HIGH == TX

void setup()
{
  pinMode(txinh, OUTPUT);
  pinMode(relay1, OUTPUT);
  pinMode(xvptt, OUTPUT);  
  pinMode(txgnd, INPUT_PULLUP);
 
  digitalWrite(txinh, HIGH);
  digitalWrite(relay1, LOW);
  digitalWrite(xvptt, HIGH);
 
  attachInterrupt(0, pttChange, CHANGE);
}




 

// MAIN CODE
void loop() {

  if (oldstate != state) { // something has changed
 
    oldstate = state;
 
    if (state == LOW) { // let's prepare for transmitting
      digitalWrite(relay1, HIGH);
      delay(50); // 50 ms to let the relay switch
      digitalWrite(xvptt, LOW);
      delay(10); // 10 ms
      digitalWrite(txinh, LOW);
      // CAREFUL, we're ON THE AIR !!
    }
  
    if (state == HIGH) { // let's return to relax
      digitalWrite(txinh, HIGH);
      delay(10); // 10 ms
      digitalWrite(xvptt, HIGH);
      digitalWrite(relay1, LOW);
      // sit back, we're listening
    }
  }
}

 // PTT ISR
void pttChange()
{
  int newstate = digitalRead(txgnd);
 
  if (newstate == LOW) {
    delay(10); // debounce
    newstate = digitalRead(txgnd);
    if (newstate == LOW) {
      state = LOW;
    }
  }

  if (newstate == HIGH) {
    delay(10); // debounce
    newstate = digitalRead(txgnd);
    if (newstate == HIGH) {
      state = HIGH;
    }
  }

}