Continuing education

PIC projects

Shortwave radio

Broadcast radio

High voltage



AD9850 Signal Generator

It looks like that with the proliferation of cheap Chinese AD9850 modules, pages describing various gadgets based on them are popping up everywhere. Like all the other hams, I came across mine on eBay. Looks like the modules are being sold and shipped from China for less than $5. That’s cheaper than you can buy the 9850 chip by itself here in the States! Without any research whatsoever I went ahead and ordered three. I was little apprehensive at first but about two and half weeks later my stuff arrived.

The module is kind of nice, all the fine soldering has already been done, there is a 125MHz CAN oscillator, an LC filter and all the AD9850 pins have been routed out to the edge of the board for easy access. Overall a pretty impressive little board. On the negative side, I would mention the somewhat shoddy workmanship of the module. But they do work!

In order to make it into a signal generator, one simply needs to add an LCD, rotary encoder and a microcontroller to manage it all. You can read about my hardware implementation and a program for the MCU below.

As with almost all of my projects, there are many ways to accomplish the same task. The way I did it here should be viewed as one option, not the only way. Use whatever tools, methods, and materials make sense to you. If you follow my schematic, you can download a copy of my HEX here.

To finalize the project I could have purchased one of these encoders from Newark but that wouldn't be in my DIY spirit. I wanted something I could always find in my junk box. There are quite a few of schematics floating around the Net using stepper motors mainly from old 5 1/4" floppy drives but I wanted something smaller and lighter, after all I want to take the finished signal generator to the field with me. As a result of some thinking and tinkering (maybe not necessarily in that order), the schematic below came into being. Here I'm using a small Mitsumi M35SP-11NK bipolar stepper motor as a source for Gray code. I belive the motor came from a junked Brother laser printer but this is not 100% certain. A small amount of current (established by R1 and R12) ensures the "cogging" or "stepping" feel of the factory encoder. It also helps to increase the generated pulses when the shaft is rotated. These appear in test points A and B and are further digitized by their respective halves of the LM393 comparator. Diodes D1 and D2 stop the "flyback" pulses and "ringing" that otherwise would cause false impulses. I found that introducing a small hysteresis (resistors pairs R6, R5 and R10, R9) dramatically improves the output waveforms. Potentiometer R7 establishes the necessary bias point for the comparators. This depends on the motor used.

Here's one of my attempts to present some mechanical drawings as well. The dimensions shown here are obviously not mandatory, should you, my reader, to try to duplicate this project. Therefore, take it what it is, it's just my attempt to master another software. I used a FrontDesigner 3.0 utility to draw the picture below.

The LCD is in the center, taking up most of the front panel space. To the left of it, I placed the power switch along with it's indicator. The encoder knob is at the same height as the LCD. This way two of the largest objects don't seem misaligned, that's what I was taught in school. The UP and DOWN buttons are right under the encoder knob, within the reach, so one does not have to move the hand while adjusting the output frequency.



Construction (how I did it)

Here's a view of my super high-tech programming test bed. You could get a nice factory made one, such as this one from Mikroelektronika, but they tend to be expensive. Mine is basically a large and rather heavy piece of 1" thick plywood. With many a project, the trouble is, if you forget and tug on anything, everything starts moving around and possibly creates a short. The only remedy is tying everything down. All my modules here are either mounted on the plywood or rubber-banded to it. The piece of breadboard on the left is the MCU module. The LCD is right behind it. Both are temporarily fastened to the plywood base using plastic standoffs and short wood screws. By the way, when you click on any picture in this article, you can see an enlarged version of it.

Turned out that my junk box backlight LCD likes to draw quite a bit of current, 70 mA to be exact. I didn't have another one with less current consumption so to ensure that the LM7805 regulator on the MCU board doesn't overheat, I temporarily bolted it to a large heatsink. In a final boxed version the regulator will mount on the aluminum back wall of the project box. The white eraser under the heatsink keeps the 7805 legs from bending. The box with the translucent cover to the right is a clone of Microchip's PICkit 2 programmer. Low and behold, it's implemented exactly the same way, on a piece of RadioShack breadboard and in a wooden box. As you can see, nothing is amiss from my super high-tech test bed.

Behind the plywood, even though they have no connection to this particular project, there are a number of donated receiving tubes. At the time of taking this photo I was searching and downloading their respective datasheets. Maybe one day I will have time for another tube project so stay tuned ...

It seems that whenever I design a circuit there is never a suitably sized box for it. Maybe it's a Murphy's Law or something. Or if there is, it's unattractively priced. For a frugal soul like me buying them each time is not an option. Here's already my box, roughly three quarters finished. I used what was on hand; that's right, plywood again. The base is 1/2", the front and sides are cut out of 1/8" birch plywood. Before clamping everything together, all pieces get a dab of ordinary wood glue. After a few hours of drying the box is ready. I used the same 1/8" thickness plywood for the top as well. To make the enclosure RF-proof, I simply glued ordinary kitchen aluminum foil all over the inside of the box, overlapping the seams. I have been doing this with many of my enclosures and the results have been consistently good.

Top view of almost assembled device, with battery already installed and all. I decided to house the AD9850 module in a separate shield. It the picture, it's the shiny object to the left of the MCU module. To make the DDS enclosure, I simply cut it out of an empty coffee tin and soldered the sides together in few places.

Even though I thought I had planned the project box large enough, after I put the battery in, it was still like an average Manhattan apartment, not enough room for anything. They say in order to live in Manhattan you have to be either really rich or really small. I didn't want to start making another box so I mounted the AD9850 module vertically. As a result, the battery has now sufficient room and the connections to the MCU board became really short. In New York City real estate lingo I "built up".

Another shot from the top, from a different angle. The AD9850 module shield can be better seen. To make the whole construction more rigid, the module is mounted on an aluminum angle right next to the MCU board. Also, this shot provides a better view of the power board. It's just two Schottky diodes that separate wall wart and the internal battery and allow the generator to be independently powered. This board does not appear on the main schematic above but I believe its internal workings are pretty obvious.

A view from the back. The back panel is from 220x90 mm 12 gauge aluminum sheet, painted black for better heat conductivity as well as for esthetics. There are cutouts for a USB socket, RF SMA plug and a power jack. I decided that it would be nice to have an extra option of powering my generator from an outside source. In this application, almost any 12V to 15V DC wall wart will do.

Here's what the backlighted LCD looks like in the dark. One can easily read out the frequency and step settings. The power LED in the photo really seems to stand out but it's only photographic illusion. On the real device the LED is nowhere near as bright.


Performance check

This is what the 7.04 MHz output looks like on the scope. Here it's working into 2K resistor, NOT the usual 50 Ohms. I did it on purpose because I wanted to see how "hairy" it gets when working into high impedance load. If you look closely you can make out aliased images riding on the fundamental frequency. On the 40 meters they are not too bad, though. The scope does have a frequency counter built in but it's resolution is nowhere near good. Here the scope thinks the output frequency is 7.016 MHz whereas in reality it was spot on, 7.04 MHz.

Also the output level here is much lower because of the impedance mismatch.

Here I observe 20 MHz. Notice the increased level of aliases relative to the fundamental frequency. And the scope is off again as far as the frequency is concerned. In reality the output frequency, measured on a counter, was 20,000,024 Hz.

Output measurement again but this time with a more serious player, an Instek GSP-327 Spectrum Analyzer. The DUT is set to output 7.04 Mhz and the SA is swept from 5 MHz to 37 Mhz. There are three clear spikes. The first one is the main frequency. It's 3.2 dB down from the 1 mW reference line which is roughly 0.5 mW out into a 50 Ohm load. That's the good part. The next two spikes are the not-so-good part. The second and the third harmonics are fully present, but luckily they are both 36 dB down from the carrier level. If the carrier was half the milliwatt then the spurs work out to about 125 nW (nanowatts) each. Not too bad for a home made device. And the fourth harmonics is indistinguishable from the noise floor. For a test, I swept the SA up 100 MHz but there was nothing there so I'm including the screen shot.

One strange thing to note, though. The EagleShot software that I used to transfer the screen captures from the analyzer to the PC, looses the marker numbering. On the SA screen, there was a corresponding marker above each spike, nicely put in a tiny circle. And on the analyzer screen, all the markers are shown on the top right. On the screen capture, however, the marker data has migrated down and now appears left below. Why that is, I don't know.

More spectrum analyzer screen shots, taken with different sweep settings.


Hope you enjoyed my build of this useful test device. As always, if you have any suggestions or advice, please go to the feedback page and drop me a line. I'll be happy to hear from you!

Happy generating, 73 de Brian.