Wednesday, February 22, 2012

PCB Arrived!

I finished the spiral pocketing operation and also wrote a spiral plunge operation to precede it. I'm starting to get a pretty good idea of how the host software design should be. I've created a "ToolPathBuilder" as a generic operation that I'll make various specific operations from. I've got a RectangularPocket which makes use of a SpiralPlunge:


Here is a test cut in my glue and plaster material:


And cutting the pocket in the RenShape material:


Here is the finished cut:


This will be a junction box for the limit switches. There will be three lines coming in from each side and one from the top.

Ok that was all very exciting. Here's the top news story: I got my PCB board back from Fritzing Fab! It's beautiful:


Definitely click to see the bigger picture. The logo didn't come out quite right, it was supposed to have a circle like the image in the upper left of this blog. Maybe my graphic wasn't quite right. Perhaps it supports objects converted to paths only, rather than a circle. It was just for fun anyway. I tested the pad wiring with my multi-meter on continuity. It looks just fine. I'm going on vacation in a couple of days, so soldering it up will have to wait. Very exciting.


Sunday, February 12, 2012

Area Strategy

I've started rewiring things in preparation for the new control panel board. I don't want to do too much because I'll eventually get to the point where I disable the mill and as soon as I do that, I'll need it to make something. I'd like to test the new board before disabling the mill, and even then I'll do it in such a way that it won't be terribly difficult to restore the current circuitry if the new board has a major problem.

I pulled the limit switches off and rewired them with the new shielded cable I got to fix the noise problems. I need a junction box to connect all the wires in. I have a huge chunk of RenShape from which I thought I'd make the box. The box design is very simple, 2" x 2 1/4" x 1/2" with a large pocket and a few holes coming in from the sides to insert the wires into.

Now I could write a routine to do a rectangular pocket easy enough, even a circular pocket. If you've ever done any Turtle Graphics programming you can see how I'd do it. But eventually I'm going to need to mill pockets in arbitrary shapes. A spiral cutting pattern from inside to out makes for a pretty efficient strategy. To do this I need to create a series polygons inset within the shape. This sort of thing has been done many times by others and there is no need for me to do it again. I spent most of the afternoon looking for a Java library for 2D geometry. The Toxiclibs library I'm doing the 3D work with has 2D functions but I couldn't find an inset (also known as a buffer).

I found the JTS Topology Suite. I imagine JTS stands for Java Topology Suite which means the full name is Java Topology Suite Topology Suite. I suppose it's like saying you are going to get money from the ATM machine. Anyway, I found it fairly easy to get started with the offsets I needed:


The blue line is the area to be machined. I've drawn a line on top of the blue one by creating an outset from the first inset. This gives the rounded corners and helps visualize the area that will actually be cut by the mill. The yellow circle represents the cutting head. I generated insets of a fixed distance until the last inset no longer fully encloses the mill cutter.

It should be easy enough to connect these insets in a spiral shape. I think I'll start with a spiral circle twice the size of the cutting head and plunge into it.

This will give me a generic spiral area function with broad applications. 

[Update #1]

I converted the insets into a spiral path. This wasn't as easy at is seemed because the relative start points of each inset were not aligned. So long as the next inset had the same number of points as the previous inset it was fine, but when the next inset drops a point (from 4 to three in this case) the start point "changed position" and messed up the continuity of the spiral. So I wrote a function to "align" the start points. This turned out to be pretty easy because JTS provides a tool to find the closest points between 2 objects. So the start point of the outer inset was compared to the inner inset to get the closest point. Then I just shifted the points in the sequence by the index of the closest point. Then I connected all the points from inside to outside:




Sunday, February 5, 2012

Micro Stepping

I finished my new board design and sent it off to Fritzing Fab. The turnaround is slow, for sure. They collect many designs and batch them together to reduce costs. This is a 2-sided board with solder mask and silkscreen. It's 2"x4.5" and costs a total of $62. I think that's pretty good. Here it is:


I'm particularly pleased with the logo. Hopefully the design is right, too. I looked it over a bajillion times.

While I'm waiting, I thought I'd do some more testing. I have noticed in some of my previous test runs of the PCB trace that the spindle wasn't ending exactly where it started. Or so it seemed. There is plenty of room in the software stack for error, but I was sure I had run a 50-minute program some time ago that ended exactly right.

One issue that could result in a real movement error (other than software) is stepper motor resonance. I have already worked out some of these issues. I've been using my DRO as the double-check of position. Some of my runs were resulting in significant errors in ending position, like 20-30 milles. I drilled a hole in the starting position, ran a test then chucked my center finder, dropped it into the hole and it all seemed to be pretty good, certainly not off by 20-30 milles.

Then I thought, hey maybe my mill is so fast the DRO is missing steps. I posted an inquiry to the Sherline CNC group to see if anyone had similar experiences. This guy Dave suggested using the handwheels to double-check the position. Duh. I've been using my DRO for so long I forgot about the handwheels. The handwheels have 1 mille gradations, 50 per turn. It's the way you keep track of the position of the spindle without all the fancy stuff.

So I did a few more tests, particularly with high-speed (rapid) moves. Several runs showed the physical moves absolutely consistent and spot-on in final position. The DRO was missing about 1% of the steps at top speed. Reducing the speed a tad took care of the problem.

My steppers are 200 steps per turn. The driver board can be configured to run in 1/2, 1/4 and smaller fractional steps, or micro stepping. I have been running my mill at 1/2 step or 400 steps per turn. I decided to try 1/4 step which immediately halves the speed. It seems the smaller divisions can help with resonation. 

I tweaked the various settings to get the speed back up, but not as fast as before. It does seem to move more smoothly now. I even ran a GCode file that had a vector that caused resonating. It doesn't do it any more. There will probably always be resonation problems. I was doing some manual work this evening and I found a speed that resonates. This shouldn't be much of a problem. It moves through the speed just fine accelerating. When I get around to coding feed speed control I'll find the speeds that resonate and map them out of the options.