TCI (ESP32s) Arduino Libraries for SunSDR rigs

The TCI Arduino libraries are based on the SunSDR TCI 1.6 protocol specification. You need a powerful MCU to be able to compile and run the code. Any board of the ESP32s family, like the ESP32 DEV KIT V1,  can do the job.

 

Note: The library works fine with latest 1.6 TCI version released on Semptember 2021.

What can you do with it?

Using the libraries you can quickly and easily develop hardware devices that can interact with EESDR.

As you can see in the picture there are two ways you can use it:
1- catch the events generated by the radio and activate typical devices such as relays, displays, filters, etc.
2- use input fro external devices to send commands like changing the frequency of any VFO, enabling/disabling the second receiver, changing the filters width and so on. Capabilities are limited by the commands/events available in the 1.3 TCI protocol.

The TCI library hides the whole complexity in establishing connection with the EESDR network and the TCI port. Furthermore, after the initial setup, the board is able to auto-restore a connection after a network failure and is able to auto-connect the TCI host as soon as EESDR is started. Developers don't have to worry about this tedious job.

Installation

Before going on with the TCI libraries be sure the Arduino IDE is properly configured for the ESP32s boards and WebSockets protocol.

(Please read the procedure described in Note 1 and Note 2 at the end of the page).

Now download the TCI.zip archive you find at the bottom of the page and extract it in your Arduino libraries directory. Usually, the directory name looks like C:\Users\<your-user>\Documents\Arduino\libraries.
In the same directory you'll find a basic project TciDemo.ino that shows how to start with the code.

 

 

As you can see, the required code to make any Arduino project TCI enabled is very simple:

1- include the library and instantiate it;

2- configure the events you want to handle (in the Events tab all the events are enabled. Of course you can comment out all that you don't need);

3- add the process() method to the main loop. This is very important, otherwise the lib simply doesn't work;   

4- in the TCIDemo.ino you can find a dummy method that has a list of all the available methods. Using these methos you can send commands to the rig, for example startDevice(), stopDevice(), vfo(int rtxId, int vfoId, int freq), setRitOffset(int rtxId, int value), and so on.

 

That's all.

How the lib works

Once you have upload the code, you have to setup the board. It is a very simple task because the library provides a serial console. You can use the Arduino Serial Monitor configured with 115200 speed and Newline option.

 

Just type in the help command to see all the available commands:

 

 

All settings are stored in the non volatile memory of the ESP32, so these are "set and forget" options unless you change any of the working parameters.

See the video below that shows how the lib works once configured.

 

Some notes about theESP32 DEV KIT V1

For a good project, it is mandatory having a knowledge of your board. Here is the pin definitions of the board I used for my tests. You can use any board of the ESP32s family, but this one works out of the box. 

 

 

WARNING! You can't use the GPIO16, GPIO17, GPIO32, GPIO34 pins for input/output purposes. They are used by the TCI lib for UART communications (see the paragraph below). 

Typical applications: TS-480 RS232 CAT ports - Auto band switch

The basic implementation of the library provides two useful CAT serial ports, one for each receiver. As you can see in the picture, connecting a pair of TTL/RS232 adapter, you can have out of the box two traditional DB9 port that provide a TS-480 CAT connection. The TS480 CAT protocol is not fully implemented, but it has enough commands for reading VFOs frequency and for RIT/XIT/SPLIT operations.

 

In the picture below you can see my TCI development board. It is still a work in progress. In addition it adds the two serial ports and a configurable 12-port automatic band switch driven by two ULN2803A chip. Each port is configurable for single RX (1 OR 2) or for both, in RX and TX mode.

 I find it very useful in remote operations: I can send CAT data to a RF power amplifier and I can switch antennas and filters without a computer running next to my PRO2. In remote operations the EESDR pc is connected to my home network through OPENVPN.

Download

Link to Arduino TCI Library v. 1.6-01 - works fine with latest 1.6 release

Tested on EESDR v. 0.9.0

Note 1 - How to configure Arduino IDE for ESP32s

Download and install the Arduino IDE from the official web site.

1 - In your Arduino IDE, go to File> Preferences

Installing ESP32 Add-on in Arduino IDE Windows, Mac OS X, Linux open preferences

 

2- Enter https://dl.espressif.com/dl/package_esp32_index.json into the “Additional Board Manager URLs” field as shown in the figure below. Then, click the “OK” button:

 

Installing ESP32 Add-on in Arduino IDE Windows, Mac OS X, Linux enter URLs

 

3- Open the Boards Manager. Go to Tools > Board > Boards Manager…

 

Installing ESP32 Add-on in Arduino IDE Windows, Mac OS X, Linux open boards manager

 

4- Search for ESP32 and press install button for the “ESP32 by Espressif Systems“:

 

ESP32 Add-on in Arduino IDE Windows, Mac OS X, Linux Installed

 

5- That’s it. It should be installed after a few seconds.

 

ESP32 Board add-on in Arduino IDE installed

 

6- In Tools > Board menu select the DOIT ESP32 DEVKIT V1 board:

 

Arduino IDE select the ESP32 board in Tools menu

 

7- Select the Port (if you don’t see the COM Port in your Arduino IDE, you need to install the CP210x USB to UART Bridge VCP Drivers):

 

Arduino IDE select the ESP32 Port in Tools menu

 

8- Test your installation open the example under File > Examples > WiFi (ESP32) > WiFiScan

 

Arduino IDE open WiFiScan example for ESP32

 

9- upload the code with the button Arduino IDE upload WiFiScan sketch to ESP32. After few seconds you have to press the BOOT button on the board to complete the upload.

 

10- Open the Arduino IDE Serial Monitor Open Arduino IDE Serial Monitor at baud rate 115200 at a baud rate of 115200. You should see the networks available near your ESP32:

 

ESP32 Testing Add-on installation in Windows PC, Max OS X, and Linux computer

 

Note 2 - Installing WebSockets libraries for Arduino IDE and ESP32s

In the Arduino IDE open the menu Sketch->Include Library->Manage Libraries and search the WebSockets library by Markus Sattler  (see the picture below)

 

 

Select the library then click on Install button.