Beverage Switch

From Stu2
Jump to navigation Jump to search

This switching system allows users to select different directional receive antennas for the W4RM contest station. It re-uses the switch matrix of the pervious version and replaces the PIC based control system with a Java application that runs on the contest station PC. The controller is a BeagleBone Black board using Debian based image. Both the client and server are written in Java. The client uses JavaFX. AutoHotKey is used to allow the users to select an antenna using the numerical key pad. The IDE was NetBeans.

Old System - we reused the switch matrix

Architecture

The system uses a client server approach. The client, which resides on the PC, sends a UDP packet with the antenna selection request. The server, residing on the BBB, receives the UDP packet, validates the request, sends a multicast response back to the network and changes the relays in the switch matrix. The client listens for the multicast packet and updates the GUI when such a packet is received. This version has minimal (actual no) security checks.

The system supports up to four stations. The matrix allows two stations to share an antenna, but only certain combinations work. For example, Stations 1 and 3 can't share the same antenna, neither can 2 and 4. This limit was introduced in the switch because we need to insert signal splitters in the path if two stations want to share an antenna. It wasn't practical to build a full N x N matrix, nor was it really required. Beverages are typically used by 160, 80 and 40M. Normally, the 40M station is on the NE40M phased beverage.

In the picture to the left, the switch matrix is in the copper colored enclosure. The controllers, black box with yellow label, sit at the contest position. Users press a button, which sends a command to the PIC controller over a separate wire. The PIC controller selects the appropriate relays. In this version the black controller goes away and the PIC controller is replaces with the BBB. This removes another peice of equipment from the operating position and a set of wires.

The boards in the matrix contain latches. The latch inputs are in parallel and for the data bus. Then, the latch pins form the address bus. So data is placed on the data bus and the appropriate addres pin is strobed to move the data from the latch input to the latch output, which in turn selects the relay.

GUI

GUI on users PC

The GUI uses colors to indicate status. Red means the antenna is selected, but can't be shared by the station. Yellow means the antenna is selected and can be shared. Green shows the current antenna selected. Blue is open. A pointer shows the direction of the beverage. The 'Clear Mine' button will release all antennas for that station. A label located next to the button provides more information, such as 'mine', 'open' or station number. That allows the user to see which station has the annteanna selected.

A menu allows the user to configure the GUI by setting the network IP addresses and ports. There is a selection to 'clear all' stations, which disconnects all stations from the antennas.

Each button has a accelerator key assigned, which is one of the numeric key pad numbers. For example, pressing the number 4 on the keypad (Num Lock on), selects the West beverage. Then, AutoHotKey is used to assign a hot key for the overall OS. When the users presses number 4 on the keypad, AutoHotKey will switch to the BevSwitch GUI, send the number 4 signal to the application and then return to the previous window. This allows the user to switch the antenna from within N1MM contest logging program.

Scenebuilder was used to create the GUI, which is stored in a FXML file. Properties are stored in separate classes, instatiated in the backing code and bound with the GUI elements in the controller.

Here is a snippet from the AutoHotKey script:

IfWinExist, BevSwitch
{
$Numpad5::
button = {Numpad5}
switchAnt(button)
return
$NumpadClear::
button = {Numpad5}
switchAnt(button)
return

}
return

switchAnt(button) {
   ; get the current window's handle
   WinGet, current_ID, ID, A
   	
   
       ; Go to the window and send the code
       WinActivate, BevSwitch
       Send, %button%

       ; Return to the last window
       WinActivate ahk_id %current_ID%
    	
    return

}

Notes

I used the console image from here: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Debian_Releases There are several other images but this one is a scaled down installation with the wireless drivers. This allows me to store everything in flash and get rid of the microSD card.

The console image was bare bones, so I needed to enable various services such as the gadget driver to allow a serial connection to the mini-usb connector. I followed these instructions: http://github.jfet.org/BBKNotes1.html

Here is a link to the pin #'s: http://robotic-controls.com/node/68 I didn't fool around with the cape manager, instead, I picked open GPIO pins on P9. The default cape (DTS) files assign the HDMI, Serial, etc to P8, which makes those GPIO pins unusable.

Wireless worked. I used these instructions http://inspire.logicsupply.com/2014/07/beaglebone-wifi-installation.html and the UWN200. The image above came with the correct driver, but I had to install wicd because it wasn't present in the image. Ultimately, I decided against wireless because I wasn't sure how the multicast packets were going to make it past the wireless access point at W4RM's house. I spent some time attempting to get it to work at my house, but I had to taverse a firewall and wasn't successful. Note, the TTL defaults to 1. So you need to increase it, otherwise, it won't span a router. Instead, I spent $20 at NewEgg to buy a new switch, which expands the number of available ethernet ports at W4RM's place.

Here is the wiring diagram. Diagram

int port = 2000;
String group ="226.1.1.3";
int ttl = 2;
byte[] buf = new byte[256];
socket = new MulticastSocket();
socket.setTimeToLive(ttl);
String outbound;
            
// Loop forever. Anything that comes in on the Queue, 
// broadcast to multicast
while(true) {
    outbound = (String) txQueue.poll(100,MILLISECONDS);
    if(outbound != null) {
        buf = outbound.getBytes();
        Print.msg("TX: " + outbound);
        DatagramPacket packet = new DatagramPacket(buf, buf.length, 
        InetAddress.getByName(group), port);
        socket.send(packet);
}
socket.setTimeToLive(ttl);