Sunday, 21 April 2013

Analog Nostalgia

Having sold my soul to the devil (as some would see it) by playing with a digital synthesized VFO (Blogs passim), I decided it would be fun to take a walk down memory lane and look at a traditional (Colpitts) VFO.

I still wanted to keep things under the control of the Arduino (or a similar micro-controller), so I looked at varying the frequency of a conventional SA612-based oscillator using a varicap diode.

Here's my basic scheme, which contains no novelty...

I started by making the oscillator sans varicap and soon was strolling down memory lane and meeting drift, temperature sensitivity and all the other quirks that make analog such fun! I could easily control the frequency of the oscillator by deriving a control voltage from a pot - so I was ready for the next step...

I made a controllable voltage source on the Arduino, using the same LCD display and rotary encoder interface that formed the basis of the simple DDS-based VFO. Instead of controlling a DDS, I now generated "d.c." voltages using PWM methods with the inbuilt "Analog Write" function. This voltage was fed to the control input of the system above.

It wasn't a great success, for two reasons...

Firstly, the analogWrite function accepts an 8-bit argument, giving only 256 different voltages on the output - this isn't really enough to give both range and resolution in a VFO.

Secondly - and more of a show stopper - the PWM signal was very difficult to smooth to a d.c. value, suitable for driving the varicap diode. To try to make things easier, I upped the PWM rate from Arduino's standard, pathetic 490Hz to 32 kHz, to give the low-pass filter more "room" to isolate the non-zero frequency components from the wanted d.c. component. I also experimented with various types of low-pass filter (as shown in the rectangular box in the schematic above) but got bored (especially as the 256 control levels wasn't enough) and jumped ship on PWM. It might be good enough for motor speed applications, but that's about it!

Fortunately, the junk box offered up a 12-bit DAC (a Microchip MCP4922), which has an SPI interface. There is an Arduino SPI library - but it uses pins I had already assigned to my (parallel) Hitachi LCD interface. It was easier to write some bit-banging SPI code to get the MCP4922 putting out REAL d.c. than to re-work the LCD (by pulling out wires and re-assigning pins).

Here's the complete system on the bench...

   

The oscillator is seen at top right, with the control voltage arriving on the white crocodile clip. This is generated by the MCP4922 nestling in the little solderless breadboard, under the control of the Arduino.

The display tells me what's going on - translation between the 12-bit numeric code and the actual voltage is just a linear scaling exercise.

Now, with clean d.c. control voltages, the VFO is running as sweetly with digital input from the Arduino as it did with control voltage derived from a pot. Only there is all the flexibility conferred by the digital system. I could, for example, now make an Arduino-based CW transceiver without the DDS module - with all the frequency offsets and incremental tuning etc under digital control.

I could also wear a hair shirt, become a vegetarian and subject myself to other mortifications.

No thanks - I'm happy with the DDS.

QED

 ...-.- de m0xpd

1 comment:

  1. Reading the current number of RadCom, it appears that Eamon, ea9gq, feels the same way I do about the DDS. He says...
    "The stability and accuracy of the crystal controlled DDS is just too attractive to ignore"
    QED indeed!

    ReplyDelete