FTDX-10 Arduino Controller

Source Code Documentation

Source Code

Complete Arduino source code for the FTDX-10 controller project.

Total Code: ~800 lines across 5 files | License: MIT

Project Structure

The code is organized into modular components for easy understanding and modification:

📄 Main Sketch

ArduinoFTDX10.ino (7.4KB)

Main controller program containing:

  • Setup and initialization
  • Main event loop
  • Display event handlers
  • Radio response processing
  • Band and mode management
View Code

📻 Radio Control Library

FTDX10_CAT.h/.cpp (7.9KB)

Complete CAT command library:

  • Frequency control
  • Mode selection
  • VFO management
  • Power control
  • Audio/RF gain
  • Meter readings
View Code

🖥️ Display Interface Library

NextionDisplay.h/.cpp (8.2KB)

Nextion display control:

  • Touch event processing
  • Display updates
  • Text and value control
  • Page management
  • Nextion protocol handling
View Code

All Source Files

File Size Lines Description Action
ArduinoFTDX10.ino 7.4KB ~300 Main controller program View
FTDX10_CAT.h 2.7KB ~80 CAT library header View
FTDX10_CAT.cpp 5.2KB ~220 CAT library implementation View
NextionDisplay.h 2.3KB ~70 Display library header View
NextionDisplay.cpp 5.9KB ~230 Display library implementation View

Code Features

📚

Modular Design

Organized into separate libraries for radio control and display interface

💬

Well Commented

Comprehensive comments explain functionality and usage

🔧

Easy to Extend

Clean API makes adding new features straightforward

🐛

Debug Output

Built-in serial debugging for troubleshooting

Efficient

Optimized for Arduino Mega with minimal memory usage

Tested

Code has been tested and verified to work

Key Functions

Radio Control (FTDX10_CAT class)

// Frequency control
void setFrequency(unsigned long freq);
void getFrequency();
unsigned long getCurrentFrequency();

// Mode control
void setMode(int mode, int bandwidth = 0);
void nextMode();

// VFO control
void selectVFO(char vfo);
void swapVFO();

// Power control
void setPower(int watts);
void setTX(bool tx);

// Audio/RF
void setAFGain(int gain);
void setRFGain(int gain);

// Meters
void getSMeter();
void getPOMeter();

Display Control (NextionDisplay class)

// Event handling
void processEvents();
bool hasEvent();
NextionEvent getEvent();

// Display updates
void setFrequency(String freq);
void setMode(String mode);
void setPower(int watts);
void setSMeter(int value);
void setTXIndicator(bool tx);

// Component control
void setText(const char* component, String text);
void setValue(const char* component, int value);
void setPage(int pageNum);

Hardware Serial Ports

Serial Port Pins Baud Rate Purpose
Serial USB 115200 Debug output to PC
Serial1 TX1 (18), RX1 (19) 38400 Radio CAT control
Serial2 TX2 (16), RX2 (17) 9600 Nextion display

Important Constants

Operating Modes

#define MODE_LSB      1
#define MODE_USB      2
#define MODE_CW       3
#define MODE_FM       4
#define MODE_AM       5
#define MODE_RTTY_LSB 6
#define MODE_CW_R     7
#define MODE_DATA_LSB 8
#define MODE_RTTY_USB 9
#define MODE_DATA_FM  10
#define MODE_FM_N     11
#define MODE_DATA_USB 12
#define MODE_AM_N     13
#define MODE_C4FM     14

Display Events

#define NEX_EVENT_RELEASE 0x00
#define NEX_EVENT_PRESS   0x01

Update Intervals

const unsigned long updateInterval = 100;      // Display update: 100ms
const unsigned long freqUpdateInterval = 500;  // Radio poll: 500ms

Compilation

To compile and upload:

  1. Open ArduinoFTDX10.ino in Arduino IDE
  2. All other .h and .cpp files load automatically (must be in same directory)
  3. Select board: Arduino Mega 2560
  4. Select COM port
  5. Click Upload

Required Board

No External Libraries Required

All code is self-contained. No need to install additional Arduino libraries!

Download Source Code

All files are included in the project download

Back to Project Root

Customization Ideas

Easy Modifications

Advanced Enhancements

Code Documentation