First look was a little disappointing because, whilst I had recently satisfied myself that the DDS modules can have their frequencies changed very quickly, (in fact, I showed that the Arduino Due was capable of changing the frequency of an AD9850 in 9 microseconds ) the humbler Arduinos turned out to be rather slower. Specifically, I found that a simple loop of code involving just writing a frequency to the DDS and incrementing the frequency value itself took 950 microseconds (Arduino MEGA + Soft SPI interface to AD9850). This was imposing a surprisingly low “sample rate” on my plans for a digital “Wobbulator” before I’d even got started.
I wanted to be able to measure the response of crystal filters – so I needed a filter to measure.
I started off with a Spice model, constructed in the wonderful LTSpice package from the good folks at Linear – wonderful not only ‘cos it is FREE but also ‘cos it now works under a simple graphical interface (not like the bad old days!!).
Here’s the trivial filter 8MHz I threw together in LTSpice...
and here’s its predicted (ideal) response...
I made up a version of the filter on a scrap of PCB material...
I made sure the practical filter was working by driving it with signals from the “Kanga” VFO, which showed me that its passband was actually between 8 and 8.002 MHz.
I was driving the filter directly from the AD9850 DDS module (knowing it to have a 100 Ohm source impedance - which was not too bad a match for the input impedance of the filter) and monitoring the response on the 'scope (with a 50 Ohm termination - see below).
Then I turned my attention to writing the sweep generator code...
I was driving the filter directly from the AD9850 DDS module (knowing it to have a 100 Ohm source impedance - which was not too bad a match for the input impedance of the filter) and monitoring the response on the 'scope (with a 50 Ohm termination - see below).
Then I turned my attention to writing the sweep generator code...
I set up two constants, fStart and fEnd, representing the beginning and end of the sweep. Then I simply stepped up a frequency variable, f, in equal increments, fStep, starting from fStart, until I reached fEnd. At each step, I waited T microseconds (plus the extra 950 or so microseconds the system forced me to wait).
Oh yes - I was also making it easy on myself by using my own DDS library's setFrequency() command.
That’s all there was to it...
Oh yes - I was also making it easy on myself by using my own DDS library's setFrequency() command.
That’s all there was to it...
I added a trigger pulse at the beginning to let my ‘scope know when to start. And a gate pulse to let me know when the measurement was valid (etc). I could (and did) add any number of other refinements and diagnostic extras – but the bare bones are as described above.
The results are seen below...
What is seen above is the frequency axis horizontally and the magnitude response vertically. It is a photograph of the screen of my digital storage scope on a “single shot” trigger. I have manually set the vertical cursors to correspond to the limits of the gate pulse, corresponding to the start and End frequencies (which, in this case, were 7.995 and 8.005 MHz).
This might be easier to understand with a little annotation...
Here, I’ve added a frequency scale (just by interpolating between the start and end points) and I’ve drawn in a (linear) magnitude frequency response curve – by joining the dots! You can see that the passband is confirmed to lie between 8 and 8.002 MHz - just as I had established earlier by "conventional" testing.
Being a good boy, I had the filter loaded by a 50 Ohm terminator at the ‘scope input – if you remove that, you get the expected huge increase in voltage levels – but notice how the shape of the filter changes significantly...
It is important that we make measurements of our filters in realistic loading conditions if we want to avoid deluding ourselves!
You saw in my LTSpice model (above) that I used a 50 Ohm source and load resistor with the filter. I made a MATLAB model of the filter (using my own Two Port methods) and looked at the input impedance, which I found closer to 200 Ohms. Sure enough, the response of the "ideal" filter is "cleaner" if it is operated in a 200 Ohm environment - but I didn't get round to that level of detail yet.
Now I have a viable RF Sweep Generator - let's see what we can do with it.
...-.- de m0xpd