All posts by martin

DDS Board testing



I mentioned that I was building a DDS (Direct Digital Synthesis) board for work. Here’s the result:


2013-04-11 09.34.43


Yes that’s a giant block of aluminum that it’s attached to. It keeps the board from sliding around with all those cables attached to it.

It seems to work quite well. The first thing I tested was the bandpass filter. I designed it to have a center of 100 MHz and a bandwidth of 80 MHz. What do you know? Sometimes things work out:



That looks pretty decent to me, but I’m not an RF expert.

Now a chart of the output with the MMIC fully powered up. The AD9852 is being clocked at 260 MHz instead of the desired 300 MHz (for a reason I’ll describe below.) The AD9852 is programmed to output a fundamental frequency of 100 MHz in this test.



I thought I had a screen shot zoomed in on the 100 MHz peak, alas I do not. The noise floor when zoomed in is much better than the spectrum analyzer shows in the above plot (I promise.)

I had to run the AD9852 at 260 MHz carrier instead of 300 MHz because the LMK03001C chip I am using cannot output a 300 MHz clock, given a frequency of 20 MHz. The PLL configuration for the LMK03001C is very flexible, just not quite enough for this. For the next board I am switching to the LMK03000C which has a slightly different VCO. It’ll work.

This synthesizer was a test for my next big project: a huge VME bus board that has 4 AD9852 channels on it. I’m proud to say that this test succeeded.

USB DDS board in progress

I’m working on a USB DDS (direct digital synthesis) board that will be a plug-in module for another application. Here’s a block diagram:

It has a few interesting features that I thought others might be interested in:


– AD9852 direct digital synthesis IC with 300 MHz adder, 48 bit accumulator, and digital inverse sinc filter
– A fairly powerful microcontroller with full speed USB
– A low jitter clock synthesizer PLL: LMK03001C
– An MCP3553 22 bit A/D converter
– Gain block chip from Mini Circuits: GALI-74+
– 6 layer PCB construction for excellent ground and VDD planes

These features should give this board possibilities in amateur radio and perhaps homebrew instrumentation. Changing the filter components could allow usage from very low frequencies up to around 125 MHz.

Utilizing upper frequency images would give you usable range into 500 MHz or possibly a bit more depending on how good the RF layout is. The PCB is FR4 and uses standard 0603/0805 discrete parts, so it probably won’t give usable signals into the microwave region.

I’ll share more once I have the schematic done.


Mapping Google Drive or Dropbox to a drive letter

So you’re on Windows and want to use Dropbox or Google Drive with it’s own drive letter?

Step 1:
First figure out where your Dropbox or Google Drive folder is stored. Go to ‘Computer’ and right click on Dropbox or Google Drive and copy the whole path name that is in the text field labeled Target. Mine happens to be:
“E:\googledrive\Google Drive”

But yours is probably something like:
“C:\Users\Martin\Google Drive”

Make sure you copy the quotes too.

Step 2:
Run notepad and put one line in the new file. Replace the path with the one you found in step 1.

Now, save this file on your Desktop as a file named: drive letter.bat

Close notepad.

Step 3:
Double-click the file you just saved. You should have a new drive called G:
If not, you did something wrong.

Step 4:
Drag this batch file (drive letter.bat) to the start menu, and put it in:
Start->All Programs->Startup

It’ll start up every time you login to your computer, and if everything went right you’ll always have a drive G:


Using Python scripts to create Eagle parts

I dread creating part models in Eagle – it’s time consuming and error prone.

Over the years I have used scripting languages to help with the tedious work. It’s quite easy to create basic part footprint algorithms given the mechanical drawing. Much more tedious would be drawing a picture on graph paper and using your calculator.

If you’ve ever made a circuit board and made a very basic error that caused you to have to remanufacture your board, you’ll understand the value of getting it right the first time around.

Take this extremely simple script for example:

print 'EDIT TSSOP_' + str(pins) + '.pac'
for p in range(1, pins/2+1):
 x = (p-1)*0.5
 y = -4.15
 print 'SMD 0.27 1.0 \'' + str(p) + '\' (' + str(x) +' ' + str(y) + ');'
 print 'SMD 0.27 1.0 \'' + str(pins+1-p) + '\' (' + str(x) +' ' + str(-y) + ');'

You could really write this in any language and it would be about the same length. There’s no reason it has to be done in Python. The value is in what it prints out:

SMD 0.27 1.0 '1' (0.0 -4.15);
SMD 0.27 1.0 '24' (0.0 4.15);
SMD 0.27 1.0 '2' (0.5 -4.15);
SMD 0.27 1.0 '23' (0.5 4.15);
SMD 0.27 1.0 '3' (1.0 -4.15);
SMD 0.27 1.0 '22' (1.0 4.15);
SMD 0.27 1.0 '4' (1.5 -4.15);
SMD 0.27 1.0 '21' (1.5 4.15);
SMD 0.27 1.0 '5' (2.0 -4.15);
SMD 0.27 1.0 '20' (2.0 4.15);
SMD 0.27 1.0 '6' (2.5 -4.15);
SMD 0.27 1.0 '19' (2.5 4.15);
SMD 0.27 1.0 '7' (3.0 -4.15);
SMD 0.27 1.0 '18' (3.0 4.15);
SMD 0.27 1.0 '8' (3.5 -4.15);
SMD 0.27 1.0 '17' (3.5 4.15);
SMD 0.27 1.0 '9' (4.0 -4.15);
SMD 0.27 1.0 '16' (4.0 4.15);
SMD 0.27 1.0 '10' (4.5 -4.15);
SMD 0.27 1.0 '15' (4.5 4.15);
SMD 0.27 1.0 '11' (5.0 -4.15);
SMD 0.27 1.0 '14' (5.0 4.15);
SMD 0.27 1.0 '12' (5.5 -4.15);
SMD 0.27 1.0 '13' (5.5 4.15);

If you open up the EAGLE Library editor and paste this script into the command console, you get this:

Not a bad start.

The same technique applies for much larger parts. Imagine how much time you’ll save when you’re creating a part model for a 256+ ball grid array?

I must say I don’t claim to be an expert Python coder – I have my own specialties and I’m really a low-level embedded systems guy. If you need a turn-key shoe-phone (that’s a joke) or a radio watch (if you don’t get the joke you’re too young) or an accelerometer based movement tracker with 6 months battery life, I’m your man.

I’m just rambling – back on topic: there’s another script I wrote that you can access via pastebin (click “see original”)
[iframe src=”″ style=”border:none;width:100%”][/iframe]

This script takes a CSV file and a model name as command line options, i.e:

$ ~/bin/ sn74.csv sn74vme22501a

And produces helpful Eagle SCR data that you can call from Eagle to make a schematic symbol, and also to CONNECT the schematic part model PINs to the physical layout PADs. i.e:

EDIT sn74vme22501a.sym;
PIN '1OEBY' Short (0 0.0)
PIN '1A' Short (0 -0.1)
PIN '1Y' Short (0 -0.2)
PIN 'GND' Short (0 -0.3)
PIN '2A' Short (0 -0.4)
PIN '2Y' Short (0 -0.5)
PIN 'VCC' Short (0 -0.6)
PIN '!2OEBY' Short (0 -0.7)
PIN '3A1' Short (0 -0.8)
PIN 'GND_2' Short (0 -0.9)
PIN 'LE' Short (0 -1.0)
PIN '3A2' Short (0 -1.1)
PIN '3A3' Short (0 -1.2)
PIN 'OE' Short (0 -1.3)
PIN 'GND_3' Short (0 -1.4)


CONNECT sn74vme22501a.1OEBY 1;
CONNECT sn74vme22501a.1A 2;
CONNECT sn74vme22501a.1Y 3;
CONNECT sn74vme22501a.GND 4;
CONNECT sn74vme22501a.2A 5;
CONNECT sn74vme22501a.2Y 6;
CONNECT sn74vme22501a.VCC 7;
CONNECT sn74vme22501a.!2OEBY 8;
CONNECT sn74vme22501a.3A1 9;
CONNECT sn74vme22501a.GND_2 10;
CONNECT sn74vme22501a.LE 11;
CONNECT sn74vme22501a.3A2 12;
CONNECT sn74vme22501a.3A3 13;
CONNECT sn74vme22501a.OE 14;
CONNECT sn74vme22501a.GND_3 15;

The CSV file contains (partially):




Here’s another script I generated for the FT256 / FTG256 package which is used by some Xilinx FPGAs:

# Create BGA SCR for Eagle 5.x
print 'GRID MM;'
rows = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'T']
cols = ['1', '2', '3', '4', '5', '6', '7', '8', '9' ,'10', '11', '12', '13', '14', '15', '16']
nrows = 16
ncols = 16
pitch = 1.0 # ball spacing in millimeters
padsize = 0.4 # SMD pad size in millimeters
xstart = -(nrows - 1) / 2.0
ystart = (ncols - 1) / 2.0
x = xstart
y = ystart
for row in rows:
 for col in cols:
 print 'SMD ' + str(padsize) + ' ' + str(padsize) + ' -100 \'' + row + col + '\' (' + str(x) +' ' + str(y) + ');'
print 'LAYER 21;' #tplace
print 'WIRE .254MM (' + str(x) + ' ' + str(y) + ') (' + str(-x) + ' ' + str(y) + '); '
print 'WIRE .254MM (' + str(-x) + ' ' + str(y) + ') (' + str(-x) + ' ' + str(-y) + '); '
print 'WIRE .254MM (' + str(-x) + ' ' + str(-y) + ') (' + str(x) + ' ' + str(-y) + '); '
print 'WIRE .254MM (' + str(x) + ' ' + str(-y) + ') (' + str(x) + ' ' + str(y) + '); '
print 'LAYER 25; \n\
TEXT \'>NAME\' ('+ str(-x) +' '+ str(-y+.5) +'); \n\
CHANGE SIZE 0.05IN ('+ str(-x) +' '+ str(-y+.5) +'); \n\
CHANGE RATIO 20% ('+ str(-x) +' '+ str(-y+.5) +'); \n\
CHANGE FONT VECTOR ('+ str(-x) +' '+ str(-y+.5) +'); \n\
LAYER 27; \n\
TEXT \'>VALUE\' ('+ str(-x) +' '+ str(-y+2.5) +'); \n\
CHANGE SIZE 0.05IN ('+ str(-x) +' '+ str(-y+2.5) +');\n\
CHANGE RATIO 20% ('+ str(-x) +' '+ str(-y+2.5) +'); \n\
CHANGE FONT VECTOR ('+ str(-x) +' '+ str(-y+2.5) +');\n\
LAYER 51; \n\
TEXT \'>NAME\' (0 0); \n\
CHANGE SIZE 0.03IN (0 0); \n\
CHANGE RATIO 10% (0 0); \n\

[iframe src=”” style=”border:none;width:100%”][/iframe]

And here’s what it produces, which can be run right in the Eagle Library editor:

[iframe src=”” style=”border:none;width:100%”][/iframe]

Which produces this in Eagle 5.x:


E96 Resistor values

A common annoyance I have is that I’ll design a gadget: make the schematic, figure out how big the board can be, design the board – all of these so far are creative tasks requiring ┬ásome skilled input as to the technical details.

Then you order the board (a task let’s set aside for now)

Then you have to make a bill of materials and order parts. The most annoying, time consuming part of designing hardware.

I use Eagle from Cadsoft, so my answers may not apply to you. Is your EDA software a lot better? Let me know, I’d like to hear about it. I’d also be interested to know how much it costs. Eagle is relatively inexpensive when it comes to EDA tools. Industry-standard Mentor Graphics (among others) are many thousands of dollars. That’s just not possible for me.

But back on topic: how do you take your schematic and create a BOM? Well, Eagle has a ULP you can run that will produce a rudimentary BOM (bom.ulp) . It sucks.

I’ve tried to improve it a bit by post-processing the CSV with my own Perl script. I use Cygwin on Windows to run this by the way.

[click here to see the code]

The Perl script is called and it attempts to produce a usable BOM. It tries to combine all of your 1K resistors into one line item, for example.


Now that you have a BOM that doesn’t require two hours of manual formatting to complete, my next problem is that I often have numerous different resistor values that I have to look up at Digi-Key or Mouser (or Newark) and make sure I picked a real value, find the part number, and add it to my spreadsheet.

A partial solution I have is that I made a Python script that will print out all E96 resistor values for Stackpole electronics’ RMCF series. This is very specific, but I’ve picked a manufacturer that literally has thousands of parts at Digi-Key, with millions in stock.

Now that I have a list, I can scroll through and find the one I want, and simply copy and paste the part number into my BOM.

The next step would be integrating this into my BOM script. This will get you started though.

Making table legs

Here it is in gallery form. Click on an image to see a larger version.