djcompact vignette
Updated 2023 jan. 27
A newer and mature version with more options has been published. An EXE file is available.
While setting up my remote station, I quickly have been confronted to the problem of the limitations of the remote ease of use. The first one is the ability to change the VFO frequencies. My logging software LOGGER32 offers a lot of macros and an option to use the mouse wheel to change the frequencies. But during daily traffic or contesting they quickly have shown their limitations.

 On Twitter, I have seen that several hams have been using a small DJ controller for driving SDR receivers and transceivers. So I started thinking to do the same for the TS590s.

 The DJcontrol compact controller is a small and cheap Midi Controller made by Hercules.

This controller is connected via USB to the computer and offers 2 jogs and a lot of buttons, pots and slider. When these are manipulated, a flow of MIDI messages are sent to the USB port. Each adjustement sends a command when turned, pressed and released.
The list of MIDI messages can be found in a document with the mapping of these MIDI controls.

My project was to map each button to a TS590s function. The first one was to have a rotary control like a VFO button. The large 7cm Jog A is perfect for that.
In the mapping document, this Jog is named JOG_DA and the correspondant MIDI message is "Bx 30 Value", the coarse having a 128 incremental steps.

The MIDI message for a JOG A rotation looks like this :
[[0xb0, 0x30, 0x7f, 0x00], 13655]

0xb0 is the which is the global value for the set of sliders, pots and jogs
0x30 is the assigned to the JOG A
0x7f is the value for CCW rotation, it changes 0x01 for CW rotation
0x00 is not used for this command
13655 is the timestamp starting at 0 when the controller is launched (not used in this project)

Another example, the MIDI message for the SYNC BUTTON is :

[[0x90, 0x23, 0x7f, 0x00], 1185118]

0x90 is the set of buttons
0x23 is the SYNC BUTTON
0x7f is when pressed, 0x00 when released
 
All the work of the software is to translate these messages to Kenwood CAT commands.

For example, the CW JOG A rotation has to be translated to " UP; " to increase the VFO by one step. CCW JOG A rotation is translated to " DN; ".
When turning the Jog a bit faster, the command send could be " UP5; " for 5 steps up at each incrementation. 

The SYNC button is assigned to select VFO, CUE button to VFOB, etc... A nice button layout can be done, making the controller very easy to use !

The same occurs for all buttons and pots. The limit is imagination !

The software Midi2TS590

Knowing very little in programmation, I choosed to use PYTHON for this project. The learning curve is quite fast when using Python and it indeed took only a few days to complete the project ! I also appreciated the fact that I could modify the software while in use during a contest and adapt it to my needs.
So I started to write a little software that I named midi2ts590.py, which stands for Midi to TS590.
Meanwhile, knowing a little more in Python, I came back to the project and added some functions, like radio sniffing which keeps the controller and radio "in phase."

The MIDI protocol is handled by the PYGAME MIDI library which makes things a little easier to handle !

The DJCompact controller can also be adressed and the backlights of the buttons can be illuminated. I used this to light on the buttons when in use.

At startup, the software looks for a configuration file and when not found, it creates one with a default configuration. The default settings have to be changed in this file according to your needs and particular configuration.

[Default]
# midi2ts590 config file
# defaults values created by program
# see manual for help in setting
mode = USB
vfo = A
tuningstep = 5
radiosniff = 1

[Midi]
devicein = 1
deviceout = 3

[Radio]
model = TS590s
comport = COM8
baudrate = 57600
bytesize = 8
stopbits = 1
parity = N
xonxoff = 0
rtscts = 0
dsrdtr = 0
polltime = 1000
rxtimeout = 0
txtimeout = 0

[Commands]
# put one or more kenwood commands (see manual) on each following line
# e.g cmd1 = vv;vx0;         set vfo a=b and vox off
# e.g cmd2 = rt0;            will put rit off
# these commands will be sent at startup
cmd1 = VV
cmd2 =
cmd3 =

At startup, all Midi devices found will be displayed on screen. Search for the DJCompact devices and modifiy the [Midi] section in the configuration file in the [Midi] section.
Change the Comport where the TS590 is connected in the [Radio] section, other Radio parameters should be fine.
The default startup mode and VFO are set in the [Default section]

 If something is missing or wrong, a warning message is displayed on screen, waiting to be corrected.

When everything is as awaited, all lights on the controller should blink 3 times, the radio should be set at default values and it can be used. Pressing the REC button once will light the red backlight and put the TS590 on power ON. Pressing it again will put the radio OFF.

Here is a page with the defined buttons and settings.

Sharing a COM PORT

In order to use the controller at the same time as a logging or contest software, we need to share the COM port that is used to send the CAT commands to the TS590s.

Under Windows, to be able to see ALL COM ports (including the hidden one and already assigned) in the device manager, you need to do the following :

Type cmd in the search bar, then right click on cmd.exe selecting "Run as Administrator"

From command prompt type; set devmgr_show_non_present_devices=1

Run the device manager, you can do this from the cmd prompt > type : devmgmt.msc

Click View > Show hidden devices.

Using Com0com virtual port

The target is to create 2 virtual ports that will share a physical COM port of the computer.
In my case, i have one physical COM port named COM1. I want to create 2 virtual COM ports COM2 and COM3, both will use a different software like LOGGER32 and the MIDI controller software described here.

1) Create 2 ports with the com2com setup command prompt :

> install PortName=COM2,EmuBR=yes,EmuOverrun=yes -
> install PortName=COM3,EmuBR=yes,EmuOverrun=yes -

2) Check if the created ports have been created by using the "list" command. I got this :

com0com list

 

I than created a batch file that is launching the com0com emulator. I did put this file in the folder where i installed com0com and hub4com :

  hub4com --baud=57600 --bi-route=0:1 --bi-route=0:2 --octs=off \\.\COM1 \\.\CNCB0 \\.\CNCB1

When the batch file is launched, it will route the COM1 to the virtual ports CNCB0 (COM2) and CNCB1 (COM3), and reverse.

 Logger32 can now use COM2 in the radio setting and midi2ts590 is using COM3. Both software are sharing the COM1 port that is connected to the TS590s COM port at 57600 bauds.

Conclusion

Using this controller and software, the remote capabilities of the TS590s are really shining. The ease of use of the controller makes the daily traffic or during contests a joy to use in remote !
Changing VFO, making SPLIT, etc... is as easy if not easier as on the TS590s itself...
More details and software are available on my Github page.

A similar software based on my work has been written by Alexandru and is available on Gihub.

Thanks...

Special thanks to F6FVY for his advices.

Updates
oct 2021 : Replaced DEC by HEX values. Added functions to read the TS590s. Bugs corrections and improvements.
nov 2022 : Updated links in article
jan 2023 : new functions and bug corrections.