Tuesday 20 December 2016

BASIC Tech Group - MyNews 9 - New WSPR sketch 40m

Finished the coding of a new WSPR sketch, based on the WsprMessage.h library written by John Newcombe and used and published by M0XPD.

I built this into a library module that can be included in the Arduino sketch. This sketch uses the LCD display routines of my previous WSPR program, but is simplified as it has a fixed repeat interval for transmission of 2sec and a fixed frequency of 7040.1kHz (the previous sketch allowed a Rotary Encoder input to change the frequency and the repeat interval - an upgrade would be easy to do to implement these features).

IMG 3006

Photo shows the 2 shield stack on top of the Arduino UNO, the DDS and a LPF shield

As usual there is an option to define the LCD I2C address as some displays use 0x27 while others use 0x3F.

The system timing is provide by an RTC (DS3231) module on the Si5351 DDS shield. This can be set by a separate Arduino sketch (at the bottom below) to the correct time, which must be good to 1second.

The code to transmit is also hard coded into the sketch, in my case it is currently "M6KWH IO92 20". The WsprMessage.h library encodes this into 162 elements of value 0, 1, 2 or 3 in the array WSPR_Message{ ].

The WSPR system has a 4 level FSK modulation, with frequencies spaced by 1.4548Hz! This is trick to do, and what this sketch does is to define a frequency shift for each element in an array delta[ ]. The data is the frequency shift of each element to the nearest cHz (0.01Hz) as this is the resolution that can be generated by the Si5351 and the si5351.h library. All frequencies are defined for this library in cHz. So, for example, the variable WSPRFreq = 7040.1kHz is 704010000cHz. All frequency variables are uint64_t size.

The newer LiquidCrystal_I2C.h library is used (from HobbyComponents.com) which has a different set of calls, in particular the initialisation is done with lcd.begin(), not the previous library call lcd.init(). And the new si5351.h library is also used which changed some of the calls to program the SI5351 chip. If you are going to use this code, make sure you Google and use the new version of the libraries.

I have put a Zip file of all these libraries here.

Download the code for WSPR and for RTC time setting

WSPR_40M-Basic

RTCSET-Basic

No comments: