CNC Lathe: Electronics on the Way

July 18th, 2014

Progress Report From the Crazy Neighbor Who Never Leaves the Garage

The CNC project is moving along well.

Because the machined parts for adapting the lathe are mostly done, I’m thinking about electronics and software. I will write what I’ve learned and concluded. Some of it is surely wrong, but for someone else in my position, coming along later, it will be a lot better than nothing.

First of all, if you’re doing CNC, you should join the Home Shop Machinist board. There are other forums that are useful, but if you’re starting at the bottom, they are likely to ignore you. I have a CNC Zone account, and it’s nearly useless. HSM is friendlier.

Here is my understanding of the way a home-grade CNC machine works. You need 1) a PC, 2) an external controller, 3) a board that drives stepper motors, and 4) stepper motors.

Some people do not use external controllers. Based on what I’ve read, I think that approach is only worth discussing if you want to dedicate an entire PC to nothing–and I mean nothing–but controlling a machine. If you use your PC for music or the web while you work, it will interfere with the CNC machine, and you’ll hate life. So I am ignoring this option, and I know little about it.

The external controller takes output from the PC and turns it into signals that the stepper motors like, if I understand it correctly. Then the drive board turns these little signals into big ones that go right into the motors and make them run. Your PC’s ports can’t do that. The motors need too much juice.

To make the controller and drive run, you’ll need a power supply for them. Actually, I believe you’ll need more than one, because one powers the motors, and the other will power the computerized stuff in the boards. The voltages for this stuff–which nerds refer to as “logic”–are lower than the voltages for the drive.

If you can’t stand the thought of having your machine close to the PC, you will want an ethernet-based system. It will let you have long runs with ethernet cable. Otherwise, you’re stuck with USB. I’ve heard limiting distances described as 5 feet, and I’ve also heard 16 feet. I don’t know which is correct. I would assume that the limiting distance is between the PC and the box with the controller and drive, since the wires that go to the steppers are ordinary 4-conductor jobs with a decent amount of current flowing through them.

If you want ethernet, you will have to use a Smoothstepper drive. Sadly, it only works with Mach3 software, so if you hate Mach3 (many people do), you will be SOL. For this reason, I chose USB.

The USB solution I chose was a Dynomotion rig. They make the Kflop controller and the Kstep drive. These boards are made for each other, and they can be connected with one ribbon cable. They are sized so you can mount one on top of the other. You can run 4 motors from one Kstep, and you can screw another Kstep on top of it for four more motors. You can use other drives, but they aren’t going to be plug-and-play with the Kflop.

With Dynomotion, you don’t have to use Mach3. I guess I should say what Mach3 is.

To design a part, you may want to use CAD software, although you don’t have to. It will allow you to draw the part, with all the measurements. Then you feed this to CAM software, which turns it into something stepper controllers can eat. That something is called “G-Code.” It’s a language, like Pascal or Basic. I don’t really know how this works, but I think it will show you the path the tool will take during the operation you’re planning, and you can check it over and see if it makes sense. There are also G-Code editing programs, which are sort of like Turbo Pascal. They’re word processors for G-Code, and I believe they also compile it. Compilation is the process of turning written code into programs.

If you are a true uber-geek, you can bypass a lot of this stuff and just write the G-Code, but I think you have to give up diurnal life and sleep in a closet, hanging upside-down. I don’t think normal human beings can do it.

CAM (Computer-Aided Manufacturing) software is hideously expensive, with $1500 programs considered cheap, but there are free options, and there is a $250 program called Meshcam which is popular with unsophisticated users. They have a 15-day trial, which I plan to sign up for after the machine is running.

Mach3 comes after the CAM software, and it talks to the controller. Mach3 is user-friendly, and it has tons of users who have built up a big knowledge base, but many people complain that it’s buggy and ruins a lot of parts. Sometimes CNC doesn’t work, and when that happens, you throw out expensive metal, and you may have to jump to prevent a machine crash. The negative things I’ve read about Mach3 convince me that I should try to avoid using it.

Dynomotion makes a free product to get people free from Mach3. It’s called KMotionCNC. I am hoping I can make it work.

I know zippity-doo-dah about computer programming, having taken precisely one course over twenty years ago, but I believe G-Code is based on C, because CNC people keep saying “C” when they discuss it. In any case, you have to be able to do a certain amount of programming in order to survive, because none of this stuff is really ironed out well enough to trust.

I downloaded a free G-Code editor called RapR3D. I don’t know if it’s any good, but I’m sure it will suffice to get the basics into my head, and that’s all I’m after at the moment.

I have a Kflop, Kstep, and power supply on the way.

Power supplies are extremely confusing. The motors are generally rated for between 2 and 5 amps per phase, and the voltage ratings are below 10, but you are expected to use power supplies with output voltages up to 25 times as high as the motors’ rated voltages. This is normal. The motor specs will not tell you how high to go. I ordered motors that go around 3 amps, and I have chosen a 48V power supply. I know it will work. Other people have used it. You want a lot of voltage. It makes the motors jump around better.

How do you determine the amount of current you need? You multiply the current rating by the number of motors, right? Right. If you listen to people who don’t know anything. In fact, you don’t need to go higher than 2/3 of this number. People will argue about this, but they’re wrong. The motors will draw less than the rated amount of current, because you will be “microstepping.” That means that instead of going a full step with every pulse of juice (1.8 degrees), you will move through a smaller angle, or “microstep.” The motor will produce less than the rated torque, but that’s okay, because you don’t need the rated torque. If everyone else is using 300 oz-in motors for your application, you can use them, too. You don’t need to know exactly how much torque you’re getting. Does the machine run? If so, you have enough torque.

I would like to have a second machine on my system, and that would be a mill. It could have as many as 4 motors, making a total of 7, including the lathe. I can do that if I get a second Kstep board. But I’ll need current for 4 big motors, not 2 medium-sized ones. The big motors are rated at 5 amps. That means I’ll need 13.33A, or 2/3 of 20A. There is a well-known guy called “Hoss,” and he built a Grizzly G0704 CNC mill. People told him he needed a huge power supply, but he put out a video running three axes simultaneously with a small one, and he never hit 4 amps. He says he would be happy to use a 12.5A supply for five axes. I believe him. He certainly knows more than I do. I ordered a 16.7A supply.

I don’t know why the current draw is so low. Maybe it’s the microstepping, or maybe the current comes in little pulses with breaks between them. Maybe it’s because the voltage is so high, you need less current. But I’m confident that the 2/3 figure is correct. The people at Gecko drives agree.

There are two types of supplies. Regulated (“switched” or “switching”), and linear (“unregulated”). The regulated ones have voltage regulators, and they’re made with flimsier components. Unregulated supplies are supposed to be sturdier, and they have various other advantages which I can’t remember right now. I do know this: switching supplies require fans, and if the fans fail, they fry. Dust–not a rarity in garages–kills fans.

Hoss uses a cheap switching supply in his video, but for me the price difference between regulated and unregulated was about ten bucks, so I went with unregulated. Delivered, it will be $141.00. Was it a waste of money? Probably, but ignorance is expensive, and at this stage, I am ignorant. I want to be safe. I would rather buy one pricey supply than a cheap one that blows up, followed by a pricey one.

I’m going to need a box. I’ll mount the Kflop/Kstep combo in there, along with the power supply. I will need a repurposed wall wart to power the logic circuitry. Wall warts can’t really be hardwired, so I suppose I’ll stick a cheap power strip inside the box and plug the wart and PS into it. That’s easier than trying to cut up a plastic wall wart case.

If things work out, it will go like this: PC >> USB port >> Kflop >> Kstep >> steppers >> cool parts >> joy.

This is not a simple project. The user end of the technology is extremely primitive right now. I told someone my dream was to describe parts orally into my cell phone while driving home, and then to find them finished when I arrived. I was kidding, but anyway, it’s nothing like that. You have to know a fair amount about electronics. You have to learn some programming. You have to be able to debug things you know little about. On top of that, before you begin, you have to be a machinist. But the reward, even at this late date, is that you’ll be a decade ahead of everyone else. I seriously doubt that even 3D printers and routers, which are pretty simple compared to other applications, will be in most home workshops within five years.

It’s turning out to be expensive. I’m sure it will be over a thousand dollars, not including the lathe and tooling. And when it’s over, I’ll have a lathe, which is possibly the least-exciting CNC tool. It’s so unexciting, the vast majority of CNC hobbyists are doing something else. It should be very useful, though. Once you buy a lathe, it takes about thirty seconds to run up against a job you absolutely cannot do without CNC, a tracer, or gears you don’t have.

One nice thing about this is that the first tool is the biggest hump. If I add a mill, I won’t have to buy new software or a new controller. I’ll just need the drive board, a machine, and the steppers.

CNC mills are incredibly cool. Go to Youtube and see. You can make stuff you would not believe.

Someone told me I should have CNC’d the big lathe, because the cost would be similar, and I’d be able to do more stuff. I’m not ready to screw up an investment that big, but it may happen later.

This is where I am today. There are probably about 300 errors in what I wrote, but I’m going forward anyway, because you can’t solve all your problems by theorizing. Eventually you have to have a project sitting in front of you.

My guess is that I’ll be able to make a part by August 17, one month from today. I think that’s a very reasonable goal. I am hoping I’ll be good enough to get practical use from the machine a month after that.

It’s very exciting. I will keep you informed as I go.

5 Responses to “CNC Lathe: Electronics on the Way”

  1. og Says:

    G code programming actual.ly consists of G codes, M codes, and arguments.
    First you must establish a zero point in X and in Z, which lost people think of as the center of their lathe spindle (x) and the face of the chuck (z)

    You will start at a “Home”position with your tool quite some distance away from zero- say, two inches in X and ten inches in Z.
    Say you have a 1” bar. It is chucked in the chuck and sticking out four inches from the chuck face. You want to turn 1” of the end down to .900” in diameter. Your G code will look like this:
    S500 M3 (turns on the spindle at 500 rpm)
    G00 X .900 Z4.100 (moves from the “Home” position to a point just in front of the bar)
    G01Z3.00 F60 (makes the cut at a feed rate of 60 inches per minute)
    G01X1.1 F60(Retracts from the part)
    G00 X2.0Y10.0(Returns the cutter to the start position)
    M5 (Turns spindle off)
    (Some controls allow you to program based on diameters, but some make you do radial dimensions)

    G code is so simple you should be able to teach it to yourself in an afternoon. And then spend the next twenty years refining those skills, because even though the bsics are very simple, you can do incredibly complex things. Here’s a very simple primer in G code.
    http://youtu.be/4DvqpfZY_bo

  2. Jonathan Says:

    Any plans for 3D printing?

  3. Steve H. Says:

    Right now, 3D printing is the lowest thing on the shopping list. The parts people make using 3D are flimsy plastic, and they seem pretty lumpy. I know a day will come when printing in metal, with decent resolution, will be possible, but as of today it seems like most printers are toys.

  4. UnStayBull Says:

    This is an exciting quest you are on. I was admiring acorn nuts at the hardware store today. I’m barely a wood butcher but I could catch metal fever pretty easy.

  5. Steve H. Says:

    I think the best advice I could give to someone new is to start with small machines, unless you really want to make big parts. The small machines can be moved by one person, they cost less, the tooling costs less, they take up less room, and you can do all the same stuff that you would do with big tools.

    If you don’t care about room or expense, then GO BIG!