Another ARDUINO based sequencer

Project presentation

Being very active in EME I was looking for a reliable sequencer, as I had fried my preamp, probably due to WSJT sometimes 'hicking' and T/R relays not behaving well, despite a 100 ms delay before audio being generated (thus RF present) in WSJT programmed and this had worked well for hundreds of QSO's. I use it now for some months with my IC-9700 and it is working perfectly. Because it offers some additional features not found into other commercial or homebrew solutions, I feel free to publish this project.

Specific functional requirements

The sequencer hereby presented offers following features :

Some comments

Board used is ARDUINO NANO on which USB-serial interface is by CH-340.

RTS signal line was chosen because DTR is reserved for RESET of the Arduino board (e.g. when uploading new sketch). The RTS line must be strapped directly from CH-340 to Arduino input (D9), on underside of PCB. See CH-340 datasheet  here, on ARDUINO NANO packaging is normally SOP-16.

ALC is used to inhibit RF being generated by the transceiver in transmit mode. The 'ALC release' is the last sequence going into transmit, protecting the chain as well when the sequence is initiated by the 'TRANSMIT' button on front panel of rig, when working in CW for example.

The ALC negative voltage (about -5V) is created by a 'charge pump' and 10kHz oscillator output. For Kenwood, -7V might be needed to fully close the ALC - in this case, a charge pump with voltage doubler could be considered. On some YAESU rigs, a RF-inhibit input is present - in this case, to inhibit RF out, +12v must be applied. The circuit for negative voltage generation can be easily adapted as a voltage doubler (or tripler, with limiter by Zener diode) to provide the required positive voltage level.

Anyhow, the drive level to transceiver (audio level, adjustable in WSJT) can best be set to such level that full power  (at the PA output) is obtained, but not beyond. This ensures a smooth ramp up of RF power when going into TX, controlled by the ALC..

The output switching polarities can be preset with the DIP switches (or wired permanently) without having anything to change in the sketch.  Switches are read when the board is powered up. By default, for the 3 open collector outputs going to GND when going into TX and the ALC holdoff being active, all 4 lines usually go to  LOW level (grounded).  With 2N1613 as output transistor up to 50V 0,5A can be switched, with a BC141 up to 60V 1A. As alternative, optocouplers could be considered, if galvanic isolation is required - e.g. for 4N33 / 4N32, up to 30V and 150mA can be switched.

The 2 tell-tale inputs can be used for reading contact closure to ground of relays (e.g. antenna change over and/or PA 'ready' status) - if not used, must be grounded on the Arduino board or a 'dummy' cinch shorting plug inserted in the socket. A contact closure to ground was chosen because this is the result of a closed loop circuit, so integrity of wiring is as well checked. These inputs are read in the RX -> TX sequence. Should it be desired that status be  read as well during the entire TX period, then it is necessary to define interrupts related to their status.

All hardware sequence delays in RX --> TX and TX--> RX can be individually declared into the sketch, by default set to 50ms and 200ms for ALC release. In combination with a TX tail of 100ms and re-keying delay of 2sec, this has no impact on own EME echoes measurements.

The ARDUINO NANO board was readily available on hand and therefore selected for this project. But sure an ESP32 could be used as well, and some operational parameters - like switching logic and delays - made programmable on the fly by a web interface ....

Error conditions

Three possible error conditions will be shown by flashing LED's :

.

Asembly of unit & schematic diagram

As the complete device is really simple, no PCB was developed but chosen for a clean 'dead bug' assembly. If any OM would like to design a PCB, please let me know.  The schematic diagarm was quickly had-written, click on picture below to download it as PDF in full format.

 

Arduino sketch

The original sketch was modified while not looking into crunching program code lines, as there is plenty room available in the Arduino.... 

Below is the sketch  or download it here.   It was compiled with IDE version 1.8.19 - IMPORTANT : Should you get errors when compiling, use the same version of IDE !  You still can download previous versions from ARDUINO website .  

IMPORTANT: Please note that the software & device concept is presented 'as is' with no guarantees whatsoever and can be used free of license cost by individual  HAMs, but not  used for any commercial purpose, as the intellectual property remains entirely by the author. 


//////////////////////////////////////////
///// SEQUENCER with ALC holdoff /////////
//////////////////////////////////////////

// ARDUINO NANO board

// PTT on COM port by RTS (not DTR = reset function)
// by ON7EQ - 10/2026

///// DELAY & TIMING DEFINITIONS ///////////////////////////////////////////////

// Going into TRANSMIT
const int LnaOffDelay       = 50;    // LNA power off
const int AntTXdelay        = 50;    // Antenna relay to TX
const int PaTXdelay         = 50;    // PA into TX
const int ALC_unblock_delay = 200;   // Delay before releasing ALC negative voltage

// Going into RECEIVE
const int PaRXdelay  = 50;           // PA into RX
const int AntRXdelay = 50;           // Antenna relay to RX
const int LnaOnDelay = 50;           // LNA power on

const unsigned long CooldownDelay = 2000;   // min. time after TX before a new TX
const unsigned long TX_tail       = 100;    // min. time in TX after the TX sequence finished
const unsigned long ButtonLockout = 500;    // push-button re-trigger lockout
const unsigned long PanicLockout  = 5000;   // push-button TX locked this long after panic

///// LNA & ANT RELAY POLARITY (level on the pin when in RX) ///////////////////

bool LNA_RX     = 0;     //  0 = open collector OPEN in RX, to ground in TX = LNA + ANT RLY, reversed by POL SWITCH BOX
bool ANT_RLY_TX = 1;     //  1 = open collector to ground in TX, OPEN in RX = for mouse jiggler
bool PA_TX = 1;          //  1 = open collector to ground in TX, OPEN in RX = for PA
bool ALC_enabled = 1;    //  1 = ALC holdoff enabled

///// PINS /////////////////////////////////////////////////////////////////////

const int pttInputPin    = 2;    // Foot-switch / external PTT (active LOW, pull-up)
const int PushButtonPin  = 3;    // Momentary push button (active LOW)
const int lnaPin         = 4;    // LNA power relay
const int antennaPin     = 5;    // Antenna changeover relay
const int paPin          = 6;    // PA relay
const int radioPttPinOut = 7;    // PTT to transceiver
const int radioPttPinIn  = 8;    // PTT from transceiver (detects TX started by the radio)
const int RS232_rts_pin  = 9;    // CH340 RTS strapped to D9 (active LOW)
const int TONE_ALC_pin   = 10;   // Square wave to the negative charge pump
const int LED_ALC_pin    = 11;   // LED: ALC holdoff active
const int RX_LED_pin     = 12;   // LED: RX status
const int TX_LED_pin     = 13;   // LED: TX requested

const int setup_LNA_pin  = A0;   // Setup of LNA switch polarity
const int setup_ANT_pin  = A1;   // Setup of ANT switch polarity
const int setup_PA_pin   = A2;   // Setup of PA switch polarity
const int setup_ALC_pin  = A3;   // Setup of ALC holdoff enable
const int tell_tale_pin1 = A4;   // Setup of tell-tale input pin - must be grounded to allow TX'ing
const int tell_tale_pin2 = A5;   // Setup of tell-tale input pin - must be grounded to allow TX'ing

const unsigned int TONE_FREQ_HZ = 10000;   // 10 kHz for charge pump efficiency

///// STATE ////////////////////////////////////////////////////////////////////

bool isTransmitting       = false;
bool goIntoReceive        = false;
bool PushButtonPttActive  = false;
bool inCooldown           = false;
bool panic                = false;   // forced return to RX, waiting for operator reset
bool wasinpanic           = false;

unsigned long ButtonPressTime = 0;
unsigned long panicEndTime    = 0;
unsigned long txEndTime       = 0;   // when the last TX->RX sequence ended
unsigned long txStartTime     = 0;   // when the last RX->TX sequence ended

///// HELPERS //////////////////////////////////////////////////////////////////

bool isLow(int pin) { return digitalRead(pin) == LOW; }

// Foot switch or WSJT-X RTS
bool extKeyActive() { return isLow(pttInputPin) || isLow(RS232_rts_pin); }

// Any key source at all (incl. the radio's own PTT)
bool anyKeyActive() { return extKeyActive() || isLow(radioPttPinIn); }

// Set the level first, then make it an output (no glitch at power-up)
void safeOutput(int pin, bool level) {
  digitalWrite(pin, level);
  pinMode(pin, OUTPUT);
}

// ALC holdoff: tone + LED on = negative voltage generated, ALC blocked
void alcHoldoff(bool on) {
  if (on) tone(TONE_ALC_pin, TONE_FREQ_HZ);
  else    noTone(TONE_ALC_pin);
  digitalWrite(LED_ALC_pin, on);
}

///// SETUP ////////////////////////////////////////////////////////////////////

void setup() {

  // Inputs first, so they never float
  pinMode(pttInputPin,   INPUT_PULLUP);
  pinMode(radioPttPinIn, INPUT_PULLUP);
  pinMode(PushButtonPin, INPUT_PULLUP);
  pinMode(RS232_rts_pin, INPUT_PULLUP);

  pinMode(setup_LNA_pin, INPUT_PULLUP);
  pinMode(setup_ANT_pin, INPUT_PULLUP);
  pinMode(setup_PA_pin,  INPUT_PULLUP);
  pinMode(setup_ALC_pin, INPUT_PULLUP);

  pinMode(tell_tale_pin1, INPUT_PULLUP);
  pinMode(tell_tale_pin2, INPUT_PULLUP);
  
  ///// Set switching polarities according to DIP SW position

   if (digitalRead(setup_LNA_pin) == HIGH) LNA_RX = 1;            // in RX open collector is grounded (default : open)
   if (digitalRead(setup_ANT_pin)== HIGH)  ANT_RLY_TX = 0;        // in TX open collector is open     (default : grounded)   
   if (digitalRead(setup_PA_pin) == HIGH) PA_TX = 0;              // in TX open collector is open     (default : grounded)     
   if (digitalRead(setup_ALC_pin) == HIGH) ALC_enabled = 0;       // ALC holdoff disabled       

  // Outputs, all starting in a safe state

  if (ALC_enabled == 1) {
    tone(TONE_ALC_pin, TONE_FREQ_HZ);       // negative voltage ready before the radio can key
    safeOutput(LED_ALC_pin, HIGH); 
        }
  safeOutput(lnaPin, !LNA_RX);            // LNA off, in TX state
  safeOutput(paPin, !PA_TX);              // PA disabled
  safeOutput(radioPttPinOut, LOW);        // radio unkeyed
  safeOutput(TX_LED_pin, LOW);
  safeOutput(RX_LED_pin, LOW);            // RX status unknown
  delay(200);
  safeOutput(antennaPin, ANT_RLY_TX);    // antenna to TX position (fail-safe)

  Serial.begin(115200);
  delay(300);


 //  Startup message on serial port

  Serial.println(" ");
  Serial.println("********************************");   
  Serial.println("* Smart EME Sequencer by ON7EQ *");
  Serial.println("********************************");   
  Serial.println(" ");
  Serial.println("Version 1.00 dated 23 oct 2026");
  Serial.println(" ");
  Serial.println("Arduino NANO board");
  Serial.println("External KEY on this serial port for WSJT is by RTS only");
  Serial.println(" ");      
  Serial.println("Open collector outputs as now defined by DIP switches:");

  Serial.print("  * LNA powered:   ");
  if (LNA_RX == 1)  Serial.print("to GROUND");
      else  Serial.print("OPEN");
  Serial.println(" while receiving");  

  Serial.print("  * ANT Relay :    ");
  if (ANT_RLY_TX == 1)  Serial.print("to GROUND");
      else  Serial.print("OPEN");
  Serial.println(" while transmitting");  

  Serial.print("  * PA key :       ");
  if (PA_TX == 1)  Serial.print("to GROUND");
      else  Serial.print("OPEN");
  Serial.println(" while transmiiting");  

  Serial.print("  * AGC Holdoff :  ");
  if (ALC_enabled == 1)  Serial.println("Enabled");
      else  Serial.println("Disabled");
  Serial.println(" ");  
   
  Serial.println("Sequencer delays going into TX (ms)");
  Serial.println(" "); 
  Serial.print("  * LNA :       "); 
  Serial.println(LnaOffDelay);
  Serial.print("  * ANT Relay : "); 
  Serial.println(AntTXdelay);
  Serial.print("  * PA Key :    "); 
  Serial.println(PaTXdelay);
  Serial.print("  * AGC off:    "); 
  Serial.println(ALC_unblock_delay);

  Serial.println(" ");  
   
  Serial.println("Sequencer delays going into RX (ms)");
  Serial.println(" "); 
  Serial.print("  * PA unkey :  "); 
  Serial.println(PaRXdelay);
  Serial.print("  * ANT Relay : "); 
  Serial.println(AntRXdelay);
  Serial.print("  * LNA :       "); 
  Serial.println(LnaOnDelay);
  Serial.println(" ");    

  // Wait (blinking) until nobody is keying
  while (anyKeyActive()) {
    digitalWrite(TX_LED_pin, HIGH); delay(50);
    digitalWrite(TX_LED_pin, LOW);  delay(50);
  }

  // Not keyed: go to RX
  delay(200);
  digitalWrite(antennaPin, !ANT_RLY_TX);
  delay(LnaOnDelay);
  digitalWrite(lnaPin, LNA_RX);
  digitalWrite(RX_LED_pin, HIGH);

  Serial.println("Now ready to go !"); 
  Serial.println(" ");     
  
}

///// SEQUENCES ////////////////////////////////////////////////////////////////

///// RX -> TX.  keyRadio = false when the radio itself already keyed./////////

void goTX(bool keyRadio) {
  Serial.println("--------------------------------");  
  Serial.println("Going into TX");  
  Serial.println(" ");
          
  digitalWrite(RX_LED_pin, LOW);
  digitalWrite(TX_LED_pin, HIGH);
  digitalWrite(lnaPin, !LNA_RX);              // 1. LNA off
    Serial.println("  * LNA power Off");  
  delay(LnaOffDelay);
  digitalWrite(antennaPin, ANT_RLY_TX);      // 2. antenna to TX
    Serial.println("  * ANT Relay to TX position");    
  delay(AntTXdelay);
  digitalWrite(paPin, PA_TX);                  // 3. PA on
    Serial.println("  * PA is keyed");     
  delay(PaTXdelay);
  while ((digitalRead(tell_tale_pin1) == HIGH)) {
    digitalWrite(TX_LED_pin, !digitalRead(TX_LED_pin));       // Tell-tale contact error
    digitalWrite(RX_LED_pin, !digitalRead(TX_LED_pin));      
    delay (100);
       }
  while ((digitalRead(tell_tale_pin2) == HIGH)) {
    digitalWrite(TX_LED_pin, !digitalRead(TX_LED_pin));       // Tell-tale contact error
    digitalWrite(RX_LED_pin, !digitalRead(TX_LED_pin)); 
    delay (100);
       }
  digitalWrite(TX_LED_pin, HIGH);                             // Reset flashing now problem solved
  digitalWrite(RX_LED_pin, LOW);       
  if (keyRadio) {
        digitalWrite(radioPttPinOut, HIGH);   // 4. key the radio
    Serial.println("  * Radio is keyed");           
      }
  
  delay(ALC_unblock_delay);
  alcHoldoff(false);                          // 5. release ALC
  if (ALC_enabled == 1) {
    Serial.println("  * ALC is released");      
      }


  isTransmitting = true;
  txStartTime = millis();                     // start of TX tail window
}

////// TX -> RX  /////////////////////////////////////////////////////////////

void goRX() {
  Serial.println("--------------------------------");   
  Serial.println("Going into RX");  
  Serial.println(" ");
 
  digitalWrite(TX_LED_pin, LOW);
  if (ALC_enabled == 1) {
    alcHoldoff(true);     // block ALC first
    Serial.println("  * ALC is blocking RF output");        
      }
  digitalWrite(radioPttPinOut, LOW);          // 1. unkey radio
    Serial.println("  * Radio is unkeyed");   
  delay(PaRXdelay);
  digitalWrite(paPin, !PA_TX);                   // 2. PA off
    Serial.println("  * PA is unkeyed");     
  delay(AntRXdelay);
  digitalWrite(antennaPin, !ANT_RLY_TX);      // 3. antenna to RX
    Serial.println("  * ANT Relay to TX position");  
  delay(LnaOnDelay);
  digitalWrite(lnaPin, LNA_RX);               // 4. LNA on
    Serial.println("  * LNA power On");   
  digitalWrite(RX_LED_pin, HIGH);

  isTransmitting      = false;
  goIntoReceive       = false;
  PushButtonPttActive = false;
  txEndTime = millis();                       // start of cooldown window
}

// Blink until the operator holds the button with all key inputs released

void panicWait() {
  while (panic) {
    digitalWrite(RX_LED_pin, LOW);  digitalWrite(TX_LED_pin, HIGH);  delay(50);
    digitalWrite(TX_LED_pin, LOW);  digitalWrite(LED_ALC_pin, HIGH); delay(50);
    digitalWrite(LED_ALC_pin, LOW); digitalWrite(RX_LED_pin, HIGH);  delay(50);

    if (millis() - txEndTime > 1000 && isLow(PushButtonPin) && !anyKeyActive()) {
      panic = false;
      delay(200);
      panicEndTime = millis();
    }
  }
}

///// MAIN LOOP ////////////////////////////////////////////////////////////////

void loop() {

  if (millis() - panicEndTime > PanicLockout) wasinpanic = false;
 
  // 1. Push button: toggles TX; in TX it forces RX (panic if another key source is still active)
  if (isLow(PushButtonPin) && millis() - ButtonPressTime > ButtonLockout && !inCooldown) {
    delay(20);                                    // debounce
    if (isLow(PushButtonPin)) {
      ButtonPressTime = millis();
      if (!isTransmitting && !wasinpanic) {
        PushButtonPttActive = true;
      } else {
        goIntoReceive = true;
        if (extKeyActive()) panic = wasinpanic = true;
      }
    }
  }

  // 2. Radio-initiated PTT (ignore our own keying of the radio)
  bool trxPttActive = isLow(radioPttPinIn) && isLow(radioPttPinOut);

  // 3. Final TX request (OR of all sources)
  bool txRequested = extKeyActive() || trxPttActive || PushButtonPttActive;

  inCooldown = millis() - txEndTime < CooldownDelay;
  bool inTxTail = millis() - txStartTime < TX_tail;

  // 4. Sequencer
  if (txRequested && !isTransmitting && !inCooldown && !goIntoReceive) {
    goTX(!trxPttActive);
  }
  else if ((!txRequested && isTransmitting && !inTxTail) || goIntoReceive) {
    goRX();
    
      Serial.println("------------------------------------------");  
      Serial.println("*** PANIC - attempting to revert to RX ***");  
      Serial.println("------------------------------------------"); 
    
    panicWait();
  }
}