Friday 29 December 2017

Final PA RXTX and LPF band control - the Caprice system

The Caprice system

I previously gave a set of sketch code for the VFO or QRP to control the PA, to switch it from RX to TX and set the LPF to a band, 40, 30. 20m. The control signals are carried on two wires of a 4-way jack. The two control bits were connected to Arduino pins 12 & 13. But these pins, I realise are used in the QRP for TX & RX switching and so cannot be used for PA control. So I have changed to A0 & A1 pins.

This has meant a change also to the GPS sketches so the TX and RX serial data is read from these pins.

So the new code is as described below:

Caprice System

The Caprice system uses a 4 wire bus to supply power and signals. These are carried on a 4-way 3.5mm jack. The signals connect to Arduino A0 & A1.

Jack	Power/Signal	Socket Wire
Body		GND		Brown (B)
Ring		PIN A1	Yellow (Y)
Ring  	PIN A0	Orange (O)
Tip		5V OUT	Red (R)

OLED	Power/Signal	Wire
GND				Black (K)
VDD				Brown (B)
SCK				Red (R)
SDA				Orange (O)

PA Connections (top)
OLED
________________
o o o o o o o o |
O R B K
SDA VDD
  SCK GND

Jack
o o o o o o o o |
Y O R B     - -
A1  5V      12V
  A0  GND     GND

Outputs from GPS
A GPS uses the following connections:

GND
A0 - RX from GPS
A1 - TX to GPS
5V

Output from sketches
In the Caprice system sketches use the following connections:

GND
A0 - LSB of command (was 12)
A1 - MSB of command (was 13)
5V out

The output signals encode the signals to set the PA into one of 4 modes (0, 1, 2 & 3):

// modes, 00, 01, 10, 11 on A1, A0
#define RX 0
#define TX40 1
#define TX30 2
#define TX20 3

// SETUP
// include in setup...
  // jack PA control outputs
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);

  // init band, RX
  setPA(TX40);                    // mode 40m, set PA LPF
  setPA(RX);                      // back to mode RX

This function outputs the modes to the PA.

// SET PA MODE
// modes 0, 1, 2, 3 output on A1, A0, active LOW
void setPA(int m) {
  // set mode
  switch (m) {
    case 0:
      digitalWrite(A1, HIGH);
      digitalWrite(A0, HIGH);    // RX
      break;
    case 1:
      digitalWrite(A1, HIGH);
      digitalWrite(A0, LOW);    // TX40
      break;
    case 2:
      digitalWrite(A1, LOW);
      digitalWrite(A0, HIGH);   // TX30
      break;
    case 3:
      digitalWrite(A1, LOW);
      digitalWrite(A0, LOW);    // TX20
      break;
  }
}

Relay wiring

		o------- 40m
in/Out---o/             /B6
		o-----|
	|----------|
	|	o------- 30m
	|---o/             /B7
		o------- 20m

PA Input
The PA inputs the signals and decodes them to modes (0, 1, 2 or 3):

// 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 includes

  pinMode(A0, INPUT_PULLUP);     // bus LSB
  pinMode(A1, INPUT_PULLUP);     // bus MSB
  pinMode(PTT, OUTPUT);   // T/R relay
  pinMode(B6, OUTPUT);    // BAND 6
  pinMode(B7, OUTPUT);    // BAND 7

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


The mode input is read from A1 & A0

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

/ 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
}

The mode is used to switch the TX/TX PTT relay (Antenna to PA or RX) and the LPF relays.

// 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
  }
}

The PA display shows UL Band when in RX mode, and "TX" when transmitting.

//  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());
}

Friday 8 December 2017

ICOM718 Digital INterface

PTT circuit

Here is the working ICOM "SEND" or PTT circuit. The PC or Mac is connected to the interface using a serial USB <-> RS232/TTL interface cable - costing just a few pounds on Amazon... The signals output from the adaptor that I bought are 3.3V logic, and there is a 5V power supply. I use the negative logic (active LOW) RTS signal to drive the gate of the BS170 MOSFET, when HIGH the 3.3V turns it on and a LOW level turns it off. The output of the BS170 stage is used to drive the diode input on the 1N35 optocoupler, thus giving an active LOW output to the ICOM SEND (PTT) line.

RTS PTT

The Audio circuits have yet to be tested and will be published here later. The box that has been made is shown below, Front and back.

IMG 1639

IMG 1640

The front has a switch which will be used to disable the computer PTT/RTS signal to prevent it being accidentally activated during system set-up, along with volume controls for the IN and OUT audio channels. The back has a cable with USB plug (containing the USB <-> RS232/TTL adaptor), the DIN connector to the ICOM718 (using a custom made cable to the rear ICOM 13 pin Input/Output, a Jack for CV-I control signals and two audio jacks for connections to the soundcard of the PC or Mac (I use a small plug-in USB sound interface).