New L6470 Stepper motor controller board in progress.

boardimage

Coming soon

4 Channels L6470

USB interface (micro USB)
8 MHz oscillator for L6470 and PIC microcontroller (PIC24FJ64GB002)
Header for external SPI interface if using Arduino or different microcontroller board.
Headers for step and direction interface, for microcontroller or parallel port PC interface.

 UPDATE

I haven’t worked on this since October 2, 2013 (and it’s now January 21, 2014) so I’m uploading the Eagle [6] design files for you to use as you see fit. If you actually build this board I would love to see how it comes out!

NOTE: I have NOT tested this board design but I believe it works. I am a professional but that doesn’t mean my work is flawless.

 EAGLE files for this board

DDS Board Revision 2

Recently I created revision 2 of my DDS board:

2013-09-19 14.32.40

The board is basically the same as the last one I wrote about.

On this board I used Mini-Circuits filter modules instead of my homebrew RLC filters. They offer better high frequency performance than I could achieve on my own. Here’s a plot of the filter response, as tested with my VNWA:

dds_plugin_filter_response

 

The filters allow a usable output from about 40 MHz to 110 MHz. By bypassing the high-pass filter, I can get a usable output from near-DC to 110 MHz.

 

This board is part of a much larger project. You might have noticed that one PCB is stacked onto the other PCB. The board on the left is a module that will be plugged into a large VME board. The purpose of building the right-side board was to test the module.

USB Interface and control

I’ve done several USB projects, starting back when I worked at Embed Inc. I decided it would be fun to make this a USB controlled board. The microcontroller is a PIC24FJ128GB106 from Microchip. It has a high-speed USB interface. Microchip provides sample code for various interface methods.

I chose to make this a CDC (Character Device Class) because it makes writing the PC software easier. A CDC device presents itself as a VCP (Virtual COM Port) on Windows, and I believe on Linux as well. This means I don’t have to write a device driver or utilize WinUSB or Libusb in order to communicate with the hardware.

I started out with a basic MFC program that I had written to query a laser over it’s diagnostics port, and modified it to control my PIC firmware that, in turn, controls the AD9852. The program is very basic at this point, but the structure now exists to do just about anything with it. I’m not personally invested in amateur radio, but I imagine this could be interesting for creating directly-modulated RF carriers. This board can directly output an RF signal that is amplitude, frequency, on-off, or phase keyed.

dds_prog

In my free time I am working on another version of this board that I may make available to the community. Please leave a comment if you’re interested.

 

 

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:

filter_response

 

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.

output_response

 

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.

 

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:

#!/usr/bin/python
x=0.0
y=0.0
pins=24
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:

EDIT TSSOP_24.pac
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=”http://pastebin.com/embed_iframe.php?i=2RqWXs83″ style=”border:none;width:100%”][/iframe]

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

$ ~/bin/csv2model.py 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)

and:

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):

PIN,NAME
1,1OEBY
2,1A
3,1Y
4,GND
5,2A
6,2Y
7,VCC
8,!2OEBY
9,3A1
10,GND
11,LE
12,3A2
13,3A3
14,OE
15,GND

 

 


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

#!/usr/bin/python
# 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:
 x=xstart
 for col in cols:
 print 'SMD ' + str(padsize) + ' ' + str(padsize) + ' -100 \'' + row + col + '\' (' + str(x) +' ' + str(y) + ');'
 x=x+pitch
 y=y-pitch
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\
CHANGE FONT VECTOR (0 0); \n\
'

[iframe src=”http://pastebin.com/embed_iframe.php?i=0RSLWxWM” style=”border:none;width:100%”][/iframe]

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

[iframe src=”http://pastebin.com/embed_iframe.php?i=VMTYQPnK” 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 eagle.bom.pl 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.