Shop OBEX P1 Docs P2 Docs Learn Events
Looking For Ideas: Detection of X=0 and Y=0 for CNC Machine — Parallax Forums

Looking For Ideas: Detection of X=0 and Y=0 for CNC Machine

idbruceidbruce Posts: 6,197
edited 2012-05-12 08:55 in General Discussion
Hello Everyone

As many of you know, I am currently working on building a new CNC PCB Drilling machine, and as you might have guessed, I want this machine to be as accurate as possible, within the given limits of the hardware being utilized.

One of the key aspects of the machine is being able to zero the machine before any drilling commences. I could go hog wild and attempt to fully automate this process, but I believe that would be a bit of overkill, especially since I am trying to keep the cost and complexity to a minimum. With this in mind, I believe the best approach is a little human intervention to zero the machine. Before I tell you my idea, let me give you the basic idea of operation, which is as follows:
  1. The machine is turned on, at which point, the Propeller controller seeks a valid drill file from a SD-micro card reader and it also seeks valid readings from a X_Equals_Zero sensor and a Y_Equals_Zero sensor. If the input is incorrect, the Propeller controller outputs the errors to a LCD display, until the errors have been corrected. If errors exist, a red LED flashes until the errors have been corrected, and prevents further program execution. When all errors have been remedied, the red LED stops flashing and a steady green LED is displayed to indicate that the machine is READY and will allow drill file processing when the START button is pressed.
  2. When the machine is in a READY state, the PCB material is placed into a clamping fixture, and secured.
  3. When the START button is pressed, the machine processes the drill file.
Now that you have the basic idea, I am thinking about purchasing double shafted motors for both the X and Y axises. The front shaft of each motor will be adapted to the leadscrews necessary for axis movements, and the back shaft of each motor will have a knob for manually adjusting axis movement to prevent automated zero seeking overruns. So in other words, the knobs will be used to put the machine in a X = 0 + and Y = 0 + state. The knobs can also be used to adjust these axises for whatever reason becomes necessary. Let's assume that the machine is manually adjusted so that X = 1.00" and Y = 1.00", and that we want the machine to automatically move the axises until X = 0 and Y = 0. Since the machine has manually been positioned after 0.00, 0.00, we know that seeking 0.00, 0.00 must be performed in a specified direction for both X and Y. Since we have established seek directions, we can now introduce the ZERO button. When the ZERO button is pressed, the machine automatically moves X and Y in a predetermined direction until a 0.00 indication has been received for both axises.

Now that you have the basic theory of operation, let's talk about implementation. I am currently thinking of drilling a hole in the clamping fixture at 0.00, 0.00, and having a laser mounted into the drilling spindle, with a reader positioned underneath the clamping fixture. When the laser light passes through the clamping fixture and is read by the reader, then 0.00, 0.00 will have been found.

Of course this idea of implementation is not carved in stone, and I am seeking other ideas that may be precise and easy to implement. So if you have any ideas, please feel free to provide your input.

Bruce
«1

Comments

  • idbruceidbruce Posts: 6,197
    edited 2012-05-09 05:30
    During the next couple days, I will also be thinking about placing slotted optical switches on both the X and Y axises, as compared to the previously suggested laser and reader.
  • MicksterMickster Posts: 2,845
    edited 2012-05-09 06:02
    I have not looked in to the spec' but I do know that there is more than the one model that is available (here), catering to various ranges but I wonder if these could be utilized not only for home registration but also as a means of verifying the commanded position of each axis. I also know that they are non-linear so presumably a calibration algorithm or LUT would be required.


    Mickster
  • idbruceidbruce Posts: 6,197
    edited 2012-05-09 07:24
    Mickster

    I appreciate the input.

    In my opinion, I believe these would be much better for verifying commanded positions, as compared to zeroing. For zeroing, I believe on/off detection (light present/light not present) would be the simplest possible solution.

    It appears that we may have similar interests pertaining to machinery and such, so you may want to have a look at this page, because it contains links to a wealth of information pertaining to optical sensing: http://www.optekinc.com/app_notes.aspx

    Bruce
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-05-09 07:58
    On the several CNCs that I've used, and on the one I own, homing is done using simple (but rugged) momentary switches. On my own machine, which I've now had and daily used for over 10 years, none of the switches have ever failed. In that time I've had to replace one of the steppers, repaired a burned out drive, and replaced or rebuilt the spindle motor countless times. Never had to replace any of the homing switches.

    The laser idea sounds elegant, but I know on my machine, and with the materials I cut, a hole or spot or any other technique requiring optical reading wouldn't work because of debris.

    -- Gordon
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-05-09 08:14
    Bruce,

    On most CNC machines, there are no absolute coordinates. The origin is wherever the operator says it is. On mine, I have manual controls to move it in all directions, both continuously and incrementally. Once I've got it where I want my origin (or some other point), I tell it what the coordinates of that point are. All three axes also have limit switches, but those are only to prevent over-travel; they're not repeatable enough for any kind of position calibration.

    For routering PCB panels from the PCB fab, I clamp in a piece of particleboard and locate the lower left-hand corner manually (by eye for X and Y, with a feeler gauge for Z), then set the origin there and drill holes that match those at the edges of the panel. The panel is held in place with brass rivets and masking tape. After changing tools from the drill to the router bit, all I have to reset is the Z origin, again using the feeler gauge.

    I think that any attempt to set an absolute origin with sensors would be both quixotic and, ultimately, not very useful. Just make it easy to do it manually.

    -Phil
  • Mark_TMark_T Posts: 1,981
    edited 2012-05-09 09:56
    Consider the scenario of having a fixed board clamp/jig and the need to make several boards on several different days - on power up you want the CNC to find the same registration as last time automatically (so identical boards are trivial).

    If you always return to 0,0 after a job, finding a registration hole ought to be fairly easy on power up.

    From an arbitrary position this isn't going to work - you can seek to the endstops (those limit switches are not optional!) and then go to the registration mark approximately (using EEPROM data?). Then do proper calibration (since end-stop switches are low precision).

    Seeking to endstops and back is time-consuming unless the 0,0 point is close to the endstops, note - this is a good reason to have it there (irrespective of where the board-clamp jig is.

    Also don't forget to have some way to calibrate the Z-axis.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2012-05-09 10:50
    A repeatable zero can be found by driving the motor against a hard stop and monitoring the torque. When the hard stop torque is seen then move the x or y a certain number of counts in the opposite direction to an offset representing the zero position.

    Jeff T.
  • idbruceidbruce Posts: 6,197
    edited 2012-05-09 11:38
    @Gordon

    I attempted to use momentary switches on my wire bender cnc as homing sensors, but the repeatability just wasn't accurate enough for me, which ended up causing me a lot of grief. I tried both a couple of detent switches as well as a couple of cheap RS switches. I am sure there are much more accurate switches than the ones I tried, but I believe optical would be more dependable than mechanical, however I could be wrong.

    As far as the laser issue goes, yes debris would be a problem.

    @Phil

    Okay, I agree and partially disagree :)

    Please consider that I am creating my own system here, all the way from exposure to drilling. The photo masks and PCBs are cut to size prior to exposure to match Gerber size and drilling, so X and Y on the drilling machine must match Gerber X and Y, so I really don't have the luxury of arbitrarily picking X and Y on the PCB material, like a router setup. But then again, I suppose that would all be dependant upon where the table is located.

    To make matters worse, the microstepping drives, always start on a full step, or at least I believe they do. If energized, and if adjusted manually by overcoming the holding torque, I believe this also will only adjust to a full step. So then the option becomes to adjust it electronically through pulses.

    However one your comments has some real value, with a slight change:
    Just make it easy to do it manually.

    Changed:
    Just make it easy to do it electrically.

    Since the clamping frame will always have a 0,0 location, as established by the overall system, I could use a 0.125" rod to index (microstep) the machine by pushbuttons to a location of X = 0.0625, Y = 0.0625 (outer circumference of the rod barely touching both the left edge and bottom edge of the clamping frame), and programatically offset to establish 0,0.

    Thanks for the input guys.

    Bruce
  • idbruceidbruce Posts: 6,197
    edited 2012-05-09 11:40
    @Mark_T and Unsoundcode

    I did not see your posts until my last posts. Thanks for the input.

    Bruce
  • VonSzarvasVonSzarvas Posts: 3,597
    edited 2012-05-09 11:47
    On the switches subject, I also tried various micro-switches, but then had great success with car-door push switches (it's a stick which gets pressed in to break the circuit when the car door is closed- I hope you know the type I mean even though I don't know the product name!!?). They are really easy to fit (just drill one hole and use the supplied nut!) and then the moving part of the cnc will just press into it when reaching the limit. Never failed, and seems really accurate. Plus you can see the whole switch internals, so easy to spot damage. I can post a picture of my setup if that helps to make sense of what I am trying to say! Maybe it can be a useful and simple solution.

    Either way.. good luck with the build!
  • pedwardpedward Posts: 1,642
    edited 2012-05-09 13:55
    The way that commercial systems work, with encoders, is to use the switch as a coarse home, then back off the switch until they see the Z index pulse (encoder terminology).

    In practice, travel toward limit switch, switch trips, stop, back off switch until switch turns off, you are now at 0. This should work reliably with optical IR and flags, so the mechanics of the switch aren't a variable.

    Ideally, travel towards switch, trip, travel away from switch until reset, then continue traveling until you detect the Z index pulse, you are now at 0.

    Most CNC machines look for machine zero, then the programmable WCS zeros are an offset from that.
  • kwinnkwinn Posts: 8,697
    edited 2012-05-09 14:10
    Mechanical switches do not provide the accuracy required for boards with hole/trace spacing much smaller than 0.1 inches. Even if you do manage to adjust them initially they will drift with use. Optical interrupters are somewhat better but will also drift as the led and sensor age. Pedward has described one option for increasing the accuracy. The alternative to a high resolution encoder is to use the switch or optointerruptor to indicate that you are close to 0 position and then continue moving at minimum speed until you encounter a solid mechanical stop.
  • idbruceidbruce Posts: 6,197
    edited 2012-05-09 16:18
    Thanks To All Of You Who Took The Time To Respond

    Some very helpful information has been presented and I am sure it will all be useful at some point.

    I am now more inclined with the KISS method as Phil suggested with my modification, along with a suggestion of Mark_T's. I believe I will use the knobs on the motor shafts to get the spindle center in close proximity of 0.0625, 0.0625, and then use two buttons, one for X and one for Y, to microstep the spindle with a chucked 1/8 index shaft to the exact point of 0.0625, 0.0625, and then programmatically set this as the current machine location. After use, I will return the spindle center to 0.0625, 0.0625.

    I believe this should work well with minimal human intervention.

    Bruce

    EDIT: And of course recalibration will be necessary for each machine power up procedure.
  • pedwardpedward Posts: 1,642
    edited 2012-05-09 16:44
    You might want to look at putting a wiggler on it if you want to touch off like that. I haven't seen an edge finder that would fit an 1/8th collet, but you might find a wiggler.
  • pjvpjv Posts: 1,903
    edited 2012-05-09 16:45
    Hi Bruce;

    On some of my tools I use a cheapy camera mounted to the Z axis to reference 0,0 . I have a micro synced to the camera scan lines, and have it overlay an artificial crosspoint target that shows up on the the TV display. This way TV "sizing" errors "fall out". To calibrate the position of the camera relative to your drill center, drill a hole, then move the platen to center the camera on that hole, and the number of x and y steps moved are the camera offsets from the drill.

    Works very well, with an accuracy of a single step.

    Cheers,

    Peter (pjv)
  • PublisonPublison Posts: 12,366
    edited 2012-05-09 17:01
    One method that was used for Photoplotters back in to 80's was to have a permanent pin in the platen with a cross hair pattern on it and the have a mount for a loupe on the photo head to locate 0,0. It would be done manually jogging the x,y to align, then a zero button was pressed. Would take all of 30 seconds to align. The loupe was graduated in .001" increments.

    Jim
  • idbruceidbruce Posts: 6,197
    edited 2012-05-09 17:55
    @pjv and Publison

    Both of those methods sound very interesting, and I especially like the idea of the loupe and crosshair, however hooking up a camera and tv is beyond the scope of this particular machine. This is going to be a very small cnc machine, with all axises having a maximum travel of 4-1/16". The primary purpose of this machine will of course be drilling PCBs, so any feedback beyond necessary tool changes, percentage completed, and audible indications of errors or completion, would probably lead to extravagance. However, in the future, I may adapt the machine for small 3D printing and laser direct imaging.

    It is noteworthy to mention that I have another nearly complete XYZ machine that may benefit tremendously from the ideas presented here, because it is a much larger machine, with no particular set purpose at this point in time. I am certain that when I get around to finishing that machine, I will return to this thread to read all the suggestions again. Most likely that machine will have a tv.

    Bruce
  • $WMc%$WMc% Posts: 1,884
    edited 2012-05-09 20:35
    Hello Bruce...
    '
    I think the board edge is irrelevant.
    '
    I would look at finding drill hole #1 (X point) and make a zero or calibration point from there from the trace, Not the board edge.
    '
    Then I would find another drill point for the second zero or cal. point.(Y) from the trace.Not the board edge.
    '
    This might sound like over-kill but with a lot of traces, Through holes jumpers can short easily if the board is off just a little using the board edge method.
    '
    I was working on a parser that homed the #1 drill hole at the upper left of the drill table (X). From there I would select a drill hole closest to the lower right of the trace for (y)
    '
    This forced the trace to be in the right place, Regardless of the board edge,.
  • T ChapT Chap Posts: 4,249
    edited 2012-05-10 06:09
    http://www.mcmaster.com/#plunger-snap-acting-switches/=hh173m


    I use C in the list, snap acting and it is quite accurate. You need a longer throw on a plunger than a micro switch, this gives a good 3/8" push. For the CNC, I press a button to HOME, one at a time the Z goes up, hits the switch, backs off, sets Z pos to 0. Then Y moves back to hit the switch, same as Z, then X. When all have homed, they are auto set to 0 as the Machine Coordinates. These coordinates are static behind the scenes values. As Phil stated you can move to a position that is your board XY 0 points. You then zero out another set of coordinates that are for the board. The machine coordinates really do not need to be seen any longer unless there is a problem. Keep a set of values in the background called Board Offsets for XYZ in case(machine coords - board xy). For example, you are drilling, something goes wrong or a computer crash. If you had have made note of the OFFSET position which is the machine coords - the board position coords, you could very easily re HOME, move to the offset position and be extremely close to where you were to begin with. I do this all the time routing parts, have a crash or hit a part hold down or whatever, reboot, reposition part hold downs, whatever is needed to fix the problem, then move to the offset points and re-zero the board coords to 0.

    Now, with small .031 drills for PCBs back when I put myself through a phase of home brews, I would be sure to set the bottom left of the pcb, then adjust the top right of the board it was tight with the x and y of the machine, regardless of how straight the boards were cut etc. I no longer make the actual PCB but do have a pick and place mod for a CNC including home brew software. I use fiducials on the bottom left of the board, and top right of the board. I always include 6-32 bolt holes on all my boards, the base the pcb sits on is predrilled for each boards' holes. I place the board, add 4 6-32 screws to hold it in place, and now I know the board is very close to in line with the machine XY trajectory since the machine drilled the mounting holes, and base jig mounts very consistently. On the pick and place, I do not do a homing process, only the CNC does homing as extreme ends of movement are required. On the pick and place, only a limited area is required with little chance of crashed the table, and the base is placed in the same spot each time, lined up on tslots with tnuts on the aluminum table. The pick and place gets zeroed out on either of the fiducials, usually lower left, move the needle to the center of a fiducial, press a button for 'set fiducial 1'. Fiducial 1 is stored as a coord just like a other coords, so it is a relative position. It sets the xy to the position of the fiducial, so all other parts are accurate relative to the zero of the fid. At any time you can check the position by pressing 'go to fiducial 1' or 'go to fiducial 2'. There is also a bias for board X, Y, and Z. If for any reason there is a slight offset on the board due to the screws not being centered or whatever reason, I can bias in real time on the fly the x,y and z, so the machine doesn't even stop running, but I can bump the needle over(bias) in .001 increments. This saves restarting or going back to a fiducial to check.


    I like the idea of the afforementioned drill hole as a 'zero' position, only you are setting the machine to that holes xy instead of 0, this is the same as my fiducial use, but for a drill hole it may be more accurate to actually be in a hole.

    A side note about drilling pcbs, I am not sure if you had discussed this, but it is far easier to drill after etching, the drill tends to locate itself inside the hole of the copper, and makes for much better hole placement than drilling first. I doubt you would do the reverse but just mentioning it.

    Regarding homing, you can use just one switch, but set up some Soft Limits (software limits) so the machine is not allowed to move past the behind the scenes machine coords and crash the table.

    As far as encoders etc, I have done that on steppers, and found it to be a giant time vortex for no real value. Accelerate and decel nicely and keeping track is not required. However, if your issue is more about trying to get back to a repeatable place, the switches I mentioned will solve that, but I recommend a +-.001 resolution bias feature for real time tweaks adjustments regardless. You may be drilling, and see that the drill seems a little shy on the X, just hit the -> bias button a few times based on a guess, say .002, and the next drill move will add or subtract the bias from the actual position it should move to. That combined with using an actual hole for reference is pretty solid.
  • idbruceidbruce Posts: 6,197
    edited 2012-05-10 08:28
    @Walt and T Chap

    I am looking at things from a much different perspective, because this will be a unique setup, but I can relate to the confusion.

    Referring to what Phil stated earlier:
    On most CNC machines, there are no absolute coordinates.

    And I replied:
    Please consider that I am creating my own system here, all the way from exposure to drilling. The photo masks and PCBs are cut to size prior to exposure to match Gerber size and drilling, so X and Y on the drilling machine must match Gerber X and Y, so I really don't have the luxury of arbitrarily picking X and Y on the PCB material, like a router setup.

    This machine will run on absolute coodinates.

    Since the boards and masks are cut to size in relation to the board size established within a Gerber file, all coordinates become absolute, therefore establishing 0.00, 0.00 is of the utmost importance, as well as the squareness of the cuts of the masks, PCB material, and clamping framing, in addition to the resolution of the entire system and any backlash associated with that system.

    If I do not establish 0.00, 0.00 on the drilling machine to match Gerber file 0.00, 0.00, I am dead in the water. This 0.00, 0.00 location will theoretically never change. Each and every board to be processed will start at this same 0.00, 0.00 machine location, each and everytime.

    Bruce
  • T ChapT Chap Posts: 4,249
    edited 2012-05-10 09:19
    I have to beg the differ with Phil on that :) How does a machine avoid crashing the table if it does not maintain absolute machine coords? The absolute coords are rarely needed or seen by the user unless accessed, but softlimits are very common even on cheap systems. Granted, I can just as easily boot my PC, load the machine app, and not bother to ref all home to set zero for each axis, but that is risking trouble.

    If you are building the machine and I assume the software, why do you limit yourself to absolute coordinates? Makes no sense to me Bruce. If I were drilling on a machine, I would export the xy out of Eagle with a simple ULP included in it but modified to inch. Import the coords, locate a zero point or reference point(drill location) or fiducial or whatever. Sounds like a rigid plan to have no access to offset when the code for such is nothing to add. Never would I base the drill points on the home switches or some linear/rotary encoder referenced to some start point. I am sure you have some reasons in your head for the decisions, but you are the designer! Change it to a more practical concept with offsets and bias and save yourself headaches. IMHO :)
  • potatoheadpotatohead Posts: 10,261
    edited 2012-05-10 09:38
    All the serious machines I've worked with had their own zero. It was adjustable and repeatable within a .002" range or so, some better, some worse.

    That zero is translated to the work area with precision stops and or fixture mounts. Most shops standardize all of this to bring tooling portability across their processes for a considerable savings.

    All the standard G-Code I've worked with includes an offset and some have a transform too, but all have a basic offset. This is what the operator uses to deal with job specific variances. Said variances may come from a fixture that's not aligned with the machine zero, need to apply machining to an already manufactured part, etc...

    General practice is to write the program for machine zero, and or tool center zero. The operator then can adjust the offset, and or transform if the part is rotated, etc... and adjust tool compensation as needed to realize the correct manufacturing result.

    For a one off type machine, I think it can make sense to simply origin at the time of manufacture, but it's not really best practice, nor does it scale well at all. That's my experience and .02c
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-05-10 10:11
    TChap wrote:
    How does a machine avoid crashing the table if it does not maintain absolute machine coords?
    I explained that in my post. It uses limit switches which stop it from going beyond its work envelope. If a limit switch is tripped during operation, it generates a fault condition, and the machine stops. But those switches are not accurate enough for positional calibration.
    idbruce wrote:
    This 0.00, 0.00 location will theoretically never change.
    Maybe not theoretically. But an awful lot depends on how accurately you trim the board to begin with. Can you trim it to within a couple mils and make sure the corner is absolutely square? BTW, you can't use a bench sander to refine your cut or square up an edge. FR4 simply chars (and stinks) under those circumstances.

    The way I would do the alignment is to print a couple copper donuts in opposite corners of the PCB. Each will give you a little dimple that you can accurately drill on your drill press. Next, drill the same holes in the underlayment on your drilling machine. Then you can use pins to position your board in the machine.

    BTW, plan on using fresh underlayment for each new board design. Otherwise you risk breaking those brittle carbide drill bits, should one encounter an old hole that's just slightly offset from the one being drilled.

    -Phil
  • idbruceidbruce Posts: 6,197
    edited 2012-05-10 10:19
    It all boils down to this.
    Leon

    I have not even tested registration yet, because I know it will be very close to dead center.

    To understand my degree of certainty, you have to understand the premise upon which my Exposure Box/Cylinder is built. There is very little room for misalignment. The bottom mask, top mask, and PCB material are all surrounded by a perimeter, and their width and length dimensions are all within a couple thousandths of each other, and just a couple thousandths smaller than the perimeter. The tight tolerances in conjunction with the perimeter pretty much guarantee acceptable registration alignment.

    Bruce

    This PCB Drilling Machine is based upon the exposure plate assembly of my Exposure Box/Cylinder. All positions are absolute.

    Failure is the worst possible outcome, but it is not a terrible outcome. If the drilling machine fails to perform as I expect, I will simply modify a few things. I will bend it to my will. :)

    Bruce
  • idbruceidbruce Posts: 6,197
    edited 2012-05-10 10:36
    Phil
    Maybe not theoretically. But an awful lot depends on how accurately you trim the board to begin with. Can you trim it to within a couple mils and make sure the corner is absolutely square?

    Yes. :)

    Bruce
  • idbruceidbruce Posts: 6,197
    edited 2012-05-10 10:48
    I am more worried about the backlash of the actuators and the alignment (squareness) of the X and Y actuators than anything else.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-05-10 10:58
    The way to deal with backlash when drilling is always to make your final approach to the hole position in the same direction (e.g. +X and +Y). If you're coming from another direction, simply overshoot the position and return along the proper vector.

    -Phil
  • idbruceidbruce Posts: 6,197
    edited 2012-05-10 11:00
    Phil

    That is a very good tip :) I am surprised I never thought of that or read about that technique :) I was figuring on software compensation.

    Thanks Phil.

    Bruce
  • potatoheadpotatohead Posts: 10,261
    edited 2012-05-10 11:36
    Yep, that one is worth a lot. All the stack-ups in the machine will "bottom" out, significantly improving overall repeatability and precision. It's very common to execute a slower program on a CNC just to take advantage of this fact. Random vector repeatability could be an order higher otherwise.
  • T ChapT Chap Posts: 4,249
    edited 2012-05-10 14:26
    That is exactly what I do on the pick and place, it always picks up the part from -x and -y approach, and always places in the same way. Otherwise it would have some drift on my machine.
Sign In or Register to comment.