© 2001 QRP2001 Design Team

Flexible DDS VFO Controller


In theory, either of the DDS-based VFOs described elsewhere in this site could be controlled by discrete logic. However, a simple microprocessor control board is easier to implement and more flexible. The control board described here was developed specifically for the QRP2001, and supports both of our DDS-based VFOs. However, the same controller could be used (with very minor firmware changes) on a wide variety of other designs. If anyone is interested in using this design with a different VFO then we would be very interested to hear from you, and happy to help with any necessary firmware changes.

As with the older QRP2000 design, this board uses a PIC microcontroller, but we have adopted a much bigger member of the PIC family here to allow greater functionality. The PIC16F877 is a 40-pin device which means that we can dispense with the earlier latches and just connect everything directly to the PIC. This reduces the parts count and still leaves us with more I/O lines than before.

An (optional) RS232 serial interface allows the QRP2001 to be controlled from a PC. The control protocol is very rudimentary at present, but will be expanded in future if there is any interest in that particular feature.

In fact the PIC, a MAX232 for the serial interface, and a handful of support components are all that there is on the control board. A rotary encoder, keypad and LCD display module need to be connected to provide the 'user interface' - these could be mounted directly on the control board but in our prototype they were mounted on the front panel and connected back to the control board by ribbon cable.

The circuit diagram shows just how simple this circuit is. Here's a picture of the first prototype. It was built on Veroboard but the wiring looks cluttered because the design evolved quite a lot along the way. Veroboard works just fine for this circuit, and we're sure that you could easily make a much neater layout. The picture clearly shows the PIC in the middle of the board, connectors for front panel and band-pass filters to the right, and MAX232, crystal, and leads out to the VFO on the left. The device top-right is the 5v regulator which needs a small heatsink if it is also supplying the backlight for the display.

Since the control board circuit is so simple, we haven't provided a detailed description. The rotary encoder (aka tuning knob), LCD display and keypad connect directly to the PIC. Similarly, the band selection outputs for optional pre-selection filters on the RX input (and also to select the correct low-pass filter for the soon-to-be-announced transmit stage) are driven directly by the PIC. There are also a few other control outputs, such as the sideband selection line which are again taken directly from the PIC. All of this is made possible by the excellent drive and tri-state capabilities of the PIC I/O pins.

The rotary encoder which we use for the main tuning control is a very cheap Bournes mechanical encoder which has 24 positions per revolution, with a click-stop at each position. However, we want a lot more than 24 tuning steps per revolution, so we take advantage of all 4 signal transitions which the output lines go through on each 'click'. This allows us to achieve 96 steps per revolution from a cheap encoder. The catch is that you have to 'de-click' the encoder to get rid of the detents, and the way that you do that is detailed here.

The only slight complication in the hardware is that a few PIC pins have to perform two functions. Despite having about 30 I/O pins to play with, we still ran short. (This proves the old adage that the requirement grows to fill the capacity...and then a bit more.) In some cases lines act as outputs to two devices: this is easily managed by ensuring that only one of those devices is enabled at a time. RA2 is an example of this, since it controls one of the LCD signals and one of the keypad output lines, but at any given instant only one of these is enabled. Other lines act as both input and output: RB2 is both an output to the LCD and an input from the keypad. By connecting the keypad line via a resistor, the PIC can override the logic level from the keypad and hence still control the LCD correctly. However, we tri-state the RB2 pin when polling for keypad input so that the keypad can now dictate the signal level.

It's probably worth pointing out at this stage that minor changes to the control board and its firmware are still occuring from time to time. You may already have noticed that some I/O lines are 'jumbled up' in terms of which devices connect to which pins: this reflects the rather evolutionary way in which the design came about. In future it may be worth tidying this up. Also, there might be some very minor changes to the I/O line usage to accomodate the TX exciter when it is finished. You can always stick with an older revision design if you want, but since you will probably build this circuit on Veroboard, it shouldn't be much of a hardship to incorporate such improvements.

The external connections to the control board are as follows:

JP2 is band selection for input or output filters:
Pin 1 = 160m band selection
Pin 2 = 80m band selection
Pin 3 = 40m band selection
Pin 4 = 30m band selection
Pin 5 = 20m band selection
Pin 6 = 17m band selection
Pin 7 = 15m band selection
Pin 8 = 12m band selection
Pin 9 = 10m band selection
Pin 10 = General coverage selection

JP3 are the control signals to the VFO:
Pin 1 = DDS freq. update
Pin 2 = DDS data
Pin 3 = DDS clock
Pin 4 = Ground
Pin 5 = Octave select, least significant bit (PLL VFO only)
Pin 6 = Octave select
Pin 7 = Octave select, most significant bit (PLL VFO only)

JP7 carries miscellaneous control lines:
Pin 1 = CW/SSB mode, high = CW mode
Pin 2 = USB/LSB mode, high = USB mode
Pin 3 = Unused
Pin 4 = Unused
Pin 5 = Signal strength (i.e. S Meter) analog input

JP8 enables in-circuit re-programming of the microcontroller
We will provide more information on this feature if anyone is interested!

JP10 provides the optional serial connection to a PC:
Pin 1 = Transmit data from control board
Pin 2 = Receive data from PC
Pin 3 = Ground

JP11 connects to the rotary encoder:
Pin 1 = Left-hand connection of encoder
Pin 2 = Right-hand connection of encoder
Pin 3 = Middle connection of encoder
(Normally JP13 would be shorted and JP12 left open-circuit.

JP14 is power in. Rather obviously:
Pin 1 = +12V (in fact, +8V to +20V)
Pin 2 = 0V

All of the real complexity in this design is buried within the firmware. Under control of the firmware the PIC is monitoring and responding to commands from the rotary encoder, keypad, serial interface and analog signal strength input, and controlling not just the synthesiser but also the LCD display, filter selection outputs and various miscellaneous control lines. A full description of the controller functionality is available here.

Depending on the level of interest, we plan to make pre-programmed PIC processors available. However, for those who wish to amend the firmware, or are just interested, here is the source code. The firmware can be built using tools which are freely available on the Microchip web site, and can be programmed into the PIC16F877 without even unplugging it from the control board. Again, if enough people are interested we will provide instructions on how to do this.

If you do make any changes to the source code, we would be very keen to hear about it. You will probably also want to perform a reasonably thorough test of your amended firmware. With that in mind, here's the test plan which we use to regression-test minor changes to the firmware.

We have also implemented a rudimentary PC application to drive the control board, and hence your radio, from a PC. However, it is written in Java, and at the moment the installation process is not particularly straight forward. As usual, if anyone expresses interest in this software, we'll make full details available.