Kenwood All-Mode Multi-Bander TS-570S radio:
TS-570 has a male 9-pin RS-232 port in the back. I connected this to a USB-to-RS-232 cable that I bought online.
I found just about all the information I needed in the excellent and comprehensive TS-570S manual.
- 1 Serial Port (Hardware)
- 2 Serial Communication (Software)
- 3 Python TS-570S Control Program
- 4 Links
- 5 Flags
Serial Port (Hardware)
Radio Serial Port Photo
There is an RS-232 serial port on the back of the radio, pictured below:
Radio Serial Port Pinout
The radio's manual gives the pinout for this port, and some information on how to communicate with the radio using the serial connection:
Here is a table with information about which pins go where, and the function of each pin. There are basically five pins used:
- Two pins are TX/RX pins for transferring data between the computer and the radio.
- Two pins are on/off switches for the TX/RX functionality (i.e., these have to be supplied with voltage for the radio and the computer to be able to transmit signals back and forth).
- One pin is a ground pin.
Computer Serial Port
I am connecting to the Kenwood radio's serial port using a MacBook Pro. I used a USB to RS-232 cable. Unfortunately, it was a USB to male RS232, and the radio also had a male RS232 connection in the back, so I used some tiny female-female wires to connect each of the individual pins:
This site has more information about serial pin numberings: http://www.tldp.org/HOWTO/Serial-HOWTO-19.html
You must be careful to connect the correct pins the correct way. If you have a female-female RS-232 crossover cable, you're all set (it will cross the TX and RX lines), but if you're manually sticking wires between pins, you have to pay close attention.
___________ \1 2 3 4 5/ Looking at pins \6 7 8 9/ on male connector ------
The five pins that will be connected on the Kenwood side are (WARNING: THESE ARE SWAPPED FROM THE COMPUTER):
- TXD - transmit data - pin 2 on the Kenwood - transmits bytes into the radio
- RXD - receive data - pin 3 on the Kenwood - receives bytes from the radio
- GND - ground - pin 5 on the Kenwood
- CTS - (clear to send) receive enable - pin 7 on the Kenwood - radio sets this pin high when it is ready to receive
- RTS - (request to send) transmit enable - pin 8 on the Kenwood - radio is allowed to transmit if this pin is high
The five pins that will be connected on the computer side are:
- RXD - receive data - pin 2 on the computer - receives bytes into the computer
- TXD - transmit data - pin 3 on the computer - transmits bytes from the computer
- GND - ground - pin 5 on the computer
- RTS - (request to send) transmit enable - pin 7 on the computer - computer is allowed to transmit if this pin is high
- CTS - (clear to send) receive enable - pin 8 on the computer - computer sets this pin high when it is ready to receive
To connect the two, we need to connect pin 2 to pin 2, pin 3 to pin 3, pin 5 to pin 5, pin 7 to pin 7, and pin 8 to pin 8. No crossover is necessary, because the RX and TX pins are swapped internally in the radio, to make it easier.
We want to connect the radio and the computer as follows:
Radio Pin Computer Pin 2 TXD --------- 2 RXD 3 RXD --------- 3 TXD 5 GND -------- 5 GND 7 CTS --------- 7 RTS 8 RTS --------- 8 CTS
On the MacBook, I will be using Python together with the pyserial library  to send serial commands out and over the wire.
Serial Communication (Software)
The pyserial library can be used to communicate with devices using a serial port/protocol. The pyserial library is available on Github: https://github.com/pyserial/pyserial
Serial Command Format
The Kenwood TS-570S manual details the pinout of the serial cable, and what hardware connections need to be made. But it also covers the specifics of how to send commands from a computer to the radio. The commands are classified as follows:
- Computer control commands
- Input command (input to the transceiver)
- Set command (sets particular condition)
- Read command (reads an answer)
- Output command (from the transceiver)
- Answer command (transmits a condition)
- Input command (input to the transceiver)
Command syntax is as follows:
FA 00007000000 ; ^^ ^^^^^^^^^^ ^^ Terminator Parameters Alphabetical command
For example, the following is a Set command:
The prefix FA will set the frequency (F) of variable frequency oscillator A (VFO A) to 7 MHz.
Likewise, the following is a corresponding Get (or Answer) command, asking for the frequency of VFO A:
When this command is sent, the radio will return the following:
This indicates that the frequency of VFO A is set to 7 MHz.
The following is a table of alphabetical commands given in the appendix of the TS-570S user manual:
A good "Hello World" command is the ID command, which returns the model number of the radio. I'll be using this to demonstrate basic serial communication with the TS-570S.
Finding the Serial Device
No matter what library we happen to choose to communicate with the serial device, we will need to specify the device file associated with the serial device. This will be a file in the
/dev/ folder that shows up when we plug in the USB-RS232 cable.
Finding the USB to Serial Device
Trying to find the device file associated with the USB-RS232 adapter.
I started by unplugging the USB-RS232 cable from the laptop's USB port, shutting down the radio, and running the command
/bin/ls -1 /dev/ > /tmp/noradio.
Next, I plugged the USB-RS232 cable into the laptop's USB port, turned on the radio, and ran the command
/bin/ls -1 /dev/ > /tmp/withradio.
I then looked for any devices that showed up when I plugged in the USB-RS232 cable into the USB port:
$ vim -d /tmp/noradio /tmp/withradio
No luck - there were no devices that showed up when I plugged in the serial cable.
My next step was to try installing a driver for the USB-RS232 cable from the manufacturer (in this case, CableMatters). Their drivers page  provided a link to a Mac driver. Specifically, the page with the driver listed it as "Smart I/O > USB to UART/Serial/Printer > PL2303 Mac OS X Driver Download".
I downloaded version 1.6.0, which was a zipped up pkg file. It was only 94 KB, but required a restart. oooookay, annoying driver software, let's reboot.
Finding the USB to Serial Device Redux
After installing the driver, trying again.
Unplug the USB-RS232 cable, power off the radio, and list all device files:
$ /bin/ls -1 /dev/ > /tmp/noradio
Power on the radio, plug in the USB cable, and list all device files again:
$ /bin/ls -1 /dev/ > /tmp/withradio
Now look for devices that showed up when the radio was turned on and plugged in:
$ vim -d /tmp/noradio /tmp/withradio
BINGO!!! We have our USB serial device showing up when we plug in the USB-RS232 device. Two device files show up when the USB-RS232 cable is plugged in:
An excellent tutorial on the essentials of the pyserial library is here: http://www.zilogic.com/blog/tutorial-pyserial.html
To install pyserial:
$ pip install pyserial
Now you can import pyserial by adding
import serial to your Python code, and create a serial device corresponding to the device file.
Our first script is a "hello world" script. It asks the radio for its ID:
import serial # Set the device file ser = serial.Serial('/dev/tty.usbserial') # Timeout is 5 seconds ser.timeout=5 # Yes, we will be using RTS and CTS (ready to send/clear to send) ser.rtscts = True # Give the command to the radio that asks for its ID print "Writing id" ser.write('ID;') # Read the response from the radio print "reading" a = ser.read(16) print a # Close the serial connection ser.close()
When this script is run, you get the ID of the radio, which is
$ python ser.py Writing id reading ID018;
We can modify this script to get the current frequency of the radio, by changing the command to
FA; (for frequency of VFO A):
import serial # Set the device file ser = serial.Serial('/dev/tty.usbserial') # Timeout is 5 seconds ser.timeout=5 # Yes, we will be using RTS and CTS (ready to send/clear to send) ser.rtscts = True # Ask for the current frequency print "Asking for frequency" ser.write('FA;') # Read the response from the radio print "reading" a = ser.read(16) print a # Close the serial connection ser.close()
This works as expected - the radio was on 14 MHz, which is precisely what is returned by the command:
$ python ser.py Writing id reading FA00014000000;
Excellent, this means that we are in business!
The Twisted library also allows for asyncronous communication with a serial device. Twisted is an event-driven Python library. Examples are provided with the Twisted documentation.
Serial MouseMan example: https://twistedmatrix.com/documents/16.2.0/_downloads/mouse.py
Serial NMEA GPS example: https://twistedmatrix.com/documents/16.2.0/_downloads/gpsfix.py
Python TS-570S Control Program
In this section we'll stitch together some code to control the radio in a more comprehensive/sophisticated way.
Manual for the TS-570S transceiver: http://www.manualslib.com/manual/86121/Kenwood-Ts-570d-Ts-570s.html
Connecting to Kenwood (DXLab): http://www.dxlabsuite.com/dxlabwiki/ConnectingKenwood
radioall things radio.
Notes on General class license: General
Digital modes: Radio/Digital Modes
Ham Radio Hardware (Radios):
Kenwood TS 440S: Radio/Kenwood/TS440S
Kenwood TS 570S: Radio/Kenwood/TS570S
Yaesu VX-6: Radio/Yaesu/VX-6
Digital Modes on Raspberry Pi: RaspberryPi/Digital Modes
Digital Modes on Arduino: Arduino/Digital Modes
DVB-T USB SDR Dongle: DVB-T USB SDR
Ham Radio Software:
Software defined radio: SDR
Comprehensive list of ham software: Andys Ham Radio Linux
Direwolf (soundcard TNC/APRS modem): Direwolf
Echolink (internet repeater system): Echolink
Qsstv (Slow scan television): Qsstv
Fldigi (fast light digital modes): Fldigi
Xastir (APRS/AX25/TNC): Xastir
RadioHead (packet library for microcontrollers): RadioHead
Flags · Template:RadioFlag · e