VFD control board

This small PCB is going to sit between the M5i20 optoisolators and the VFD that runs the spindle on the mill.

Starting from the lower edge of the card there are three outputs that drive optoisolators on the VFD through BC337 transistors. On the VFD they are wired to Forward Start/Stop, Reverse Start/Stop, and External Fault.

The next signal goes in the opposite direction, from VFD to EMC. The VFD has a general purpose analog output which can be programmed to monitor motor current, power, etc. Since the m5i20 doesn't have analog inputs I'm using the V-2-f converter AD654. It's hidden below the board since it was only available in surface mount. As seen below it seems to work nicely. I designed the output to be at 1000 Hz with 10V input, but I'm only supplying 12 V to the AD654 which means the output goes all funny somewhere after 8 V input. Maybe the VFD software can scale the 0-10V output, or I can put a voltage divider in front of the AD654 to get maximum 8 V input. I need to come up with a HAL config that reads a general purpose IO pin and figures out the frequency (think big green/red pyVCP spindle load meter in AXIS).

The top two connections are for the frequency reference, a pulse train, and for an NC E-stop relay.

This card together with a spindle encoder should allow for rigid-tapping.

Timing build_kdtree()

Drop-cutter requires a fast way of searching for triangles under the tool. A kd-tree (4-dimensional in this case) is suggested by Yau et al. I've tried to implement one here (look in trunk/Project2). Just ran some timing tests using Stopwatch() on it, and indeed the build_kdtree() function which takes a pile of triangles as input and generates a kd-tree seems to run in O(N*log(N)) time as it should.

I've never drawn this type of plot before, and I was surprised at how close N*log(N) is to N - in a loglog plot they are almost equal!

This is a recursive function. I wonder if there's a good way of multi-threading recursive functions? My laptop is dual-core and a modern desktop PCs is likely a quad-core - so let's try to write these things multi-threaded from the start.

Next up is a function for doing the orthogonal range-search for triangles that lie under the tool. That's supposed to run in O(N^(1-1/D)+K) time, where D is the dimension of the tree and K is the number of reported triangles - so O(N^(3/4)+K) in this case. I'll try to get that done during the weekend.

E-stop circuit

This is the E-stop circuit I am going to use when upgrading the cnc-mill to servo control. The idea is to use a wire-OR circuit (series connection of NC switches) for things that cause an E-stop followed by a wire-AND circuit (parallel connection of relays) for things I want to happen at E-stop.

The E-stop out signal from EMC is wired to the top right of this board (labeled E-stop IN...). When this signal goes high it closes the rightmost relay which has +12V wired to it. The 12 V then goes through a series of NC switches, which I've here just shorted out with the black wires. In reality the black wires will be replaced by one E-stop button on the main enclosure, one E-stop button on the jog-pendant, X/Y/Z limit switches, NC servo-amp fault relays, and a VFD NC fault relay.

When all is well +12 V is supplied to the three other relays, and these provide NC or NO outputs. One is used to tell EMC everything is OK (E-stop IN signal in EMC), one is used to enable the power switch of the axis servos, and one is spare for now.

This should make the machine reasonably safe. If any of the E-stop buttons are pressed, a limit is tripped, or the servo amps/VFD are not feeling well we should go into E-stop, and that will cut power from the servos. EMC will also notice this and I'm relying on EMC to shut down the coolant pump and the VFD.

Z-map model for 3-axis machining

I've been reading about the z-map model for 3-axis milling. A working simulation environment would be very useful for CAM algorithm development. Coarse errors in the algorithms can be spotted by eye from the simulation, and a comparison of the z-map with the original CAD model can be used to see if the machining really produces the desired part within tolerance.

Jeff Epler hacked together a z-map model with EMC2 a while ago: gdepth. Perhaps some code/ideas can be borrowed from there.

The z-map can also be used for generating the tool paths themselves (similar to bitmap-mowing here, here and here), but that's more advanced and not the immediate goal.

Here's the z-map model, a lot of vectors standing upright in the z-direction, getting cut (or mowed down) by the moving tool. For graphics you could fill each space between four z-vectors with two triangles and display an STL surface. Obviously this works only for 3-axis machining where the tool is oriented along the z-axis, and the tool must also not produce undercuts (e.g. T-slot milling).

So how do you cut down the z-vectors for each move in the program? For linear moves you can always rotate your coordinate system so it looks like the figure above. The movement is along the x axis, with possibly a simultaneous move in the z-axis. At the beginning of each move (A) and at the end (C) it's very simple, you just calculate the intersection of the relevant z-vectors with a stationary tool at A and C, a kind of 'inverse drop-cutter' idea.

The surface the tool sweeps out during the move itself (B) is more difficult to deal with. The mathematics of the swept surface leads to an equation which most people seem to solve numerically by iteration. I'd like to go through the math/code in a later post (need to learn how to put equations in posts first!).

It's not smart to test all z-vectors in the model against the tool envelope of each move. So like drop-cutter where you are searching for which triangles are under the tool, in z-map you want to know which z-vectors are under the tool envelope. One strategy is simple bucketing, but perhaps if a kd-tree is developed for drop-cutter the same algorithm can be used for z-map.

Obviously the z-map has a finite resolution. Increasing the linear resolution by some factor a requires a^2 more z-vectors, storage, and calculations. A better way might be to insert more z-vectors only where they are needed. That's the places on the model where the z-coordinate changes a lot. So here (view from above) for example if you are milling with a cylindrical cutter more z-vectors are needed along the edge of the tool envelope. (I have no idea why they are inserted in a tilted grid-pattern in the above figure...). This potentially leads to much reduced memory/calculation requirements, while still producing a high resolution model. As the simulation progresses there are probably also regions where some densely spaced z-vectors could be removed. Maybe a 'garbage-collector' process could go over the model every now and then and look for flat areas (xy-plane like regions) where less z-vectors are needed and remove them.

A lot of papers use this APT tool when deriving the equations for machining or simulations. By varying the parameters suitably you get the familiar tool shapes below:

From left to right: Bull-nose/filleted/toroidal, Round/ball-nose/spherical, drill/countersink, tapered, and cylindrical.

My earlier drop-cutter explanations and code only work with the toroidal, spherical, and cylindrical cutters. I'm not sure if it makes sense to write the code for the general APT cutter, or if it's better to optimize for each case (cylindrical and spherical are usually quite easy).

If anyone has made it this far, my sources are the following papers - which are available from me if you ask nicely by email.

Helsinki Boatshow 2008

The 2008 Helsinki Boatshow started yesterday with a day for press and other VIPs. Four Micro-Magic boats were sponsored by the Finnish Sailing Federation and its parters, and on Friday a few of the Finnish Olympic sailors got together for some racing in the pool. The show is now open until Sunday 17th, and the Finnish Micro-Magic sailors are sailing in the pool 2-3 times per day for 30 minutes at a time. This pool is a bit smaller, 4.5x9.5 m, than the one at Model Expo last year, but we found some better fans for generating wind. They seem to create less turbulence and a smoother wind across the pool.

Widgets for Sail

Graham Elliot from the UK doesn't have a website of his own (yet?) , but wanted to let everyone know that he is now building and selling the Widget IOM. Designed by Chris Dicks in 1995 the boat has gone through quite a few changes to everything except the hull shape. The Widget has won the 1996 European Championship, the British National championships in 1997 and 2007, and the 2007 World Championship, not bad for a boat that was designed 13 years ago. The mouldings of the boat are manufactured by Dave Creed.

Graham's options and prices are:

  • Boat complete to deck level, including cf fin and rudder, all attachment points, pulleys, adjustable main post, keel, all finished = 840 euro.
  • RMG 280D, 42mm drum, thumbscrew, fitted in boat=215 euro.
  • Rudder Servo, hitec 645 ultra torque, fitted in boat=75 euro.
  • Rigs: prices vary depending on which fittings (sails etc or housemartin) and also which sails are preferred (housemartin , Brad Gibson , Stealth , sails etc)
  • Wooden rig box= 80 euro
  • 4 colours: red, orange, blue, grey. They are all sprayed using Epifanes 2 pot polyurethane paint.

Currently (Feb 2008) there is a waiting list of approximately 16-18 weeks.

Please contact Graham Elliot on elliottyachts "at" hotmail.co.uk if you are interested!

Mowing Foam

Dan Egnor sent me this nice example of bitmap-based toolpath generation, or 'pixel mowing'. It's a slightly exaggerated topographic relief of San Francisco machined in tooling board using a very simple 'lawn mowing' toolpath generator.

The explanation of how it works below is mostly Dan's, not mine.

This is the input to the toolpath generator for one of the Z-slices.

black - material which must not be touched
green - to be removed, is safe (at least one tool radius from black)
yellow - remove if possible, is dangerous (within tool radius of black)
purple - has been cleared, is dangerous (machine limits or similar)
white - has been cleared, is safe, is not blue (below)
blue - this spot has been cleared, and is safe, but is within one tool radius of material that needs clearing (green or yellow)

Note that you don't see blue in either "before" or "after" images, it only occurs transiently. (In theory it could show up in "before" as area outside the workpiece.)

And this is the resulting toolpath. Green circles are plunges and red circles are lifts. The thick grey lines represent actual cuts, the thinner lines are rapid feeds.

The basic rule is that the tool *centroid* is only allowed to visit safe areas (green, blue, and white). Green and blue represent work to be done (safe areas that need visiting). Of course, as the tool moves, green changes to blue and white, and (some) yellow changes to purple.

The real trick is in efficiently tracking the "within tool radius of" zones (material to be cut, or material to stay away from). Every pixel keeps a count of how many pixels of each type ("nearby-blocking" or "nearby-cutting") are within one tool radius of that pixel. Whenever a value is changed ( e.g. the simulated tool moves and changes some points from "cut" to "clear"), every counter within the appropriate radius is updated.

That would be rather costly to implement directly, each simulated pixel move would require N^3 updates, if N is the diameter of the tool. Instead those counters are only kept as *differences* between each point and its neighbours. That means changing a point only requires updating the values along the *perimeter* of the radius surrounding that point, meaning that a simulated pixel move only requires N^2 updates, which makes things a lot more tractable (though it still takes the old laptop I use a couple minutes to complete the toolpaths for a 5" x 3" x 1.5" model at 1/256" resolution). Of course this means that the "color state" isn't directly accessible for a random pixel, but must be figured incrementally from neighboring values. Fortunately most operations don't access random pixels.

You would probably not want to cut metal with this kind of algorithm as there is no control over material removal rate or cutting forces, but for foam, tooling-board, or wood it should work ok.

Dan's program is written in C++ and available here (http://svn.ofb.net/svn/egnor/boring/), but it's not well documented.

We are standing by for a video of this kind of cutting!