Here is a fairly simple USB controlled RF switch using a Dow Key relay and an Arduino Nano.
Parts List
Dow Key RF Switching Relay, 12 V Coil With TTL Control
Low Power SMA connectors - Dow Key P/N 401-220802A-ROHS, 401-420832A-ROHS or similar.
High Power N connectors - Dow Key P/N 402-220132A-ROHS or similar
Price new is not easily available. Price used on eBay is $20 - $75
Arduino Nano
Price - many available from $3 and up
USB cable
Price - $2 and up
Berg header, Berg connectors and wires to connect the relay to the Nano
From my junk box, Price a few dollars if you can find what you need. You can just wire it directly.
Wires and Powerpole connector to provide 12V to the relay
On Hand for me, Powerpoles are about $1 in multipacks from Powewerx or HRO
Build Instructions
Connect Gnd on the Nano to Gnd on the relay
Connect Digital I/O 2 on the Nano to TTL Control A on the relay
Connect Digital I/O 3 on the Nano to TTL Control B on the relay
Connect USB cable to the Nano
Here are the Nano connections
Connect 12V to the relay Coil + (12V) and - (Gnd)
Connect RF sources to the relay
Connect USB cable to the computer. It should find the driver. If you are using virtual com ports, you
will need to assign this one to a high COM number to not interfere.
Here is everything connected together
Fire up the Arduino IDE and load the code listed below into the Nano.
Fire up a terminal program. You can use the serial monitor in the Arduino IDE or any program that can talk to a serial port. I use 115200 Baud.
You can then command the relay. Send an “A” or “a” to select channel A. Send a “B” or a “b” to select channel B. On startup the Nano will select A, wait a second, select B and then say it is ready for commands. When you send a command it will echo back the switch position.
Notes:
This can be expanded to use more TTL outputs to control more or different relays. Some relays have indicator outputs and you can read those back with the Nano.
This is not galvanically isolated. If you need that, you can get USB isolators.
You may need to add ferrite beads depending on power levels.
Arduino Sketch
int inByte=0;
void setup() {
// initialize serial:
Serial.begin(115200);
pinMode(13, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
Serial.print("Serial Init\n");
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
Serial.print("CH A ON\n");
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
Serial.print("CH B ON\n");
Serial.print("Ready for Commands\n");
}
void loop() {
if (Serial.available() > 0) {
// get incoming byte:
inByte = Serial.read();
if ((inByte == 0x41)||(inByte == 0x61)) { // "A" or "a"
digitalWrite(13, HIGH);
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
Serial.print("Ch A ON\n");
}
if ((inByte == 0x42)||(inByte == 0x62)) { // "B" or "b"a
digitalWrite(13, LOW);
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
Serial.print("Ch B ON\n");
}
}
}
Copyright Note:
All content Copyright (C) 2017 by Mark Goldberg.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Last Edited 4 December 2017