Thursday 20 October 2011

progress

Right. Whith some more work we now have this:this

improved everything. takes in mesurements in mm and spits out movement.

just need to do some acceleration and give it a good test.

Friday 12 August 2011

The G code interpreter

I have previously written a CNC controller for a Boxford Duet I also have, it didn't work very well and all the maths was done on the PC and then stepping data sent  to a PIC18f4550 in the machine over a USB to serial bridge. For this project I wanted to drip feed the machine with G codes and do all the maths on the machine. the Arduino provides a nice basic environment to develop simple projects like this so it seamed like a logical choice. I had looked at the software developed for RepRap project (http://reprap.org) but it would have taken me as  long to work out what they were doing and then how to modify it for my own ends as it would to write it from scratch.

So this is the result

(I should point out that it is no where near finished yet and needs lots of tidying (might be a bit of maths wrong in the circle algorithm too) but it mainly works. If you have anything to add to it drop me a comment or email.)

To make life easy the first version takes in commands in fixed length words (e.g. G, M and T codes are all 2 digits long (e.g. G00 or T27)) with leading zeros where needed. Also all distances are measured in steps, all distances are absolute and (0,0,0) is the home position and everything is measured from their so all positions are positive. All this makes the little micro controllers brain do less and so the code is simpler and easy to follow. the drip feeder just needs to convert from real units to steps and remove or add offsets as required then pad out the numbers to 7 digits, reconstruct the line of code and send it with a '*' to execute the line.

More details can be seen in the comments in the code.

So next thing to to is write the drip feeder. I am thinking Python....


 

the begining


Some time ago I purchased a "Profiler" PCB bridge mill from Elektor/Colinbus (http://www.elektor.com/extra/profiler-milling-machine-from-a-kit.91274.lynkx). At less than a third the price of a professional machine this kit looked like a good deal. However you get what you pay for. I like a number of other people who bought this kit found there were a few problems with it. For me it kept plunging through the board, the drill entry board and then tried moving, sending shards of carbide all over the place. also the PCB material I had wasn't completely flat so it would engrave too deep in some areas and too shallow or not at all in other areas. Other problems included the software being generally annoying, the spindle motor bearings being slack and out of alignment and the thing wanting to talk over a serial port in a non standard format.
Needless to say it has been gathering dust. What I wanted to do was whip out the old processor board and put in a new one, get a new spindle motor, design and make a floating head, design and make an auto tool hight gauge and write new control software. However one thing that would be needed for a rebuild would be something to generate the isolation routing tool paths from eagle (http://www.cadsoftusa.com/) layouts. I happened across a ulp programme from http://pcbgcode.org/ which dose exactly this. Now all I need to do is all the other things on the list.

I had previously bought a Kress spindle motor and clamping bracket so that is one problem taken care of. Having just obtained a Sieg X3 manual mill I can now make things properly and a floating head  and tool length detector will be coming soon. 


That just leaves the control board and all the software to be written.

To start I removed the old processor board and replaced it with an Arduino. I found that a USB port is perfectly sized to replace a D9- sub connector and a little saddle clamp made from a piece of ABS holds the board in place nicely.






Having done that I then wrote some a simple G code interpreter to run on the Arduino which i shall make the subject of my next post.

interesting I found that for reasons best explained by the bloke who designed this thing the step rate is 133 and 1/3 steps per mm on all three axes. go figure! (3mm pitch lead screws and 1.8deg/step motors running from a half stepping controller.)