TCI (ESP32s) Arduino Libraries for SunSDR rigs

New release for ExpertSDR3!

Update: 2022-09-12 - Released a new library for ExpertSDR3  - Not compatible with EESDR2 and older code

 

The TCI library hides the whole complexity in establishing a connection with the EESDR3. It provides an event-driven enviroment so that you don't have to worry about protocol handling and rig communication. Also it can restore a connection after a network failure and can connect the TCI host as soon as EESDR is started.

 

The  new release is more powerful than the previous one as it relies on the FreeRTOS framework. Still you can continue developing your project under the  more convenient Arduino IDE. The code package comes with some complete working examples and with some suggested third party libraries.

 

Download and install

Download the 1.9 zip archive from my dropbox

Older version - 1.7

 

 

Uncompress the zip archive in the Arduino default lib directory. The installation procedure differs depending on the operating systems. You can follow the Manual Installation procedure described at the following link https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries

In the TCI directory you will find the support_libs.zip file. It contains the third party libraries I used in the various example. You should install them in the same way in order to compile the provided examples.

 

Starting to know the library

I suggest you give a look at the 06_TCI_empty_project in the examples -> TCI by iw7dmh menu item. You can use it to start a project from scratch. It provides all the required settings to start immediately with a sketch that can connect your wifi network and the TCI endpoint.

 

 

In every example you'll find the following files:

 

1-  <project name.ino> : it is the main project file. Some statements are defined: you need them for a correct program execution.

 

2- global.h : a file shared with all other project files. Here you can configure network and TCI parameters.

 

3- network.h : you should never need to edit it. It handles all the network stuff. Also it starts the TCI client when EESDR is running.

 

4- tci_events.h: this is the file where the magic happens. It is a very long file but don't be scared. To make thing easier, all the event handlers are already implemented. You should be familiar with the official TCI documentation because every TCI command has a corrispondent event in the file.

So uncomment only the events you are interestd in and you are done. In the main .ino file a call to configure_tci_events() function enable the sketch to respond to the events you have chosen. The tci.attach<event_name> method has a reference to the function that will actually handle the event. That function is under your responsability. Anyway in the blank project all the events are handledso you can see how to get the informations you need.

 

Once you have configured the network and TCI parameters, just upload the sketch and start EESDR3. After awhile you should see the blu led on the ESP32 which means the ESP32 is already connected to EESDR3. In addition you can see the event log opening the Arduino Serial Monitor like in the picture below

 

 

 

Button and Led example

In this example you'll learn how to handle the MUTE and APF functions. Two buttons can toggle each function from ON to OFF and vice-versa. Also two leds show the respective status.

Analog volume control example

I am not very happy with this example. It shows how to trim the volume level using an analog potentiometer. Anyway it is a very formative example because I found that the ADC2 channel can't be used while the WiFI is enabled. So, for analog reading purpose, remeber to only use the exposed ADC1 pins (from GPIO32 to GPIO39).

Multifunctional Rotary Encoder - AGC example

With this sketch you'll be able to control the AGC function. A rotary encoder can set the AGC GAIN while the embedded button can toggle the mode for FAST to NORMAL and vice-versa with a simple click. A long pression on the same button can toggle the AGC from ON to OFF and vice-versa.

Multifunctional Rotary Encoder - Rit + VFO example

Based on the AGC example, I developed a Rit + VFO Example for a friend of Mine David (CT1DRB). In the pictures below you can find his project and the very simple connections with the two encoders. He also used a very practical ESP32s breakout board. The RIT encoder is a KY-040 model, while the VFO is a 400 pulse magnetic rotary encoder. You can find both of them and breakout board on Amazon or on Aliexpress.

 

Download the code

 

I2c Display - VFO A/B example

In this example you'll learn how to handle the VFO event. You'll see how it is simple to show the VFO-A and VFO-B frequency on a small I2C display.

TTL-232Adapter - RS232 CAT control example

Using a simple TTL-RS232 adapter you can simulate a hardware CAT control port. This is a handy solution that you can use to drive a power amplifier, a dynamic antenna controller or an automatic antenna switch whitout having to deal with the EXT-CTRL connector and whithout a linked connection as the ESP32 communicate with EESDR via WiFi.

The protocol is the CAT KENOOD TS-480 but be aware that the implemented commands are strictly related with VFO A/B, RIT, XIT. That is enough to enable the band switching in the above devices.