The Arduino code presented designed for mainly CW use, is a derivative of the 49er digital vfo program. In this code version, the digital vfo is written with a 9MHz intermediate frequency radio design for the receive chain, while the transmitter chain is designed to use the digital vfo as the transmitter carrier generator, that is to say, while on Rx mode, the digital vfo generates the local oscillator for the 9MHz I.F., but while in the Tx mode, the digital oscillator is placed directly on the output dial frequency, thus the digital vfo is then used as a Tx vfo carrier oscillator simplifying the transmitter design circuit.
I have written the arduino code in this manner to simplify the transmitter design for a CW mode HF radio. While the CW Rx bfo will also need to be constructed, the CW audio tone can then be set to individual preferences by shifting the Rx BFO CW crystal oscillator.
The CW band of operation can be set on any of the HF Ham bands, including either of the LF or MF ham bands. The arduino code will automatically set the correct local oscillator setting of any band with the HF spectrum, from LF to 10metres.
The digital oscillator used is the AD9850 design, found on ebay, while the display used is a 2line 16character version on a TWI or i2c link. The rotary encoder is an optical version using the below circuit as an interface design, connected to pins 2 and 3 of the arduino uno. Ideally as the dial rotates clockwise, the dial frequency should increase, if this is not the case and goes downwards, then reverse the Y and X connection to the arduino to the opposite way around. The CW key is pin 4, active CW key is a low input, while the tx/rx relay is on pin 13, active transmit when pin 13 is a low output, as well as CW keying the pin 13 LED.
I have included a dial step switching circuit to change the vfo step from 10Hz to 100Hz or 1KHz vfo dial increments. The circuit uses a double pole double throw centre off movement switch. While in the centre position, the vfo increments would be 100Hz, in the up position 1KHz and in the down position 10Hz. The switching circuit is connected to the arduino data pins of pin 5 and pin 6, circuit shown below.
The arduino code for the "all HF CW single band digital vfo with 9MHz I.F." is listed below. The updated version listed here has added software to make the 600 pulse per revolution optical rotary encoder easier to operate.:
https://docs.google.com/document/d/1yV8uPdgO0yDr4n8QQnHdMKPlozxiZXUrCNgZ6Rv-15I/edit?usp=sharing
The above link may not perhaps be available, I have found some difficulties for ham to download from my google drive, so I have provided a text download from the download page of my ham radio website "www.radiohamtech.com" so for greater ease.