After I
added the ENABLE control to both X and Z axes, it was time to calibrate
the contraption. Besides centering the drill bit, there are basically 3
steps - a) determine which direction an axis goes when the axis
direction pin is high or low, b) measure the distance between "all the
way up" and "bit at the workpiece" positions, and c) determine the
distance between the starting point on X axis (min switch) and the
position of the first hole to be drilled.
Direction reference calibration
This
was easy - an axis goes in certain direction until min or max switch is
triggered; depending on which switch was triggered, the Arduino sketch prints
whether Z_DOWN (or X_FORWARD) is high or low. These values depend on
how the stepper motor coils were wired to the board. All other sketches
then use these as reference values.
Distance between Z_MIN and bit_at_the_workpiece position
This
was also easy - the Z axis is manually jogged to the position where the
bit is in contact with the workpiece, and then the sketch moves it all
the way up, counting the steps. The number of steps is printed as
Z_OFFSET value.
Distance between X_MIN and first_hole position
Before getting into that, here is a short explanation of the drilling setup and sequence:
Take
the angle stock that is at least 2" shorter than the length of the X
axis threaded rod. Using templates, drill 2 pairs of holes at one end
of the angle, and 1 pair of holes at the other end (the ends don't have
to be a whole number of inches apart). Insert the angle into the long
sliding element, single pair in first (two pairs oriented forward). The
4 edge holes are used to fix the installed angle with screws. Tighten
up the forward nut combo on the threaded rod. Install 2" screw into the
second forward hole so that it points sideways (hole labeled "SCREW").
The drilling routine would retract the angle backward until the X_MIN
switch is triggered by this screw. From this position, the contraption
would move the angle forward X_OFFSET steps to the first_hole position,
drill, and would then keep moving it forward and drilling at 1"
intervals until X_MAX switch is triggered. The X_OFFSET value is what
we need to find out.
One accurate way to do it is to drill a
hole (manually jogging Z axis) with the X axis at X_MIN position, and
then measure the distance from this hole to the reference hole with a
caliper. When two 3/16" hole centers are exactly 1" apart, the distance
between the outermost points should be 1 3/16", and the distance
between the innermost points should be 13/16". By averaging these 2
measurements, the actual distance between two 3/16" hole centers can be
determined pretty accurately. The X_OFFSET (in inches) would be 1"
minus that actual distance. Multiply that by 24 TPI * 400 steps/rev and
you get X_OFFSET in steps.
I also tried to do it without
drilling a hole, just by marking it on the area painted with Sharpie,
and then measuring the distance between the mark and the reference
line, but the measurement was not very accurate.
I thought of
yet another way (but didn't actually try it) - to have a second
reference hole on the template, 1" from the first one. Then the drill
bit can be manually placed inside the second reference hole and the
sketch can raise the bit and move the X axis to X_MIN, counting the
steps. However there is a fair amount of play on the spindle of my
drill (I bought really cheap one for experiments), and I think other (better) drills also have some play, so it would not be very accurate either.
Yet
another (fairly accurate) method involves a reference hole 1" from the
"SCREW" hole. The X axis needs to be positioned so that this reference
hole is halfway inside the long sliding element - it seems we're able
to perceive even minor imperfections of a small half-circle. From this
(half-circle) position, the number of steps to X_MIN can be counted by
a simple sketch. This distance between "half-circle" and X_MIN is equal
to the sum of X_OFFSET plus the distance from the edge of the long
sliding element to the drill bit centerline, which should be easy to
measure with caliper - unless we moved the drill along the X axis
(relative to the frame) after drilling the long sliding element
through. The edge of the long sliding element should be pretty
straight, too.
Testing
So, once the drilling
contraption was all calibrated, I drilled lots of perfect perforated
angle. Right? Well, pretty much, except the holes were not exactly 1"
apart. And when I switched the angle around, the new holes (in the
other angle leg) did not match up to the old ones. Oh, and the X axis
motor stalled a couple of times. The results seemed bizarre. So I
started doing some research on what could possibly go wrong with my
setup and found the excellent resource, CNC Cookbook.
To be continued..