Saturday, March 31, 2012

Cabinet and Work Surface

I forgot to post a couple pics earlier. This is the junction box for the limit switches. First the inside, the soldering isn't finished in this shot. The grounds still need to be joined and then the perf board pressed in and glued:


Here's the outside. Sorry about the focus. The light isn't great for photography and I'm a bit lazy with it.


After wiring up the controller I went crazy and rerouted the speed controller for the spindle motor. I also disconnected the thermal cutoff switch from the motor control and connected it to my microcontroller. Rather than shut the motor down it triggers an audible alarm.

Here's a before shot of the mill. The speed control is the box to the right of the spindle and below the motor. If you can figure out where those things are.


And here it is with the speed controller missing. This angle shows a significant improvement in visibility of the work area. Plus, the controls will be with all the others. I used a film canister as the junction box.


Earlier I posted someone else's cabinet for a mill-in-a-box. I thought I'd do something similar. The box would serve to hold tools, keep dust off the machine, and protect it from swinging 2x4's. But then I started making measurements and realized the part of the cabinet above the work surface was going to be huge, a 24" cube. That's going to be heavy. I got a bit concerned about my ability to build something sturdy enough to handle the weight. Then I called a contractor buddy of mine to see if he had a source for scrap counter top. It just so happened he was doing a kitchen job later in the week and pulling out a Corian solid-surface counter top. I pulled this piece out of his dump trailer:


It's a neutral grey, kind of speckled like granite but nothing warm and flowery. Not that there's anything wrong with that. Just not what I want in my shop. This piece is 30" wide and 25" deep. It even has a backsplash. I was going to build a worksurface 24" x 24" so this is a little bigger. But with the mill sitting on it, it doesn't look that too big (the work surface). The white card stock in the foreground are stand-ins for my controls. I've even got room for the DRO.

So I think I'm going to bail on "enclosing" it. I can always add that later. This material may be a bit hard to work. I've got to drill a number of large holes and cut out rectangles for the DRO and throttle. I'll take my time, hopefully won't screw it up.


Saturday, March 24, 2012

PCB Wiring Complete

I've completed the wiring for the new controller board. It's not pretty, but it's going to be hidden anyway. The important thing is that the connections are good and robust (they won't pull apart). A lot of the work was soldering connectors on the wires. Here's a shot of one such (male) connector:


There are 2 pairs of protrusions on the right for crimping the wire with. The right-most pair tends to get caught going into the housing, so since I was soldering I clipped it off:
 

Here's a shot of it soldered:


Most of the connectors I did were female. Occasionally I'd hit it with a little too much heat and solder and it would wick up the connector leaving enough solder in the channel to block the male connector. All in all it went just fine. Here's a shot of the new rats nest. It actually looks better than the prototype:


And a close up. It's not as well organized as I'd like but it's pretty good.


I did make a mistake in the design, though. The Sanguino has 2 pairs of serial lines. The actual port I use to connect to the computer is doubled by pins 8 and 9. Pins 10 and 11 are the other set of Rx/Tx lines. I wired all the lights to pins 8-13. This means 2 of my lights did not work since they were connected to the primary serial port lines (they flashed when I uploaded the firmware). Pins 8 and 9 are clearly labeled as Rx/Tx. Pins 10 and 11 are labeled as Rx2/Tx2 but the letters are very small and hard to make out. I must have been thinking that the clearly-labeled RxTx was the secondary serial port and since I'm not using it I could use it for lights.

I was smart enough to pull out all pins to the Sanguino. Pin 7 was designated as an extra output pin and pin 14 was designated as the piezo buzzer (alarm). Pin 14 was selected because it's a PWM-capable line (and it was at the end of the row after the lights). So I've re-routed 8 and 9 to 7 and 14. I moved the buzzer over to one of the extra A/D lines. What I've lost is the ability to use PWM to drive the alarm which would have supported multiple tones. Now I'll have just on and off. The alarm will sound when the mill motor overheats which should never happen, so I think I can live with a simple alarm sound.

Monday, March 5, 2012

PCB Assembled

I week delay due to vacation. I admit a Disney cruise is more fun than building robots. As soon as I got back I soldered the components on the board, cleaned it up and tested it.

Here it is with everything soldered on:


And with the components plugged in:


The DB-25 plugs in (via cable) to the stepper driver box. I plugged it in and tested it. The lights and buttons aren't connected, so I used a couple of test leads to turn on the limit pin and then tag the button pins. After some tweaks to the firmware to support a different arrangement of pins for the stepper motors the mill moved just fine in manual and program mode.

The next step is to make some cables and connectors for the controls. I need to give some serious thought to the cabinet and control panel layout so I can make wires and such the right length. I'm imagining an arcade-like cabinet to go with my arcade buttons and throttle controller. Not sure I can pull that off since I need to support a mill with open access.


Here's a cabinet I like for the top part:



I'd like all the features of the above. I need to figure out how I'm going to integrate the controls into this. Under the work surface will be a shelf or two for the electronics, the stepper controller box, transformer, power strip / surge protector, etc. I'll probably use the very bottom for material storage. I'll probably make it out of MDF. I want it to look cool but I want it easy to build. I'll use biscuits for joining instead of dados, rabbets, etc.

One feature I want not shown above, I hope to add some rigidity to the Z column. I need to design a spine in the center rear panel that can connect to the Z column. It has to be rigid of course, but I'd like it to double as a cable chase.

I might try to use Google Sketchup to design this. I have a lot of experience with 3D tools for animation and graphics. Sketchup has some very nice CAD features but has some concepts I'm not used to. I may end up with simple pencil sketch designs.





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.

Tuesday, January 24, 2012

Back To The Drawing Board

I have been running a number of tests of a PCB milling job for the control panel of my system while waiting for my motor to be fixed. I put a ball point pen in my drill chuck and spray-mounted paper to a piece of MDF clamped to the bed. I ran quite a few tests which resulted in a number of fixes already mentioned.

After getting the motor back, I then moved on to test cuts on the copper PCB substrate. The biggest challenge I found was holding the plate flat. In fact it seems impossible. The best I could do was fly-cut a piece of MDF, glue a piece of plexiglass to that, then glue the PCB board to that and clamp it real well with another piece of wood over it. This resulted in a variation of about 5 milles high to low.

Since the copper is probably 1 mille or thinner, 5 milles variation seems like a lot to me. So I set out to write a displacement map feature into the host software. I would manually sweep the PCB with my dial-test indicator and record the height on a 1/4" grid. I'd feed this into a routine that would adjust every point in the tool path that was at the cutting depth. I attempted to leverage the toxiclibs library that I've made heavy use of for the geometry of tool path manipulation. The documentation for the classes I needed was weak and I ultimately couldn't figure out how to get it done. I wasn't about to write the displacement geometry stuff myself, so I bailed and decided to cut some copper.

I mentioned somewhere in this blog that if I can put something together backwards or cut the wrong end off something I'll do it. My first attempt failed as I forgot to mirror the design to put the copper on the bottom of the board. My second attempt started out real well but failed when the drill bit wandered severely. I opted not to peck first with a center drill. My third attempt failed when my $20 15 mille end mill broke.

I will come back to PCB milling someday but only after finishing the displacement map feature (preferably with a probe). This will allow me to have little concern about holding the PCB flat and I can use cheap Dremel engraving bits.


At this point I plan to use the Fritzing Fab service to produce a professional PCB. I'd like to make my own for prototyping and experimentation, but it will be nice to have a high-quality board for the milling system itself. So now I'm redesigning the Sanguino I/O and Opto-isolation circuits on to one board and trying to shrink it as much as possible to save money.