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.

Sunday, 31 December 2017

Away from Radio - a message for Mrs May

Madame, I accuse you. I accuse you of breaking apart our Unions. Our United Kingdom is fractured. Our European Union is fractured.

In Scotland they know this, they have created their own national government, fully capable of running their nation, as a member of the European Union.

Northern Ireland is already broken, their is no government and the people have been left to drift. They want the European Union but all they have is the DUP bought out for its votes.

In Wales they are weak, they have an Assembly which is little more than a District Council talking shop. They are adrift, not knowing which or what is the way forwards.

And as for the rest, England, we are confused, we have been lied to, we have not had any leadership or direction, so we gambled equally over Europe, and lost to the extremists of the Tory party, including, madame, yourself.

The people of England understand little of the European Union, they understand little of “Free movement of goods, services, capital and people.”. They are bent under the control of the City of London and the Murdoch press.

Your Government has failed.

I call on you to change all that. I call on you to reunite our Unions, the UK and the EU.

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).

Monday, 27 November 2017

LATEST Sketches and Libraries

Here is the latest update of my sketches and libraries.

IMPORTANT

Previous sketches have output HIGH/LOW signals on a one connection on the 4-way jack on the VFO hardware. This signal was coded from D12 to switch the first PA I made from RX (HIGH) to TX (LOW).
The new sketches output active LOW codes on two pins of the 4-way jack, with Arduino UNO connections body=GND, ring=D12, ring=D13, tip=+5V.

These connections were chosen to also support a GPS receiver connection to the box.

For the PA-2 switching D12 is used as the LSB and D13 as the MSB of a two bit binary code. This code is then used as,

HH = RX

HL = TX 40m LPF

LH = TX 30m LPF

LL = TX 20m LPF

The codes are used to switch the three LPFs in the PA-2. And also to switch the Antenna connection from RX to TX.

Sunday, 19 November 2017

Slow build QRP PA-2

I've been at this project for a while. But its slowly coming together. It is a QRP PA (2-3W output) for 40, 30 & 20m. It uses a MMIC pre-built module running on 12-15V, a set of three LPFs and an Arduino Nanocomputer to run things.

It provides TX RX switching and LPF switching from a two bit binary input on the rings of a a 4-way jack (the other connections are body GND & tip +5V. This input is compatible with my VFO output jack- this jack is used for GPS inputs when finding time and Maidenhead Locator, and as a TXRX/band command to the PA running other sketches which generate WSPR, JT65, CW, PSK, RTTY signals.

IMG 1694

PA

The display is simple, just the title "PA, the band big in the middle and TX or RX at the bottom.

Tuesday, 7 November 2017

BARGAIN SDR

I just noticed that Elektor has cut it's prices in a sale! The Elektor SDR broad band receiver can now be bought for €30!!! This will tune from 100kHz to over 50MHz using an Si5351 DDS. programmed from an Arduino.

Put this together with an Arduino UNO at around €9, a small OLED display and a rotary encoder for around another €9, and you can build a very decent SDR for less then €50!!!

Check it out.

Screen Shot 2017 11 07 at 11 47 26

I built one, which I use with a low cost 96kHz ADC and HDSDR running on either on my MacBook or a PC.

Screen Shot 2017 11 07 at 11 52 08

Screen Shot 2017 11 07 at 11 56 30

I have put the software on this blog, look for my latest download of my sketches.