Disclaimer

This blog is for entertainment purposes only, and is not meant to teach you how to build anything. The author is not responsible for any accident, injury, or loss that occurs as a result of reading this blog. Read this blog at your own risk.

Sunday, February 22, 2015

CNC lathe conversion - part 3

From debugging hell, to success.

From my earlier experience setting up Mach3 to run with the mill, I knew that some painful debugging would surely lay ahead, and I was not to be disappointed. I will give some details of my troubles here, in case someone else were to follow in my footsteps.

With the latest release Mach3 at present time (R3.043.066) running on Windows 7, a UC-100 USB to parallel controller (update 2.146), and a G540 (ver. #8), I’ve been having an issue with a runaway axis (or two). This is not a new issue, I’ve had this happen to me infrequently in the past, maybe once every few months or so, but now it's happening every single time, and it’s making my machines completely unusable, and somewhat dangerous. 

Unable to continue with my conversion work, and quickly running out of ideas, I was able to catch this problem as it happened on video. Unsure as to which was the source of the problem, I sent it to GeckoDrive support, CNCdrive support, and posted it in a new thread on the Mach3 support forum.





Runaway X axis 




Of course, there was always a chance that Windows might be to blame, so I updated it, though it ended up not making any difference. Getting pretty desperate at this point, I deleted, then reinstalled Mach3. This finally appeared to fix things, and I regained control of the lathe and the mill… until the problem started again about 1 hour later, as I was setting up the motor tuning options for the lathe, this time causing me to loose control of the Z axis.


I decided to limit the top speed to 40in/min to more precisely position the cutter by hand

Top speed on a lathe is pretty irrelevant


I captured that in a second video, sent it to the same outlets as before.





Runaway Z axis 




By this time I had finally gotten a hold of the Gecko tech support, which said exactly what I was expecting, but hoping they would not say, you probably guessed it… their board could not be the one causing the issue, it just reacts to input signals

I tended to agree though, since the UC-100 screen shows an active "Run" LED every time there's a runaway, so it knows something is going on. On the other end, Mach3 DROs (digital readout) showed no movement whatsoever while the axis was running away, like it had nothing to do with it at all. Perhaps the UC-100 was the party to blame after all.

To compound the lack of actionable troubleshooting information, running the mill and lathe from my laptop produced no runaway axes at all, like the problem resided with the “all in one” computer in the shop instead. I was quickly loosing faith, until someone in the Mach3 forum had the bright idea to suggest I turn off the backlash compensation, and all of a sudden everything was right with the world again.

Apparently backlash compensation is calculated in the UC-100, and not in Mach3, so I passed the information on to the Hungarian support team at CNCdrive, who promised to have their programmers look into it the next Monday.

Meanwhile, I moved on with other setting up tasks.

One thing that really surprised me of the BDtools CNC conversion, was the ability of the anti-backlash nut in the cross-slide (X axis) to completely remove all backlash from the lead-screw, when properly adjusted. 



Anti-backlash nut and its adjusting setscrews (top bolts are for attaching it to the cross-slide)





Checking for backlash on the X axis lead-screw 




The Z axis did not do as well with 0.0023” (0.0584mm) of backlash, even though it was sporting a very tight ball-screw.





Checking for backlash on the Z axis ball-screw 




This meant that I really didn’t need to use Mach3 backlash compensation after all, though I was happy to have played a part in the debugging of the UC-100 unit, of which I am very fond, and would definitely buy again.

Having sorted out these very important issues, I felt confident enough to run the first air-cutting test, a traditional first step.





Cutting tool running under CNC power for the first time 




I really felt like things were moving along, until I realized that everything the computer would come up with was in fact happening not only in reverse, but also in the wrong direction and quadrant on the actual lathe.

I’m going to give you the short-short version here... it took me 2 more days of troubleshooting hell to make this right. 

I hate setting up Mach3!

The good news now is that I will save my Mach3 turning profile in a safe place, so that I will never run the risk of having to go through this painful experience again.

I will include some pictures of my config pages at the bottom of this page, in order to spare you the trouble (should you be interested). You might still have to tinker slightly with the motor’s steps per unit numbers, since lead-screws and ball-screws are not all created equals, but this should get you really close. Note that I am using the lathe in “diameter mode”, as opposed to “radius mode”, as in normal manual operations. I am also working with X+ toward me, and X- on the further side of the spindle centerline, though backward, it was the only way I could get the code, the screen, and the cutting tool to agree on the same plan of action.

Finally, I started playing with the “turning wizards” included in Mach3, and practiced a bit on a ¾” (19mm) Delrin rod.


5 complex operations in less than 5 minutes!!!






turning a rod with a fillet





Cutting a ball on the end of the rod 







Cutting metal












Saturday, February 21, 2015

CNC lathe conversion - part 2

Electric motors

I ordered two NEMA 23 425oz/in 2.8A Stepper Motor ¼” Dual shaft (KL23H286-20-8B) on eBay to run the lathe X and Z axes.


Stepper motors


When the motors came in, I was surprised to find out they didn’t fit. Fortunately that was easily fixed by enlarging the mounting holes on the drill press, and shortening the length of the shaft with a cutoff wheel.


Enlarging mounting holes

Shortening the front shaft

After mounting them on the lathe, the time came for wiring, and these motors require you to make a decision before that can be done. Since they have 2 coils per side, and 2 wires per coil, there are a total of 8 wires to be sorted out (luckily I found the wiring diagram online) into 3 possible configurations, unipolar, bipolar series, and bipolar parallel. To make a long story short, bipolar parallel is where it’s at! More torque and more speed, who wouldn’t want that! 

The point to take away here is that 8 wires give you the flexibility to chose whatever configuration you need.


Stepper motor wiring diagram


Following the diagram, I paired the wires and ended up with 4 couples to labeled A+, A-, B+ and B-. 


Wires paired for bipolar parallel configuration


These were matched to the connectors on the G540 driver unit, through one DB-9 plug per axis (X & Z).


Coils (6 though 9) and resistor (1 to 5) connections


One last item to keep in mind before being able to power them up was the addition of a resistor. Since my motors are rated for 2.8A, I needed a 2.8kΩ resistor, unable to find one, I resorted to combine random resistors until I obtained the needed value, then bridged pin 1 and 5 with it.



Making a 2.8kΩ resistor

Resistor installed between pin 1 and 5


With all the details taken care of, it was time to turn the power on, and hope it would all work out.





Testing the X and Z stepper motors




Awesome! The biggest hurdle was already behind me, though more would surely lay ahead.


Wednesday, February 18, 2015

CNC mill conversion - part 22

X travel limit switches

One of the items I should have addressed a long time ago, that was instead put off for a rainy day, was the installation of travel limit switches on the mill. 


Typical inexpensive snap action roller microswitches


All three axes need limit switches for reference and protection, but due to the diverse physical configuration of each axis, different mounting strategies are required. 





Limit switch operation




In this post I will discuss my development of the X axis travel limits.

Travel limit switches are needed on CNC machines for two main reasons. The first is to let the computer know where the table and head of the mill are in relation to the travel stops (machine coordinates). This is usually done at the beginning of the work day, or as needed, by giving the machine the “Reference all home” command, which slowly runs the head of the mill all the way up to the stop (Z=0), and the table to the furthest right and forward possible (X=0 & Y=0), where limit switches are tripped, the motors stopped, and the mill position recorded in the software. 

The second reason is to avoid damages to the machine by accidentally driving table, or head, all the way against the travel stops, which usually consist of hefty steel chunks. Positioning limit switches just inside the physical travel stops, causes the motors to be turned off before any hard hits are realized, and any damage done.

There are nearly infinite ways to attach limit switches to the bed of a mill, some are good, and some create more issues. 

What I wanted to achieve was a scenario where a slight bed over-travel (due to high speed) would not damage the switches, plus minimize the number of parts to be made, reduce the need for adjustments, utilize any already existing and unused tapped holes in the bed, and lastly reduce switches contamination from cutting operations.

The first prototype entailed a microswitch at the far left of the table, and a cam attached to two previously vacated screw holes near the center of the bed.


Left microswitch biased ramp (version #1)


This worked in principle, but the hole pattern didn’t match (my fault), and this device didn’t address right switch activation. It was however useful as a platform on which to develop the second and final version.


New cam mostly done

Version #2 of the cam is bidirectional

New cam bolted in two unused holes

Enough room still exists on either side to access the gib screws


Installation of the microswitches required drilling and tapping a few holes in the right places, so I didn’t bother taking any pictures, but I put together a short clip of the making of cam #1 and #2.





X axis travel limit development




I’d like to end by adding one last thought regarding the number of limit switches needed on a 3 axes CNC mill. 

While it might initially seem obvious that 2 switches per axis are necessary, this number can actually swell to 3 if you choose to have a dedicated homing switch, or shrink to 1 if you choose not to, and set up and employ the controller’s soft limits function. 

Setting this up in Mach 3 is actually a pretty easy thing to do, you just simply tell the controller how far you want it to allow the bed to travel in a certain direction, and the controller will slow down the speed of the motors as you approach this imaginary travel limit, and stop it as you reach it. 

This is a fine strategy to avoid having to mount ½ of the hardware, and it works well the majority of times, but I’ve had occasions when I turned the soft limits off to perform certain maintenance functions, then forgot to turn them back on, only to be really surprised at the next crash event.

For this reason, I will use a total of 6 limit switches on my mill, with 3 of them doubling as home reference switches.


Saturday, February 07, 2015

CNC lathe conversion - part 1

The kit

One thing I still remember vividly from the days of the CNC mill conversion is how I wished I had spent some money on a CNC kit that someone had already vetted, rather than trying to save a few bucks and doing it all myself. It was an interesting quest for sure, but it claimed 6 month of my life, and while it was good for me, I wouldn’t want to do it again.

“Good judgment comes from bad experiences, which come from bad judgement.” 

Feeling like I had completed this circle, I vowed I’d play it smarter the next time around so, when I ran into a good deal on eBay for a quality CNC kit for my lathe (20% off after some haggling), I just had to go for it. The kit I purchased was made by Billy from BD Tools

BD Tools has a very good reputation in the CNC conversion community, so I didn’t waste a lot of time researching it as I probably might have otherwise done, and in this case the quality of the product I received was even better than I had expected.


Everything included in the kit

Z motor mount

¼" (6.35 mm) flex motor coupling

Apron replacement, and X motor mount.

X motor mount, longer lead-screw for tool ganging, and brass nut with backlash compensation


The guy who sold it to me forgot to include the instructions in the package, but I decided to install it anyway, while I waited for the instructions to be shipped to me.

The first shocker was that it only took me 1 day to install this kit on my lathe, versus the 6 months ordeal with my mill.

The second surprise turned out to be that this kit wasn’t as plug & play as I had imagined, but it needed a little creative machining on the mill. Not a big deal since I do have a mill, but others might require the services of a local machine shop, adding to the cost and time required for the installation.

When the instructions eventually came, they basically followed step by step everything I will show here, but operating in the blind at the time was a little disconcerting.

The first step was to strip the lathe of course, and give it a bit of a cleanup at the same time. The nakedness of the lathe made the oversize 5” (12.7 cm) chuck look even more out of proportion. 


All drive gears removed

Electronics, lead-screw, apron, compound, rack, and tailstock removed. I love that chuck!


Most of the stuff I took off will never need to go back on.


Amazing how much stuff had to go


The left ball-screw mount is a direct bolt on replacement, while the right one, at the far end of the bed, needs to be fitted in place. I mounted the replacement apron and ball-screw loosely, and spent the majority of the conversion time making sure the ball-screw had no binding throughout its entire length of travel, before identifying, marking, and drilling the bolt hole positions. 

Screw binding is a bit of a sore subject for me, as you might remember from my previous post on “curing the lathe”, so I wanted to be absolutely sure this would never become an issue again.

I cannot stress enough the importance of taking your time at this stage. Proceed carefully, run the saddle back and forth often, periodically loosen then tighten the apron’s top bolts to check for screw binding, readjust the right ball-screw mount accordingly, and repeat until no more gains are being made.


Narrowing down the final Z motor mount position

Same thing from a different angle

First hole located...

... drilled, and tapped.

First bolt installed, apron and ball-screw binding rechecked.

Next 3 holes located with a transfer punch

More drilling and tapping action

The end plate position is now final

Saddle travels along the bed smoothly

Another surprise I wouldn’t have encountered, had I had the instructions, was that the cross-slide lead-screw didn’t fit the original hole. A quick comparison between the new screw and the old revealed the new to be much beefier. So drilling it was.


Enlarging the X axis clearance hole to ½" (1.27 cm)

Another view


With the screw installed, the brass nut would catch on the right corner of the slot and the bottom of it as well, and was unable to slide freely. My initial response was to widen and deepen the channel…


Aligning the lathe's X axis to the mill's Y axis

Shimming the setup until leveled

Problem

Neanderthal solution to the problem

All better now!


… in reality, I should have made the hole a bit larger (as per the M.I.A. instructions), and a later binding issue did force me to go back and drill it again, correctly this time.


Enlarging again to 17/32" or 0.532" (1.35 cm)


Perhaps all this milling could have been avoided in the first place, I will never know, but you should be aware of the possibility of it, should you choose the same kit. The instructions did not mention this step.

One other thing you might want to be aware of, should milling of the bottom of the slot be necessary, is that there is not a lot of steel over the V way. I might have milled 0.050” (1.3 mm) vertically perhaps, and ended up opening a porthole from the cross-slide to the V way of the bed.


V way visible inside the cross-slide!


Luckily for me, that’s not a problem, but again, there might be no reason for needing to do that, if you drill the hole to the proper size first.

The mill was however still needed for the last step, which was to drill and tap two holes in the cross-slide. It turned out that the instructions did specify the locations of the holes based on some measurements, but since I didn’t have them at the time, I used a transfer punch instead, which worked perfectly.


It did take a little imagination

Drilling to about ½" (1.3 cm) 

Tapping for ¼-20 studs


After that, it was just a matter of bolting the rest of the kit on, and checking for binding one last time.


Studs installed

Bearing block fits nicely

X motor mount in place


One characteristic of the original manual lathe that had always bothered me was the unprotected lead-screw, which pretty much guaranteed that all the metal shavings would fall and collect on its lubed grooves. Not that I used it much, but keeping it free of metal chip was always a real pain. 

The ball-screw is just as vulnerable to debris falling from above as the lead-screw once was, so I decided to make a cover for it. This wouldn’t have been possible before, but with all the apron’s hardware now removed, there was just enough clearance for a hand fit cover to slide in.

I looked in my scrap bin and found a small aluminum L channel, and I ripped it on my table saw.


Ripping a scrap aluminum L channel 


I match drilled holes from the rack I had removed. 


Reproducing the rack's hole pattern


Next, I welded the ripped slice back on the other side of the L channel, at a downward angle of 15˚. 


Rigging up a cover for the ball-screw


Later, I found another flat piece, and welded that on as well, horizontally. 


Adding a little more overhang


The end result looked terrible, but with a little grinding and sanding… nope, it still looked nasty… but it fit, and I didn’t care, the screw was partially covered, and my scrap pile got smaller.


While not sealing the ball-screw entirely, it is much better protected than ever before.

From the chuck's perspective the ball-screw no longer even exists

Completed conversion, minus motors, and RPM pickup (for threading)

I might end up removing the compound to increase stiffness, but I'll leave it be for now.

The ball-screw shield was cut short to be able to remove it without dismantling the apron


A larger L channel would have probably been a quicker fit, but then I would have missed out on all the welding fun.