Using a digitalized dividing head as a +1 axis

Just got my 770M a few weeks ago. Learning more every day.

5 years ago I bolted a “smart” stepper motor on to a small dividing head for the purpose of making it easier to use and to do hard things like cut a 127 tooth gear.

The stepper motor has a built-in (more like bolted on) smart, configurable controller that you send simple ascii commands to over an RS425 serial line.

I wrote a user interface for it in Python - you can move (rotate) any angle you want and can set intervals to advance ( 360/127 for 127 tooth gear etc). It works great. It was for my manual mill, so it’s move, lock, cut, unlock and move again.

So my question - considering this is pretty much a home made 4th axis for a 3 + 1 setup where the 4 axis is just for positioning the work (it couldn’t handle simultaneous moving while milling).

What does it take to get this the rest of the way there to use with pathpilot?

Can pathpilot control another axis via a serial connection? how does it communicate with axis control modules in the cabinet for the 3 axis?

It feels to me like my dividing head is pretty close what I need. I could easily write code to do whatever “translation” might be needed. But I’m totally in the dark about how the motion commands get from pathpilot to the controllers for any give axis and what that control interface looks like.

-Dave

The simplest approach is to add a 4th axis driver to the cabinet using the existing interface. Then use that driver to run the stepper. You can buy the driver kit from Tormach which will plug into the wiring that’s already in place or you can buy any random driver that has the appropriate power output for your stepper and manually wire it up.

Once that’s done, you’ll need to modify the axis3 scale factor in pathpilot to compensate for the steps per revolution you have set on the driver as well as the gear reduction of your dividing head. In the file structure, find the folder with the current PP version number. There is a file in there with all the preset axis scales. For the 4th axis there are 2 options, one for the MicroArc (4") and one for the larger tables. Choose one or the other to modify.

The calculation for the scale factor is:
Steps per rev / degrees per rev = scale

So in my case, I had my driver set to 2000 steps per rev and my dividing head had a 40:1 reduction so:
1 stepper rev = 360 degrees/40 = 9 degrees per rev
2000 steps per rev / 9 degrees = 222.222222

Note that changing the scale requires a reboot and any future updates to pathpilot will require you to change the scale again.
Once you’ve changed the scale and rebooted, select the 4th axis that you modified from the settings tab and you should be good to go.

That’s everything I can remember about how to do this. My homebrew worked really well for a good long time but eventually I replaced it with a microarc so I don’t remember some of the specifics like the actual wiring pinout or the specific location of the file that needs to be modified. All of that can be figured out with some google searching though. Buying the driver kit from tormach will save you the wiring hassle which was the hardest part for me but it is definitely a more expensive path than sourcing the components yourself.

I already have this, it’s tiny and physically attached to the stepper I’m using. I went with this choice because it required no external “stepper driver”. You configure and control it and it over a serial line with standard set of motion control commands and some extended ones for this specific stepper controller.

What I don’t understand or more accurately don’t have the details on is how the pathpilot communicates with the “4th axis driver” (that I don’t need to install in my cabinet because it’s already installed at my stepper motor.)

Ideally, I just need to run an RS485 cable from my cabinet to the existing 4th axis driver on my dividing head’s stepper motor.

If I can use a “random driver” then presumably the interface to the driver is known and published and it’s not a Tormach proprietary thing (they seem to be pretty open about stuff).

Any examples of a suitable 3rd party axis driver?

What I’m wondering is: does pathpilot talk the same motion control commands that my existing controller uses?

OK - just took a better look in my cabinet (yes, should have done this first - was really just floating an idea here).

The ECM board talks to the axis controllers at about the lowest level possible for steppers - 3 signals, pulse, direction and enable. Uses 6 wire for balanced signaling. So that’s a non-starter.

The ECM board does have a non-used RS485 connector, so either you can talk to it via serial RS485 or it can control RS485 devices.

So it seems that the level I’m looking for happens in the controller/computer that’s running mint Linux and (a variation/derivative?) linuxcnc.

So what I’d be looking at is configuring it to talk RS485 to my dividing head. Which is probably not going to play well with pathpilot / Tormach as I’d be making substantial configuration (at least) changes outside of what they support.

I’ll go poke around with linuxcnc

Correct. The interface to the stepper drivers is a step and direction pulse. Arguably enable isn’t necessary although bypassing it and leaving the axis enabled could be a safety concern if you were to ever need to estop the machine and your 4th axis was able to continue moving.

You could potentially run a serial connection over USB. That’s done for things like the ATC, smart cool, and USB i/o module and it’s fairly easy to add non-factory accessories that way (I built a smartcool clone that pathpilot thinks is the OE thing) but all that will run off existing code within PP. Changing the output of an axis from the step/dir interface to something with a serial interface would certainly take a lot more effort. Enough so that, were it me, I’d just swap steppers and drivers rather than having to rewrite the machine’s OS.

I suppose you could build an intermediary device to convert the step/dir signal to a serial signal but that extra translation might lead to instability or timing issues.

This is largely just a “is this possible?” question right now. I’m getting closer to an answer.

Looking into linuxcnc - it seems the way to do it would be to create and load a user space, non-realtime HAL component. This can be done in Python and could easily control my dividing head over serial.

Rather than implement pins for step and direction, it would implement a float value for angle or some such and a couple of status signals.

Then I guess I’d have to modify / create a post processor for gcode that would interact with these signals instead of wanting to drive the 4th axis stepper.

So:
Can I create a post that does something different for rotary axis moves?
(probably). Note that these moves would always be independent and isolated from moves in other axis. This is a 3 + 1 setup not true 4 axis.

What gcode needs to be produced to interact with this HAL component I create?
The real question here is how do/can I interact with my device from gcode.

If I really can’t make this work, I’d just go with an off the shelf solution from Tormach and ditch my stepper controlled dividing head. It’s not worth cobbling together another controller and stepper and bolting it to the dividing head. The head is a repurposed free gift.

The post and gcode are a function of the machine controller so what you need from there depends on how you implement the communication from the machine to the stepper. If you replace the existing step/dir output to a serial stream, then the gcode doesn’t change. The machine controller would see the 4th axis movement commanded by the gcode and output the appropriate command to your stepper, causing it to move. This part I have very little knowledge of as I have never bothered to do a deep dive into the HAL components of linuxcnc or pathpilot.

If you were to implement something different from this, then you would need a different post implementation as well and that would depend on the software you’re using for cam. In this scenario you could either replace the logic in the multi-axis sections of the post to generate whatever command your HAL interface is looking for, or, since you are only looking for 3+1, the easier solution would be a manualNC command (in fusion, might be called something else in other softwares) where you just pass through a string to the output.

Again, only my opinion here, but what you’re talking about is an awful lot of work for very little functionality, in an effort to avoid spending a small amount of money. The ability to position an extra axis is great but much more powerful is the ability to wrap tool paths when needed. Considering the path to that result involves only a small amount of code work and wiring, and the cost of the necessary parts will be far less than buying any of the off the shelf 4th axis options. As I recall, the total cost of my build, including the dividing head, driver, stepper, wiring, connectors, etc. was something like $350-400.

One other alternative would be to use the I/O capabilities already built into pathpilot. Interfacing an arduino to mimic the factory I/O board would allow you to use M codes to fire off an output, triggering a serial stream from the arduino to your stepper driver. Combine that with a method to tell the arduino what your 4th axis increment is and you get the functionality you want, without any changes to pathpilot, no post processor work, and no crazy wiring. USB to the arduino, a reasonably simple sketch, and a potentiometer or keypad to enter your increment.

So I finally had a couple of hours to get setup properly with vscode and the Autodesk Fusion Post Processor Utility. Once I learned how to actually use it, it took less that 15min to find line in the post processor that spits out A axis move.

And it would be a one line change to have it command something else with the rotation position.

So that part of the problem is phenomenally easy.

The Autodesk post processor extension lets you click on a gcode in the posted .nc file and it will jump you to the line in the post processor that produces it. Extremely useful debugging or modifying a post processor.

I’m a software guy with a lot of experience, doing the above was pretty much what I do everyday in an entirely different domain.

So the only piece missing is how to map a new or unused gcode in the controller to command my dividing head rather than moving the A axis. From what I’ve already read about pathpilot and linuxcnc, the ability to load new user component is exactly what I’m looking for.

I just need open a shell terminal on the controller and see if the hal commands are available and if it’s feasible for me to add a component to drive my dividing head (via serial commands). Writing the component is no big deal for me but will take some time.

The CNC mill is brand new to me - I’m still just learning how to use it. So I’m not really anxious to augment the control system until I’ve checked out and have become familiar with it.

I’m presuming that Tormach is pretty open about adding enhancements - at least to the point where they don’t prevent it. The ability to easily extend the functionality of my CNC mill is just fantastic. I didn’t really expect that would be the case, and didn’t do my homework first to find how how “open” a machine it is.

As far as the “very little functionality” - having a 3 + 1 (rotary) capability is very valuable for me. I cut my own gears and doing so manually is time consuming and error prone. This is I digitized my dividing head in the first place.

Setting up a job to cut a 127 tooth gear and being able to walk away until it is done is a huge win AND I already have the digital dividing head.

The only cost is my time (using skills I already have)
I also get to learn how to customize my CNC mill for future additions.

It is highly likely that I will eventually get the microARC 4 in the future, currently that’s listed as a $3200 investment for the axis and driver kit.

My existing hacked up dividing head sound a lot like what you did - total cost was in that ball park, a few hundred dollars. I did go a different route with the integrated controller and stepper - significantly more than just a stepper. I made that choice because it provided exactly what I needed and I didn’t have to do any wiring or electrical work other than hook up a power supply and a serial cable.

Anyhow, it will probably be a few months before I get around to trying this. Still learning how to use the machine.