Remote Controlled Antenna Switch

Posted by Fred C. (W6BSD) on Nov 06 2020

A few months ago, I installed a new 40 and 80-meter dipole. My shack and my antennae are on opposite sides of the house. My feed line goes through narrow spots inside the house and runs underground from the house to the antenna. Installing a new feed line for this new antenna was not an option that I would consider. The same was true for any remote switch using a cable from the switch box to the shack's controller.

I looked at commercial options. I was not too fond of some of the choices, and the price of the one I liked was more than I wanted to spend on a switch. I don't want to install a switch box that costs more than my rigs.

I decided to build my antenna switch

For my project, I designed a controller board around a WeMos D1 Mini, using an ESP8266 micro-controller. The ESP8266 is like an Arduino but on steroids. In a few words, the ESP is faster with more ports, way more memory, and better IOs. The most exciting feature of the ESP is that WiFi comes standard. It is affordable. You can find a bag of 5 on Amazon for only $14.00.

It is possible to install MicroPython on most of the ESP micro-controllers. It allows developing programs with only a text editor. Running the Python interpreter makes debugging and experimenting easy. Connect your console, stop the program with a control-C from your keyboard, run command, check variables, etc. Developing for the ESP micro-controller is a fun experience.

I decided to make the controller board separate from the relays. I chose this option to be able to use the board for other projects. Also, I wanted the option to experiment with different relays for QRP or QRO, for example.

The schematic, the PCB design, and the BOM are available on EasyEDA AntennaSwitch. You will find everything you also need to build a bias tee on the same website. The bias tee is the device that allows to power the switch box using the feed line.

The relays control board has a classic design. An optocoupler ensures the separation between the relays' 12 volts circuit and the 3.7 volts of the ESP controller. Then, a 2N2222 transistor switches the relays on and off.

Antenna Switch Schematics

Firmware

Switch Home Page

The ESP micro-controller runs a simple web service written in Python. The service listens to the port 80882. If you connect using a web browser, it sends a page with a button for each of your antennae with their name. Just click on the name of the antenna to select it. The button corresponding to the selected antenna will change color to indicate which antenna is currently active.

You can also use the REST API to control the switch.

Status

The command /api/v1/ports will return the status of each port. The variable status set to 1 indicates the selected antenna port.

% curl -s http://aswitch.home:8088/api/v1/ports
{
    "1": {
        "label": "Hustler",
        "status": 1
    },
    "2": {
        "label": "Dipole 40/80",
        "status": 0
    },
    "3": {
        "label": "Isotropic",
        "status": 0
    }
}

Switch antenna

The command to switch antennae is /api/v1/select, followed by the port number of the antenna you wish to select.

% curl -s http://aswitch.home:8088/api/v1/select/1
{
    "msg": "Port 1 selected",
    "port": 1,
    "status": "OK"
}

Errors

Making an invalid API call, or when something wrong happens, will cause the API to return an error, as shown in the following example.

% curl -s http://aswitch.home:8088/api/v1/select/5
{
    "msg": "Invalid port 5",
    "status": "ERROR"
}

Source

The firmware's source code for the ESP is available on my GitHub account AntennaSwitch. It is written in Python, using Asynchronous IO. The file config.py contains the configuration information, your WiFi SSID, password, the name or label for each of your antennas.

Integration

The following picture shows the relay controller board with the ESP8266 modified to allow for an external WiFi antenna. The box being metallic, the WiFi needs an external antenna to work properly.

Antenna Switch with the Bias Tee on the side

In the picture, you can see the bias-tee, the small aluminum box on the side. It allows sending the power to the relay controller using the coaxial cable.

For antennae that are not selected or when the power is off, the switch box grounds all the antennas; it prevents static buildup. It helps to protect your equipment and with lightning prevention.

The relays I am using can switch 240 volts, 10 amps, which is more than enough to switch from one antenna to the other accidentally while transmitting with full power. To makes things safer, I am using two connectors on the relay to change antenna.

MacSwitch

The switch runs a web application allowing a web-browser to control it fully. For convenience, I have written an application called MacSwitch. The application runs on my Mac. It also runs on a Linux machine such as a Raspberry-Pi. I have written MacSwitch in Python using the Qt5 library for the graphical interface. This application should run on Windows with minimal effort.

The companion application can be found on my GitHub account MacSwtich.

Lessons learned

The controller board works as expected. Using an ESP8266 makes it fun and convenient to develop. Not mounting the relays on the PC was a good idea. It allows me to use that board for other projects with different relays. I also have another non-ham radio related project for that board using solid-state relays, for example.

I was afraid of having issues with the WiFi module so close to high power HF. After a few days of heavy testing, I haven't seen any. Every part of my setup is bonded and grounded, which should limit the RFI problems.

I have designed the board using through-hole components to make it easy to build for hams without SMD4 soldering experience.

For the integration, I chose an outdoor electrical box made from high quality cast aluminum, IP662. The size is 6x6 inches. I should have chosen a slightly bigger box, maybe 6x9. I didn't have enough space on one side to put five SO239, one connector for the antenna input, and one for each of the four antennae. Having all the SO239 so close to each other made it challenging to waterproof them with the self-fusing silicone tape.

Interested?

If you want to build the same antenna switch, you can leave a message on my blog or send me an email. I will be happy to help you. I am considering selling a kit on Tindie if several people show interest in this project.


  1. Bill Of Materials 

  2. The port number is configurable 

  3. Waterproof 

  4. Surface-Mount Device 

Tags:  Ham Radio    DIY