Friday, 5 January 2018

Caprice PA finished, then failed!

I have been slow, I know, in getting the QRP PA finished. This is a 3W PA for 40, 30 & 20m with control using a Arduino Nano. It started out like this

IMG 1694

Then I got stuck on two fronts. One cutting the holes in the case I had planned, and second writing the software that allows an exciter (VFO or QRP transceiver) to tell the PA to switch TX/RX and which band LPF to chose.

I solved the box problem by inducing my son who owns a small engineering company to mill out the holes and rectangles out of the front and back panels of the box.

Then I stuck my head down and had a long think about controlling the PA. What I settled with is to have a 4-way 3.5mm jack lead connect the VFO to the PA. This was dictated because one of the apps that runs on my VFO (AD9851 + Arduino Uno with OLED display, is a GPS location or Maidenhead locator detector, and the GPS plugs into a 4-way jack). The jack connections are Ground, Arduino pin A1, A0 and +5V. The A1 & A0 connections carry the GPS RX & TX signals. But for the PA they provide four controls (in binary HIGH/LOW on the two pins). These switch the PA into RX or TX on 40, 30 or 20m.

This is what the PA now looks like inside and out.

IMG 1711

The integrated Amp is top left, the LPF at the bottom and the Nano and TX/RX switching relay is at top right.

IMG 1717

Here the top box is the VFO - which can be programmed to transmit CW, QRSS, JT65, WSPR etc, the middle box is a power meter (0.1uW to 10W range) and the bottom on is the PA. The display on the PA shows either TX, or LPF the band selected.

Here's the code used in the PA which illustrates the decode and use of the A0, A1 signals

// PA_V2 Caprice system
// V1.1 17-12-30 changed input pins to A0, A1
/* Jack Body GND
        Ring  A1 control bits
        Ring  A0
        Tip   5V
*/

// HEADERS & LIBRARIES
// oled init & functions
#include "Oled.h"

// CONNECTIONS
// relay outputs (active HIGH)
#define PTT 5
#define B6 6
#define B7 7

// PARAMETERS
// modes
#define RX 0
#define TX40 1
#define TX30 2
#define TX20 3

// GLOBAL VARIABLES
char disp[][4] = {"", "40m", "30m", "20m"};    // display
byte mode, band;                               // mode 0-3, band 1-3

// SETUP
void setup() {

  pinMode(A0, INPUT_PULLUP);     // bus LSB
  pinMode(A1, INPUT_PULLUP);     // bus MSB
  pinMode(PTT, OUTPUT);   // T/R relay
  pinMode(B6, OUTPUT);    // Band LPF relays
  pinMode(B7, OUTPUT);

  oled.begin();           // init oled display

  // init 40m RX
  swPA(TX40);            // mode 40m, set LPF
  swPA(RX);              // back to mode RX
}

// LOOP
void loop() {
  // read mode input
  mode = getMode(digitalRead(A1), digitalRead(A0)); // read 0000 00xx

  // switch PA
  swPA(mode);

  dispUpdate();
}

// GET MODE
// A1 & A0 gets mode, returns 0-3 (RX-TX20)
byte getMode(bool b1, bool b0) {
  if (b1 == HIGH && b0 == HIGH) return RX;     // 0 RX
  if (b1 == HIGH && b0 == LOW)  return TX40;   // 1 TX 40m
  if (b1 == LOW && b0 == HIGH)  return TX30;   // 2 TX 30m
  if (b1 == LOW && b0 == LOW)   return TX20;   // 3 TX 20m
}


// SWITCH PA
// set PTT & LPF relays (HIGH = on), set band
void swPA(byte m) {
  // first check RX or TX
  if (m == RX)
    digitalWrite(PTT, LOW);              // RX
  else {
    digitalWrite(PTT, HIGH);             // TX

    // chose LPF freq
    switch (m) {
      case TX40:
        digitalWrite(B6, LOW);           // 40m
        digitalWrite(B7, LOW);
        break;
      case TX30:
        digitalWrite(B6, HIGH);          // 30m
        digitalWrite(B7, LOW);
        break;
      case TX20:
        digitalWrite(B6, HIGH);          // 20m
        digitalWrite(B7, HIGH);
        break;
    }
    band = m;                            // set band 1-3 for display
  }
  delay(200);
}

//  PICTURE LOOP
// Display band or "TX"
void dispUpdate() {
  oled.firstPage();
  do {
    dispMsg(60, 0, "PA");
    if (mode == RX) {                 // if RX
      dispMsgUL(30, 15, disp[band]); // display band
      dispMsgL(50, 50, "RX");
    }
    else {
      dispMsgUL(45, 15, "TX");       // otherwise show "TX"
      dispMsgL(50, 50, disp[band]);
    }
  } while (oled.nextPage());
}

FAIL

So there I was, a new QRP PA. But... first the best output I could get was 1.5W on any band. And then after a couple of changes to the band and T/R it failed altogether and the best output was 10mW, almost the same as the input from the VFO. Fail. And so far I have no idea why. The choice now is to order another Chinese RF Amp module or to build my owm small amplifier... not decided yet.

No comments: