Skip to content

wspr-beacon-firmware-1.1

Latest
Compare
Choose a tag to compare
@IgrikXD IgrikXD released this 05 Jul 22:40
· 3 commits to master since this release
f6b59b5

Firmware update

Increasing the output signal power for the SI5351 IC (change SI5351_DRIVE_6MA to SI5351_DRIVE_8MA):

void initializeSI5351()
{
    if (si5351.init(SI5351_CRYSTAL_LOAD_8PF, 0, SI5351_CAL_FACTOR))
        // Set CLK0 as TX OUT
        si5351.drive_strength(SI5351_CLK0, SI5351_DRIVE_8MA);
    else
        errorLEDIndicationAndReboot();
}

Completely removed the logging of actions during device operation using "Serial Monitor" in Arduino IDE. This code occupies too much internal memory, which may become a problem when implementing additional functionality in the future.

The incorrect central transmission frequency for the 2-meter band has been corrected: the central frequency has been shifted 500 Hz higher. The central transmission frequency for the 4-meter band has been added.

// #define WSPR_DEFAULT_FREQ       70092500ULL  // 70.0925 MHz - 4m
// #define WSPR_DEFAULT_FREQ       144490500ULL // 144.4905 MHz - 2m

Added LED indication for issues occurring during hardware initialization. Now, if initialization errors occur, the red LED (TX) blinks three times, after which the device restarts.

void errorLEDIndicationAndReboot()
{
    // Turn off all the green LEDs (GPS, ON)
    digitalWrite(POWER_ON_LED_PIN, LOW);
    digitalWrite(GPS_STATUS_LED_PIN, LOW);

    // Flash the red LED (TX) three times
    for (uint8_t i{0}; i < 3; ++i) {
        digitalWrite(TX_LED_PIN, HIGH);
        delay(500);
        digitalWrite(TX_LED_PIN, LOW);
        delay(500);
    }

    resetHardware();
}

Situations that may trigger this event include:

  • Initialization error of the SI5351 at the address SI5351_I2C_ADDRESS;
  • Initialization error of the serial connection to the GPS module;
  • GPS data synchronization error after GPS_SYNC_ATTEMPTS unsuccessful synchronization attempts;

The call to the void setQTHLocator() function inside the void trySyncGPSData() function has been removed. There is no need to recalculate the QTH locator after each transmission cycle because the buffer of the transmitted WSPR message is initialized only once, at device startup, and does not change during device operation. The array of char elements for storing the QTH locator has been removed from the global scope. Now, the QTH locator is calculated once before calling the function jtencode.wspr_encode(WSPR_CALL, qthLocator, WSPR_DBM, tx_buffer).

void encodeWSPRMessage(const TinyGPSPlus& gpsDataObj)
{
    memset(tx_buffer, 0, WSPR_MESSAGE_BUFFER_SIZE);
    
    char qthLocator[5];
    setQTHLocator(gpsDataObj, qthLocator);

    JTEncode jtencode;
    jtencode.wspr_encode(WSPR_CALL, qthLocator, WSPR_DBM, tx_buffer);
}

The transmission frequency for the new transmission cycle is now calculated at the end of the current transmission cycle using void setTransmissionFrequency():

void loop()
{
    // Transmission of a WSPR message every even minute (00:00, 00:02, 00:04, ...)
    if(second() == 0 && minute() % 2 == 0)
    {
        transmitWSPRMessage();
        
        // Time synchronization based on current GPS data for a new transmission cycle
        TinyGPSPlus gpsDataObj;
        synchronizeDateTime(gpsDataObj);
        
        // Set a new, random transmission frequency
        setTransmissionFrequency();
    }
}

The variable responsible for the current transmission frequency has been moved to the global scope:

//******************************************************************
//                      Global variables
//******************************************************************
...
uint64_t transmissionFrequency;

The line responsible for disabling the CLK0 output during SI5351 initialization has been removed. It is unnecessary, as the CLK0 output is disabled by default:

void initializeSI5351()
{
...
    si5351.output_enable(SI5351_CLK0, 0);
...
}

Added firmware for hardware testing

Firmware has been added for testing the functionality of the hardware after assembly. The firmware provides the interactive output and allows identification of specific issues occurring during hardware initialization. During hardware testing, the following points are checked:

  • Correct LEDs operation (visual inspection);
  • Correct initialization of the SI5351;
  • Correct initialization of the serial connection with the GPS module;
  • Correct synchronization of GPS data;

Example of hardware testing:
image
image

Documentation changes

Removed information about logging device actions through the use of "Serial Monitor" in the Arduino IDE. This functionality is no longer present in the firmware.

Added information about the LED indication for issues occurring during hardware initialization.

Added information about QTH locator calculation.

Added information about the firmware for testing the hardware to the firmware instructions.