while I am writing my homebrew Arduino Controller code, I realized that I
could share the basic part of my code for Band Data and CAT usage. I
read some posts on the Community from people asking for a particular kind of Band Data system like I2C, BCD, RS-232 and so on. Waiting for other manifactures to adopt the Flex native ethernet protocols, you could use this library to command already existent devices. This library really doesn't implement a specifica protocol, but give you a very simple way to do it.
The code is open and free and is provided in three parts: a basic library that works at the ethernet level and two library examples that show you how you can use the libraries for band data and CAT purposes.
The software also does not implement any set command but only the commands required from other devices to get the radio status.
So you need to have knoweldge of SmartSDR Ethernet API, SmartSDR Command Line API, Arduino and C programming.
The Basic library is essentially a small piece of software that implements the SmartSDR Discovery Protocol to locate and connect a FlexRig in your network. In default mode the library try to locate the first FlexRig available in the network, then it try to establish a connection using the 4992 Tcp-IP port. This approach is correct if you have only one Flex Rig (like in my case).
If you have more than one Flex Rig on the same network, you have to manually set the serial number of the rig you want to connect to.
When the radio has been located, the library starts a connection over the 4992 TCP/IP port. It is used to command the radio and receive streaming status information. Every update on the internal state of the radio is then reflected on the library objects.
Going more in depth, a parser analyzes the TCP/IP packets, selecting only the Status "S|" one and then pass any updates to the local software objects.
In this way, using the library, you can access the internal state of the rig without having to deal with network protocol.
The library can handle the objects shown in the picture below. As you can see the number of slices, panadapters waterfalls is limited only to two as I did tests only on my Flex-6300. The library can be extended to monitor the status of multiple objects as in the case of 6500 and 6700 Radio. The ATU is also a missing object because my 6300 isn't equipped with it and I have never tested it.
To use the library you need a really powerful micro-controller. I choose Arduino Due because it is very simple to program and has a C standard instructions set. Also you need an Arduino Ethernet Shield that uses the W5100 chip. It is the best board that allows your Arduino to access the network at 100Mb/s. It is also the board that has the best support libraries.
== Banda Data Library Example
Band Data library relies on the previous library and it
generates events you can simply handle from inside you sketches. You
don't need to worry about basic rig communication, nor you are
requested to handle all your logic in the main loop() routine.
Simply, in the setup() procedure, you have to register a function (handler) for each event that you need to handle. The library do the rest.
You can register your code for the following events:
- Any update on Slice objects (only # 0/1)
- Any update on Panadapter objects (only # 0/1)
- Any update on Waterfall objects (only # 0/1)
- Any update on Radio object
- Any update on Transmit object
- Any update on Interlock object
After having registered your event handler, the library execute a call to it, each time that particular event occurs. In the handler routine you can activate your hardware or you can use strategies to monitor your system.Last but not least, as you can have access to a great number of Flex object properties, you can extend the library code to handle events based on a particular object properties.
=== CAT RS232 Library Example
I have only implemented the commands that can be useful for external devices synchronization, mostly amplifiers and dynamic antennas controller. I do not own any of these devices so I did tests using other software like Omnirig and LOG4om. It seems it works nicely, but be careful, you have to do your own test.
The library also does not implement any set command but only the commands required from other devices to get the radio status.
Below you can see the actual command list:
FA; - Reads Slice receiver A frequency
FB; - Reads Slice receiver B frequency.
IF; - Reads Transceiver Status
FR; - Receive VFO
FT; - Transmit VFO
AI; - Auto Information Mode
ZZFA; - Reads Slice receiver A frequency
ZZFB; - Reads Slice receiver B frequency
ZZIF; - Reads Slice Receiver A DSP filter
You can find code and examples at the following links:
Band Data Example
Calling these "library" is a bit pretentious and the purists of the C / C ++ might blame me looking at my code. But it seems the code works and is open. So if you like, you can change and improve it. Just let me know.
Last, I recorded a video to show you how you can use the software.