Author Topic: positional 4th Axis  (Read 906 times)

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1889
    • View Profile
positional 4th Axis
« on: October 31, 2025, 02:24:32 am »
I had a look at the old lathes headstock recently and stripped it down
and painted it. The bearings are ok, I've gave them soaking and  repacked them
and installed the spindle.

What I had planned to do was sit it on a pedestal and use it for buffing and wire brushing.
After inspecting the bearings, I've changed my mind and will try to make a positional 4th Axis.

There are some quite nice builds using Harmonic and cycloidal  drives but these are too  fancy 
for my use case as I don't want to make a 4th Axis that can cut metal whilst moving, just a positional 4th Axis so
move to an angular position, index spindle (lock it), machine feature, rinse and repeat.

The sanest thing to do, and a fall back position if all else fails, is buy or make some indexing
plates for a spindexer and make a mounting with the 10 ths holes and be done with it.

I had a look about in the larder and the only motor left is an old Reliant Nema 34 motor and I do have a drive to suit.
Using this motor in open loop mode and the belt and pulleys would be the simplest way.
I'm not going to do that though.

So the idea is to fix a 3 jaw chuck and face plate type 4 jaw which could have a small vice.
Because I want to run a series of sequential drilling and tapping ops I don't think that the open loop stepper
will suffice alone even with gear reduction and some microstepping.

A closed loop stepper is better as the position is not reliant on the step angle of the motor but you are
measuring the angle of the motor not the spindle and would still have to make sure that the spindle doesn't move whilst being locked into position.

What I'm going to try is to mount the encoder on the spindle and run the stepper motor in closed loop
mode (with an esp32 ) and use a parking procedure where the caliper snugs up on the rotor during the last
bit of the deceleration phase of a move, to do this I'm going to try using another small stepper motor and a differential thread to activate the caliper.

Drive = 30 teeth
Driven 120 teeth
I'm going to use x 8 microstepping.

I do have leadshine drives which require 24 volt and my lab power supply only goes to 15 so
for testing and debugging I'll use the easydriver boards as they can run happily at 12 volts.
I'll use the Mach3 usb board as per the tapping head.

I would like it to have a manual mode where it's not connected to the controller.
I would like to be able to use a terminal program (like realterm\putty)  semi manual.
I would like to use the drilling and tapping plugin to write the positioning gcode to drill and tap
a hole. 

Dave







Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5320
  • Made in England
    • View Profile
Re: positional 4th Axis
« Reply #1 on: October 31, 2025, 14:03:05 pm »
Dave,

Would it also work in a vertical position like a rotary table ?
As an aside I've been watching an excellent youtube channel called, "Cutting Edge Engineering Australia", it's worth checking out.
Filmed in Supermarionation

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1889
    • View Profile
Re: positional 4th Axis
« Reply #2 on: October 31, 2025, 23:38:12 pm »
Hi Eddy

Would it also work in a vertical position like a rotary table ?

Unfortunately, no, it's just too big, (see pic) what I would like to do is cut gears and splines in plastic and
aluminum, and be able to mount a carburetor bowl from vintage machinery and re spot face the threaded holes and clean up the thread.

Years ago I had a look at the problem when I had a lot more hair and a lot less experience, and
there were spindexers, rotary tables, universal dividing heads, and a fancy one call a plug grinder.

What I realised was the accuracy was in the plates and locking mechanism.
I graphed the error in a simple system, I used CB to polar array a line at 1.8 degrees steps and at
a pcd of 150 mm and at the circumference of the workpeice the error was 0.49 mm steps

I then mapped the +- error in the stepper motor 10% or 0.18 deg you don't want to microsetep down into that area
as you have no idea where you are without mapping this is why I'm microstepping by eight and not 10, and using 4 to 1
gear reduction which is still not enough resolution really.

I do have two industrial encoders an 360 ppr and an Allen Bradley at 5000 ppr.
The 360 ppr is not suitable and the AB one is two expensive to use on something that I'll use once in a blue moon.

I had ordered some AS 5040's 1024 ppr for the tapping head but decided not to use them
They are no good for this task either, so I had a look at some 21 bit encoders which would provide
up to 2000000 ppr although after filtering and signal conditioning 100000 ppr was reliable.

This was to much for the micocontroller  and the other problem was that I'd have to drive it
from the spindle shaft where it would be easy to knock about.

I've been thinking about a 4th axis on and off for years but it is a difficult problem and a standard open loop
system won't be up to the task, a closed loop stepper would be better but the encoder
is on the motor and not the spindle so any transmission error caused by backlash in the system
(caused by brake engaging) may move the spindle slightly without the motor compensating for it.

Having the encoder on the spindle can be problematic as if there is any appreciable backlash in the system, perhaps two rollers
connected together with gears or a rack and pinion then the controller can oscillate.
 I think I'll be ok here as I wrote my own pid routines I clamped the I value in the PID to a quarter of the total output so that the system could not saturate.
Maybe in a few days I'll have the machining done so that I can bring it inside and start coding.

Anyway while looking about on utube at 21 bit encoder vids I saw this
https://www.youtube.com/watch?v=MgQbPdiuUTw
(I'm glad I did) this guy legit knows his sensors, I'm really impressed with his project.

 I want to use those AS5040's like he did I don't need the impressive resolution he needed but if I orientate the
magnets like he did I don't have to have the encoder hanging of the end of the spindle.

Quote
"Cutting Edge Engineering Australia", it's worth checking out
Yes I do watch him I much prefer real humans rather than the overwhelming amount of AI generated stuff.

Edit: had trouble inserting hyper link
Dave
« Last Edit: October 31, 2025, 23:46:19 pm by dave benson »

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1889
    • View Profile
Re: positional 4th Axis
« Reply #3 on: November 03, 2025, 00:12:53 am »
I got a chance to do some more today and gave it a test run, as an aside I really wanted to use the leadshine drive so
looked in the manual DM556 and it said 20 to 50 volts, I gave it a go anyway
and set the drive to minimum current out put and feed it 15 volts, the drive fired up and I plugged it
into the mach3usb board and configured the axis I got to run with the settings in the pic.

About 22 rpm it stops and starts quick enough and has enough torque to do the dynamic braking tests.
With a 24 volt 10 amp supply and this gearing it should have good torque up to 75 rpm.
I'm waiting on the brake line fitting, so can't do much more with that, except model the activation mechanism.

At this point I have to decide what the interface should be, I do like the idea of using the tapping head power and signal lines
via a plug, however I want to use the tapping head in conjunction with
4th Axis so would have to get another switching power supply.
There's no room left in the control box so I would have to get another smaller box to house the power supply and driver this would be pretty straight forward if a bit messy.

I did check and there seems to be enough bandwidth in an espnow bluetooth link to do 30 rpm, this would require
two esp32's one as a port sniffer connected to the break out board.

I had a look at the Xaxis\Yaxis wrap pp's and the wrapper plugin along with the drilling and tapping plugin.

The tapping code ran through, the only modification required being to set the rollover in the mach3 general
config as this 4th axis wants the dro to roll over to zero and the tapping head doesn't.

I used the Xaxis wrap pp and placed the geometry in different planes using linear and polar arrays and
laying the circles along the X axis.

I discovered that if I laid out the circles along the X axis spaced as 1mm = 1deg, then the x values the pp
outputs are the the A axis values I then hand edited the file inserting the (A) axis values
and it worked, the file ran through. For my purposes, drilling a radial bolt hole pattern on the periphery of 
of a disk I would not want the x and y axis's to move until all of the holes are done.
What the hand edited code will do is drill holes in a spiral pattern.

Dave

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1889
    • View Profile
Re: positional 4th Axis
« Reply #4 on: November 07, 2025, 12:06:29 pm »
The brake line fitting came so I fitted it and I bleed the system, the brake is surprisingly
progressive, I needed to see just how much plunger travel was required so as to make the activation system.

I left the brake activated overnight with a load on it too see if it didn't leak down, it's ok
To see how much holding force it had, grabbed a 450mm shifter and clamped the head down
to the bench top, and tried to make the brake slip, it didn't so I put an indicator on the brake bracket to see if it was
bending under load as the bracket hangs over the casting cantilever style, I had thought that it might give a little, even though
it was 12mm plate and added another 12mm gusset that extents about halfway along the beam, so the caliper is cantilevered about 30 mm.
 it'll be fine for the cutting forces it will see.

I've ordered two esp32's, the 21 bit magnetic encoder from the video as well as the magnets, I wasn't sure at that
point as to how many I might need so ordered 200 since then I did the math
and I need at most 50.  ::)

What I want to do, is put the encoder wheel inside the casting along with the other electrical components.
For the power supply situation I 3D printed an adaptor for my power tool batteries, 18 volt and this worked  ok
 it gave a little bit better performance, from 22 rpm to 44 rpm with some acceleration
as well I was able to up the drive current to 3.2 amps rms.
 
I connected it and ran a few more Gcode files, and just for drilling and tapping radial holes
it's performance would be ok if a little slow.

This was a shame as I already had the batteries for my power tools, as 3D printing the adaptor worked so well, I ordered
a 36 volt impact driver that comes with two 15000 ma batteries that use the Markita battery pattern, so I'll print an
adaptor for one of those and run the main motor at 36 volt with the leadshine drive and the brake motor at 24 volt using the easy driver board.
I ordered a 2.8 in touch display for a GUI so it can be operated manually.

Dave

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1889
    • View Profile
Re: positional 4th Axis
« Reply #5 on: November 11, 2025, 12:18:34 pm »
Another small update.
The micro-controllers turn up and I've programmed one as a 4th axis.
I'll get time tomorrow to finish the machining,and to attach the brake servo.
The encoder and magnets haven't arrived yet.
I can't exactly measure the clearance available inside the housing without taking the spindle shaft
out (it has to come out to put the encoder wheel on), the brake motor is a Nema 17 + gearbox 3 N\M
I had to machine the master cylinder and install an outboard pilot bearing to support the shaft.
Dave

Offline Dragonfly

  • CNC Jedi
  • *****
  • Posts: 2678
    • View Profile
Re: positional 4th Axis
« Reply #6 on: November 12, 2025, 16:33:39 pm »
Is this intended to work in conjunction with Mach3? If so, how is the micro-controller communicating with it?

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1889
    • View Profile
Re: positional 4th Axis
« Reply #7 on: November 13, 2025, 01:48:05 am »
This is how it will operate:
1 Manual using the touch screen. Enter a value hit Move.
2 Connected to one of mach3's rotary Axis A,B,C the usual way with a cable that plugs in.
3 Wireless using one of the flavors of bluetooth.

Option one is mandatory, the word manual has connotations of 'simple' but this is the most
sophisticated mode as it will re-attempt a 'positional move' if the positioning fails, if it cannot
find position it will go through its medic routines, checking sensors, if all else fails it will halt and flag an error.
This method doesn't care what controller is used.

Option two just requires you to plug in the Axis cable, Signal ground, step\dir and brake.
The drilling plugin can be made to generate Gcode for this.
This method also is not dependent on what controller is used.

Option three is bluetooth, they can be BT classic like the turrets, this is very much controller dependent, as it requires a plugin to be written for Mach3.

To get around the controller dependency, I've ordered an extra micro-controller  and will make a port sniffer, this very
much limits the speed of the Axis as its dependent on the available bandwidth.
The abacus tells me about 30 rpm max.

Just right now I've finished the machining for the brake and have bought it inside for testing.
Well version one anyway, I've discovered that the 27 to 1 gearbox is back driveable so must be
energized for the duration of the machining, this is no big deal but wastes energy unnecessarily.

What I wanted to do was use a differential screw or an over center toggle mechanism which
means that the brake can be activated and the motor can be turned off.

I may have to do this in the end but using the present method is quite compact.
I haven't modelled it yet but a snail cam with a dwell might fit without modifying the existing
mechanism, and would allow the motor to be turned off.

This has the benefit of not losing position if the batteries go flat.
I've looked at the schematic and code for the device in the video, and I can't implement FOC
with the Easydrivers that I wanted to because they don't have separate individual pins for current control
of each phase.

Dave

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1889
    • View Profile
Re: positional 4th Axis
« Reply #8 on: November 15, 2025, 01:48:53 am »
Another small update.
The magnets have turned up but not the encoder or the Impact Gun (so I can use the battery packs)
I set up a series of tests to check the accuracy and repeatability of the Axis when the parts arrive.

I used CB to make a target strip (compensated for being printed on a flat plane rather than a curved one) at 600 mm from the centerline of the chuck and one at 2 meters.

I had ordered a focus-able laser pointer, what turned up was non focus-able so the beam diverged a quite a bit at 2 meters, making the center of the beam had to discern.

What I did was place my drill vice with a piece of sheet metal at the target distance with the thin edge facing the laser beam, which illuminated brightly when hit.
 I wrote a bit of Gcode to cycle through various angles and return to zero.
The motor driver is running at 15 volt and the minimum current so the tests at this point are invalid accuracy and repeatability wise and must be done when the drive is powered correctly.

The only thing I can  determine at this point with some degree of confidence was if the spindle would move as the brake activated.
 
I'm very happy with the brake, at no point did the spindle move while being activated or released.
I accidentally left it on overnight in the activated position (powered up ) and it didn't  move, the driver and motor were luke warm.
 
I would like to leave it in the activated position, brake on, powered off, so will make a friction clamp that can be slid along the mounting post and lock it.

I did a test where I put that half meter shifting spanner in the chuck and slowly let it descend under it's own weight its very nice as there's
no detectable stiction which would cause the load to jump or jerk about. There's lots of resolution too, so if I had a project were I needed to
lower a heavy weight with some delicacy and finesse I wouldn't hesitate to try this.

 As I couldn't do much else until the batteries come I went over to the FOC website and read the manual and looked at the examples, there's one
example using an H bridge which I have and will run at 12 volts where foc can be implemented so I do this for now using the 10 bit encoder to
do the debugging and testing.  They both connect the same way so I swap out the 10 bit for the 21 bit when the batteries come.

Dave

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 9075
    • View Profile
Re: positional 4th Axis
« Reply #9 on: November 15, 2025, 12:36:27 pm »
"I would like to leave it in the activated position, brake on, powered off, so will make a friction clamp that can be slid along the mounting post and lock it."
------------------
Be careful of that!  I don't know the alloys or geometries of your brake, but brakes and clutches will often rust-mark their mating surfaces if left engaged for long periods of time without use.  Such a mark can make for VERY rough starts and stops.

Like I said, I don't know the character of your brake, but I'd evaluate it for that potential if I were doing it.

Lloyd
"Pyro for Fun and Profit for More Than Fifty Years"

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1889
    • View Profile
Re: positional 4th Axis
« Reply #10 on: November 16, 2025, 01:14:41 am »

What I was thinking was, that if I was part way through a job, maybe cutting a gear and
having to stop for the day and turn the axis off and restart it the next day then the axis is
still in a known position, say 90 deg, its important that instead of using the sensor angle,
(it may have auto calibrated) or you calibrated it in your code at startup then the angle
reported from the sensor might not be exactly 90 deg anymore, if the drive is locked up
and cannot move then its prudent to set the angle variable for the axis from your stored
value, and add an offset to the angle variable reported from the sensor on this new startup.

Here's a little bit from the data sheet for the 10 bit encoder.

Quote
The maximum non-linearity error on this example is better than ±1 degree (inner circle) over a misalignment radius of ~0.7mm.
For volume production, the placement tolerance of the IC within the package (±0.235mm) must also be taken into account.
The total nonlinearity error over process tolerances, temperature and a misalignment circle radius of 0.25mm is specified better than ±1.4 degrees.

No good if you're making a gear.

The 21bit encoder turned up.

Even with that encoder, its one thing to measure something, quite another to move a real world object with
mass like a spindle, minuscule amounts.
Its a hard problem.

I don't know what the accuracy or repeatability will be, I don't think it will be extraordinary.

I don't have an independent way to measure the angle with any accuracy so I'm going to cut some facets
on a piece of round and measure them.
   
Dave