How doohans/arduino_surface_tx_4ch works
Project Type and Purpose
• This is an embedded Arduino project focused on implementing a surface transmitter (TX) for RC surface vehicles like cars or boats.
• Its purpose is to manage different aspects of a RC transmitter—reading button inputs, performing calibrations, displaying information on an LCD screen, generating PPM output for remote control, monitoring battery voltage, and storing persistent configuration via EEPROM.
• The README explains its key modifications (model naming, exponential curves, endpoint adjustments, calibration routines, error prevention for EEPROM wear, etc.) and how it interfaces with an external multiprotocol PPM module.
File Structure
• The project’s root contains documentation folders (Doc, Images) and a central README.
• The main code lives in the “SurfTX_4CH” directory with multiple .ino files, each focusing on a particular module of the firmware (e.g., Battery.ino, Buttons.ino, Screen.ino, Calibration.ino, etc.). This clear separation by file indicates a modular design approach.
• There is also a header file “Config.h” for configuration and constant definition.
• This separation suggests the design divides system functionality into independent yet interacting components.
Main Components
a. Core Control Unit (Arduino Microcontroller):
• Represents the processing unit running the firmware.
b. User Interface Subsystem:
• LCD Display (12864-06d LCD screen)
• Button Inputs (UP, SELECT, DOWN, D/R button handling)
• Buzzer output for alarms and feedback.
c. Calibration Module:
• Handles the Two-step calibration procedures (range and center calibration).
• Likely interconnects with both the UI (buttons, screen) and the stored configurations.
d. Signal Generation Subsystem:
• PPM Output generation via modules like “PPM_Channels.ino” and “PPM_Output.ino.”
• Represents the communication interface to the external multiprotocol TX module.
e. Power/Battery Management:
• Battery monitoring code (Battery.ino, Read_ADC.ino) to read and interpret analog battery voltage.
• Low voltage alarm configuration using fixed thresholds.
f. Memory and Configuration Persistence:
• EEPROM handling (Eeprom.ino) for saving calibration settings, model names, and other customizations.
• “Config.h” acting as a central configuration resource.
g. Additional Functional Modules:
• Expo adjustments (Expo.ino)
• Switches and Buttons functionalities (Switches.ino, Buttons.ino)
Relationships and Interactions
• The main loop (SurfTX_4CH.ino) coordinates the operation of all modules.
• Button presses trigger calibration routines, change model settings, or update the UI on the LCD screen.
• Battery and ADC readings inform both the UI (by alerting low-voltage conditions with a buzzer) and calibration logic.
• The PPM channel and output modules work in tandem to compute and issue signal outputs, referencing data from calibration results and user inputs.
• EEPROM access interplays with system configuration to ensure settings persist across power cycles.
Architectural Patterns and Design Principles
• Modular Design: Each .ino file holds a clearly separated functionality, making it easier to view independent modules.
• Event-Driven/UI Loop: The control flow is likely organized around a main loop reacting to button events and sensor inputs.
• Hardware Abstraction: Clearly distinct modules for hardware interfaces (ADC, PPM output, LCD display) which abstract the underlying circuitry.
• Data Flow: Input devices (buttons, battery sensors) feed data into processing routines that update visual displays and signal outputs.
• Optionally, include annotations or notes on key functions like “Calibration Routine” which involves two steps managed via button inputs, or “low voltage alarm configuration” in the Battery module.