Hot Wiring a LDG DTS-6 Coax Switch

So many antennas but not enough connectors on the rear of the transceiver? Ah yes, the old struggle. There are many coax switches on the market, most of them manual or substantially expense electronic ones.

One of my old friends, Terry (W0VB), passed down a LDG Electronics DTS-6 to me a few years ago and it has just been sitting on my shelf collecting dust. I am working towards getting my shack 100% remote capable, and most of my other projects I will be posting reflect that. The goal of this project was to establish a web based control system for switching between my 6 Meter Yagi and the G5RV Jr. wire dipole.

The DTS-6 is a 6 output port coax switch, with a sole input. It has a power limit of 1,500 Watts on HF and 1,000 on 6 Meters. It is powered by 12VDC, and has 1/8″ stereo jack for serial (TTL) logic control. The full manual can be found here.

The logic control is where I got hung up. I have never really played around with serial control that much. After a few hours of pounding my head against the desk, with numerous unsuccessful tries of getting the TTL to work, I gave up and did what any self respecting modern tinkering person would do- I dug out an Arduino and some 3.3V relay boards and got to work.

After doing a little probing with the multi-meter I was able to establish which pins on the push buttons had to be connected to ground to trigger the switches.

I only had to run one ground line from the first button, and then ran wire from 1st pin on the 4 buttons (at this time I have no need to wire the whole box for remote control).

I knew I wanted some type of positive feedback as to the selected line. So, I soldered onto the lead of LED indicators for the buttons and ran the lines out of the back of the box. There was enough room to sneak all of them out around the stereo plug hole.

I then got started prototyping the hardware and started tinkering with the code for the Arduino. I use the ESP8266 for most of my projects. Below is the source code I came up with, with some online references and help from my good friend Jesse Angell (KC0UCQ).

#include <ESP8266WiFi.h>


const char* ssid     = "xxx";
const char* password = "xxx";

WiFiServer server(80);

String header;

const int output5 = 5;
const int output4 = 4;


unsigned long currentTime = millis();

unsigned long previousTime = 0;

const long timeoutTime = 2000;

void setup() {
  Serial.begin(115200);
  pinMode(output5, OUTPUT);
  pinMode(output4, OUTPUT);
  pinMode(2, INPUT_PULLUP);
  pinMode(0, INPUT_PULLUP);
  

  digitalWrite(output5, LOW);
  digitalWrite(output4, LOW);

  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  // Print local IP address and start web server
  Serial.println("");
  Serial.println("WiFi connected.");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  server.begin();
}

void loop(){
  WiFiClient client = server.available();   // Listen for incoming clients

  if (client) {                             // If a new client connects,
    Serial.println("New Client.");          // print a message out in the serial port
    String currentLine = "";                // make a String to hold incoming data from the client
    currentTime = millis();
    previousTime = currentTime;
    while (client.connected() && currentTime - previousTime <= timeoutTime) { // loop while the client's connected
      currentTime = millis();        
      if (client.available()) {             // if there's bytes to read from the client,
        char c = client.read();             // read a byte, then
        Serial.write(c);                    // print it out the serial monitor
        header += c;
        if (c == '\n') {                    // if the byte is a newline character
          // if the current line is blank, you got two newline characters in a row.
          // that's the end of the client HTTP request, so send a response:
          if (currentLine.length() == 0) {
            // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
            // and a content-type so the client knows what's coming, then a blank line:
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println("Connection: close");
            client.println();
           
            // turns the GPIOs on and off
            if (header.indexOf("GET /5/on") >= 0) {
              Serial.println("GPIO 4 off");
              digitalWrite(output4, LOW);
              Serial.println("GPIO 5 on");
              digitalWrite(output5, HIGH);
              delay(2000);
              Serial.println("GPIO 5 off");
              digitalWrite(output5, LOW);
            } else if (header.indexOf("GET /5/off") >= 0) {
              Serial.println("GPIO 5 off");
              digitalWrite(output5, LOW);
            } else if (header.indexOf("GET /4/on") >= 0) {
              Serial.println("GPIO 5 off");
              digitalWrite(output5, LOW);
              Serial.println("GPIO 4 on");
              digitalWrite(output4, HIGH);
              delay(2000);
              Serial.println("GPIO 4 off");
              digitalWrite(output4, LOW);
            } else if (header.indexOf("GET /4/off") >= 0) {
              Serial.println("GPIO 4 off");
              digitalWrite(output4, LOW);
            }
           
            client.println("<!DOCTYPE html><html>");
            client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
            client.println("<link rel=\"icon\" href=\"data:,\">");

            client.println("<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}");
            client.println(".button { background-color: #195B6A; border: none; color: white; padding: 16px 40px;");
            client.println("text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}");
            client.println(".button2 {background-color: #77878A;}</style></head>");
           
          
            client.println("<body><h1>KC0UDO HF ANTENNA SELECTOR</h1>");
            client.println("<BR><a href=\"http://192.168.86.134/index.php\">Back to Dashboard</a>");
           
             
            client.println("<p>6 Meter Yagi</p>");
           
            if (digitalRead(2) == LOW) {
              client.println("<p><a href=\"/5/on\"><button class=\"button\">SELECT</button></a></p>");
            } else {
              client.println("<p><a href=\"/5/off\"><button class=\"button button2\">SELECTED</button></a></p>");
            }
               
            
            client.println("<p>G5RV JR</p>");
                  
            if (digitalRead(0) == LOW) {
              client.println("<p><a href=\"/4/on\"><button class=\"button\">SELECT</button></a></p>");
            } else {
              client.println("<p><a href=\"/4/off\"><button class=\"button button2\">SELECTED</button></a></p>");
            }
            client.println("</body></html>");
           
            // The HTTP response ends with another blank line
            client.println();
            // Break out of the while loop
            break;
          } else { // if you got a newline, then clear currentLine
            currentLine = "";
          }
        } else if (c != '\r') {  // if you got anything else but a carriage return character,
          currentLine += c;      // add it to the end of the currentLine
        }
      }
    }

    header = "";

    client.stop();
    Serial.println("Client disconnected.");
    Serial.println("");
  }
}

As you can see, the source is fairly straight forward and produces a nice little control panel. If the LED pulls the GPIO low it senses that it is selected and the control panel then reflects that.

I wanted to wrap this project up so I headed out to the local hardware store and procured a PVC enclosure to place my mess of wires, relays and Arduino into.

The finished product ended up looking sharp, and works great. I have not had any RFI issues yet, which is something I was worried about initially. I have room to expand, with the wiring done for two more coax relays. All I would have to do is add the relays and LED sensor lines and adjust the code.

Discover more from WirelessBilly

Subscribe now to keep reading and get access to the full archive.

Continue reading