Author Topic: BLDC spindle  (Read 536 times)

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1645
    • View Profile
BLDC spindle
« on: August 19, 2022, 07:05:17 am »
While fiddling around with the drilling plugin, the spindle drive while being
for the most part very reliable was very heavy the motor goes up and down with the
Z axis.
I looked up the weight of the motor (11.5 Kg) plus the foot mounting plate (12 mm steel)
and the step idler and drive pulley's about 13 Kg all up.
The motor was a standard single phase AC at ½ hp @1330 rpm.
With the step pulley's there were 9 theoretical speeds but in practice I used 5.
From 400 rpm (bit fast) to 1780 rpm.
I had a look about for an alternative and some of the considerations was that it be able
to rigid tap, be lighter, more powerful and variable speed.
While looking at Utube for BLDC servomotors I found a guy selling 750 watt 220 V
BLDC servomotors originally designed for industrial sewing machines as a kit for

I did have a look at the driver to see if I could hack it to work with Mach3, and I found that I could
control the speed, not the direction though (well very easily), I looked at some suitable industrial
drives and they were not all that expensive  $120-$200 and offered many input options, enabling
me to use the motor as a velocity or step and direction positioning  for rigid tapping.

I ordered one and it came a couple of days ago, I installed it saving 9 Kg.
I replaced the hall sensor with a 10 turn 5K pot and a vernier reducer to get
a bit finer control.
The motor came with two pulley’s 75 and 50 mm.
I used the 50 mm which matched the 100 mm spindle pulley.  (this makes the drive readout)
exactly twice the spindle rpm. The spindle pulley has five steps and the motor mount can
move to accommodate a new belt position for higher speeds.

I started off with some tests using a 14 mm end mill in mild steel.
I started with 0.1 mm depth of cut and went to 1 mm with feedrates of
80 mm\min to 140 mm\m with a starting speed spindle speed of 200 RPM
and worked up to 680 RPM 0.09 chipload, feedrate 240 mm\m  giving 27 m\min just
shy of the 30 m\min surface cutting speed for mild steel.

I was curious to see if the motor would cog at it’s lowest speeds and heavy cuts.
It was very consistent judging by the pattern left on the material.
Throughout all the tests, which lasted for about half an hour the spindle motor did not
get warm and it ran continuously.

I also ran a Troc pocket 4 mm deep at full depth of cut in mild steel.
This was a copy and paste from a work file which I’ve ran many times so new that
there were some heavy cuts, which would test out the spindle.
I ran the job 6 minutes, it ran fine, so I progressed up to 280 mm/minute From 140 mm/minute
and doubling the spindle speed.
The motor was almost silent and had plenty of torque (10 Nm) and with the 2:1 pulley ratio
20 (Nm) at the spindle.
I’m going to run it for a few weeks in it’s current configuration to see how it goes.
If it performs ok I’ll get the drive I spec’d for it and connect it to Mach3 so that I can do rigid
tapping, leaving the tapping head servo and gearbox for a 4th Axis.



Online lloydsp

  • CNC Jedi
  • *****
  • Posts: 8710
    • View Profile
Re: BLDC spindle
« Reply #1 on: August 19, 2022, 11:12:53 am »
I have two 4' x 8' bed routers I use for customer work.  The older one has much smaller steppers than the new one, and just as heavy of a Z-axis assembly. (about 28 lb)

To solve that, the manufacturer added a 1" i.d. 'balancing air cylinder' which exactly cancels the Z-axis weight, when its pressure regulator is properly adjusted.


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

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1645
    • View Profile
Re: BLDC spindle
« Reply #2 on: August 20, 2022, 13:13:13 pm »
The struts can be a good solution.
For me the Idea that I could replace the single phase motor and it’s sundry step pulley’s
and the tapping head with one unit appeals to me in it’s simplicity as well as it’s weight
The Z Axis looked  rather like a disheveled Christmas tree with all the bits
and pieces bolted on to it. The new motor is ¼ of the volume of the old motor and pulleys.
For the kind of work I do, maybe 95 % would be 2.5 D so even when I mistakenly entered
a quite low Accel for the Z Axis, it didn’t have any impact on the mops I run and I only
discovered the error because the hole finishes for smaller drills were not being performed.
So I have modest requirements for the Z Axis as compared to routers.

The driving reason behind the modification is to be able to vary the spindle speed and
feed rate in the feed rate adjuster to be able to set a constant chip load rather than slowing
down the feed rate without adjusting the spindle speed.


Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1645
    • View Profile
Re: BLDC spindle
« Reply #3 on: August 27, 2022, 15:03:28 pm »
I’ve had some time to evaluate the motor and controller, on the whole it’s a good thing.
It’s small, powerful and quiet, It must be pretty efficient as it’s not getting hot or even
The controller starts up at 400 rpm and with my two to one gearing, the spindle starts at 200
going to 1750 in steps of 50 rpm.
Once set at a speed it seems very consistent judging by the machining pattern.

As I mentioned earlier, I wanted to be able to vary the spindle speed with Mach3.
To this end I’ve ordered the controller  A ZM 705A.
It’s a little more capacity (If I get around to do tapping) and runs from 100 rpm to 8000.
It also rums of mains so no power supply.
So for routers you would need one that could do 20000 instead of this one.
The controller is supposed to come setp 9.

In the meantime I’ve re-written the Feed rate adjuster to do constant chipload machining.
I couldn’t do this earlier as I didn’t have a variable spindle to test and debug.
What happens now is that, the feed rate is slowed down the higher the cutter engagement.
but the spindle is spinning to fast now causing very light chiploads.

I’ve included a .nc file the new constant chip load feed rate adjuster  makes.
It runs on Mach3 It’s only preliminary at this stage so the formatting could change.
This file was really to work out the math and as such as very fine resolution, were
in practice it may be rather coarse like fifty or one hundred rpm like the sewing
machine controller.

One thing I did notice was that the tool paths vary in there spacing so the chipload
will be different, I did while debugging look at the largest slice in the tool path and
it and all the tool paths up into the corner were ok as they were still under the chipload.
The spiral lead in and outs were too small and could have had the step over  adjusted up.

There are some new variables in the pp
Minimum Spindle Speed.
Minimum Feedrate.
Number of Flutes on the cutter.
Smoothing variable.


Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1645
    • View Profile
Re: BLDC spindle
« Reply #4 on: August 30, 2022, 12:27:41 pm »
While twiddling my thumbs waiting for the drive to come, It’s been shipped
but the delivery date has been set back to sept 17.
I’ve ‘more or less’ finished the constant chip load feed rate adjuster off.

The pics are plots of the actual Gcode converted to csv for a spreadsheet.
One plots the Spindle speed against the feed rate showing the relationship
required for a chipload of 0.027 specified in the finishing mop and also style.

One thing to keep in mind though is that the MOP variables win if there’s a conflict
between the style variables and the mop variables.
This means that if you guesstimate the Spindle speed and feed rates and they are way off
the chip load then the mop settings ‘rule’ meaning no constant chip load, but that would be the
least of your problems.

The other one shows that the output Gcode feed rate and spindle speed are Linear, which is
nice as it’s a linear function.
I can not do any more until the drive shows up, as I need to characterise the system as a whole
determining it’s input response time and resolution.

In preparation for tapping in the future I wrote some sevro code for an arduino mega2560
It interfaces with the drive so that, along with an encoder will give me the ability to use
it in velocity (Spindle output from Mach3) or position mode (step and direction ‘B’ axis in Mach3), it
wont be great in position mode but good enough for tapping I hope.

« Last Edit: August 31, 2022, 13:28:27 pm by dave benson »

Offline Dragonfly

  • CNC Jedi
  • *****
  • Posts: 2565
    • View Profile
Re: BLDC spindle
« Reply #5 on: August 30, 2022, 15:45:05 pm »
I follow your thread but you are so far ahead in these matters that I can only mark my presence.

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3263
    • View Profile
Re: BLDC spindle
« Reply #6 on: August 30, 2022, 16:02:51 pm »
I follow your thread but you are so far ahead in these matters that I can only mark my presence.

The same here. I'm enjoying it and hoping to learn something.
My 2¢

Win10 (64 bit, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, Endurance Laser.

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1645
    • View Profile
Re: BLDC spindle
« Reply #7 on: August 31, 2022, 13:34:13 pm »
I’m looking forward to the drive getting here.
I must say this at the outset, just using the present drive
and replacing the Hall sensor with a pot has been a win
It the 5 volt output from the drive is referenced to neutral.
It’s also not to linear maybe one of the log pots would be better.
If I were to connect this present  drive to Mach3, there would be a calibration
I did check the Hall sensor with a meter not the scope.
If my main concern was tapping, then there are far better alternatives out there
The tapping head I made a few years ago now, has a servomotor\gearbox and controller
and engages with a direct drive coupling. It works faultlessly because it works
in step and direction mode (position). M1 to M12’s
I’m just doing the tapping side of things for a bit of fun and the challenge really.
I did try to download the drive manual, but had no luck, I did find one sellers website
with a lot more info but still not enough.

There is a guy on Utube  that has a video about FOC for BLDC motors using an Arduino
he was able to step the 11 pole motor about 1K times per rev, this would be ok for tapping
and at 1750 rpm at the spindle only 60k pulses at the motor, with my Mach3 kernal speed of 60k
this could be feasible. I think this motor is an 6 or 8 pole (I’ll have to look inside it) so the resolution
will be less than 1K not ideal but maybe good enough.
If all else fails, the sewing machine drive will be redundant I could use the power output stage and the
code from the video and have a spindle that can be used in either mode, although step and direction
would be my go to for constant chip load and tapping if it’s possible.

I have tested more files and changed the code quite a bit, for example when the minimum
spindle speed is reached but this is to high for the feed rate calculated then a re-compute
is done to get the chip load correct and the feed rate set higher to suit the minimum
spindle speed.
There are sometimes when you may be unsure of the surface cutting speed for the material
you are going to cut for example you know you have steel but are not sure what alloy if any
so at the moment I have set the spindle speed to max 1750 rpm and applied 280 mm\minute
feed rate (this is what I have cut previously with higher spindle speeds ), this results in a way too
high chip load at 1750 rpm, but the feed rate adjuster will use the spindle speed from the mop and
vary the feed rate to suit the chip load from the style and in this case it varied the feed rate between
26 mm/min and 189 mm/min  and 1750 to  243 rpm for a constant chip load of 0.027.
I think I’ve blundered over a way to use the constant feed rate adjuster with all of the other mop types
including the 3d ones, by the time the drive gets here I’ll have a pretty good idea if it’s possible.


Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1645
    • View Profile
Re: BLDC spindle
« Reply #8 on: September 01, 2022, 05:35:48 am »
Ivan and Bubba.

As I cannot do any more until the drive comes, I made a CB file in Inch and Metric.
If either of you have a variable speed spindle and want to try it out then I post this debug
version, I’ve tried it out with metric and imperial files.
There is a CB file PPT and PP and a style for Imperial and metric in the folder.
Your spindle will have a finite but variable response time and a resolution and
at the moment the PPT is outputting very fine resolution meaning that the spindle
may not be able to respond to commands that are in the Gcode.
A practical way to see if the commands are being executed is look at the cut surface and listen
to it, what you should hear is, the spindle speed and X and Y axes all varying in frequency.
the sound of the cutter in the material should be consistent though.


Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1645
    • View Profile
Re: BLDC spindle
« Reply #9 on: September 02, 2022, 05:58:59 am »
As part of the backup plan B (if I cannot do good enough) positioning with
the new drive for tapping, I’ve downloaded and installed the Simple Foc lib.
GitHub - simplefoc/Arduino-FOC: Arduino FOC for BLDC and Stepper motors - Arduino Based Field Oriented Control Algorithm Library

I already have it running on PlatformIO in VS studio code for a 32 bit microcontroller
ESP32. This is an open source but, in my opinion a professional grade lib.

Some of the example files are already good enough for step and direction control
without any modification.
Part of the package which you install separately and requires Python (I have Anaconda)
is a real time monitoring system that can program on the fly. If you want to roll your own
BLDC motor controller position or velocity it’s a gem.


Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1645
    • View Profile
Re: BLDC spindle
« Reply #10 on: September 05, 2022, 06:16:53 am »
I got a chance to do a little more, and put the code from the original post
though Mach3 where it promptly choked as I made a syntax error in the PP.
I’d left a closing comment bracket off (which didn’t bother Camotics).

I’ve also (because I’m doing 3D files now) had to remove the debug data output
as it takes up a lot of memory. I’ve included the CB file and with the 3D surface
it is outputting and the new PP and PPT.

I did have a look inside the controller and have identified the components and inputs
to the gate driver and outputs from the microcontroller (washing machine).
In theory there’s enough information to remove the microcontroller and replace
it with an ESP32 but that chip is a surface mount tiny, perhaps half the size of my
pinky fingernail, and I would have to remove it and solder some patch leads from
the ESP32 and I don’t know if my soldering skills are up to it.

On a side note, I bought the drive from Aliexpress and they sent me a message today
saying that if the drive isn’t shipped in three days, I’ll receive a refund,  I’m hoping it’s just a
proforma and the seller will ship it as I’ve already wasted a  week or two.


Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1645
    • View Profile
Re: BLDC spindle
« Reply #11 on: September 09, 2022, 09:56:12 am »
The drive has been sent, so plan A is still looking ok.
I managed to get the ppt to work with the 3D files.
G1’s, G2’s and G3’s at constant chip load.
At this point I can’t characterise the drive response, but
it will take some time to go from max rpm to stopped, and
and variable amount of time for changing from one rpm to another
depending on how far apart the drive rpm and the commanded new rpm.
In the pic of a sample Gcode at the line indicated you can see a G2
running at roughly 100 mm/m and 960 rpm, the next line has a G1 which
in theory should be ran at 286 mm and 1592, the situation here is that the
line is a very short segment and the drive cannot respond instantly meaning
(maybe stuttering) or not actually performing the task, so for segments of Gcode
like this I’ve removed the feed and spindle changes. I will change this value to suit
the drive when it gets here.

I tested all of the 3D mops machining statagey’s, on the Island stl.
The mops are setup as if I were going to cut them out of mild steel so the feed rates
and spindle speeds were set for 30 meters/min max spindle speed 1592 rpm, with
chiploads of 0.045 rougher and 0.027 finisher.

I found that with this model waterline tool paths were faster and gave a better surface.
The machining time varied from 2.67 days to 83 minutes. I’ll post the CB file.
I wanted to see how the 3d tool paths from CB looked like compared to the freecad ones.
And I see now that it has a Feeds and speeds calc, It has some handy features like material
removal rate and spindle power to take the cut.

I had a look at the code and it’s based on a look up table from Machinery’s handbook
and it’s feeds and speeds are the same as mine which is reassuring.

When I tried to do 3D paths with Freecad, I ran into a problem, those tool paths are
generated from a third party lib which you have to compile for your version of
Freecad and the version of python it was compiled with.
It is very old and written for VS studio 2013.

For plan (B) I tested out the servo @24v with a 1000 ppr encoder and ordered a Wemos
esp32 on an Arduino Uno format board and a current sensor and 100 mm x 100 mm analog
panel meter to add a spindle power meter.
The plan is to use velocity mode for machining and step and dir for tapping mode.


Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1645
    • View Profile
Re: BLDC spindle
« Reply #12 on: September 22, 2022, 02:22:19 am »
A small update.

The ESP32 uno board has turned up and I’ve uploaded a FOC BLDC example.
I’m using VS studio code and platformIO and a JTAG programmer it went well.
The only thing I had to do  (on the board) was to find the JTAG port and solder
a pin header on, it’s not very well marked and I had to find the schematic.

The current measuring module turned up, but I don’t like the thought of it carrying
the current, so I’ll order a module with a transformer.

The drive is out for delivery, so hopefully will turn up in the next couple of days.
I’ve done some more work on the PPT and because I can’t characterise the step response
I’ve implemented a schema where the feed rate adjusting is turned on and off according
to the length of the move and the cutter circumference.
So if the length of the tool path is shorter than the circumference of the cutter it is ignored.
It’s kind of a dirty hack really, as it doesn’t take into account the number of cutting edges
but I wanted to do something rather than nothing while waiting for the drive to get here.

Late edit:
The drive turned up, It came with two wire wound (I think) pot’s in lieu of a  programmer.
I didn’t think this would be a problem as there was mention of PC debug software in the
web pages of the various vendors, couldn’t find it though, The programmer is on it’s way
another couple of weeks.

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1645
    • View Profile
Re: BLDC spindle
« Reply #13 on: September 22, 2022, 02:24:46 am »
I pulled the motor down to have a look at it’s build quality, and find out how many poles it had.
I got what I paid for, the motor body is an extrusion and the manufacturing is good.

The end plates are die cast and didn’t look that good, 6000 2rs  10 x 26 x 8 bearing.
I removed some flashing from where the metal would have entered the mould four pins, it
looked like no one inspected it, I removed the flashing with a small instrumentation screwdriver, It fell of
with no effort. If you have one of these motors its well worth pulling it apart and cleaning it as I
found some small debris fine AL dust from pressing in the coil pack.
The front end plate doesn’t have a Seal but rather a dust excluding rubber ring, so it must be
shielded from chips.
The staking of the hall sensor module is not robust, I moved it by lightly pressing on it with a finger and so glued it. 
The stakes are made out of plastic and the staking head looks like it was too hot and burnt the plastic as it
looked blistered and crumbly.
I’ve been using the original controller for a while now and even with long runs and some heavy cutting
it’s (the motor)  has not got hot and runs silent.
The very worst thing you can do to this motor is to get it too hot, this will kill it.
In the manual they warm about setting constant torque mode for this very reason.
I did connect the new drive knowing that the default settings were no good for this motor.
Especially the current, but also the pole count, so ran it for 30 second bursts, just getting the
hall sensor wiring correct.
Now I have to wait for the programmer.

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1645
    • View Profile
Re: BLDC spindle
« Reply #14 on: September 24, 2022, 05:56:57 am »
I’ve done some more work on the PPT checking it against the Troch mops and the 3D
As the PPT was made for the Troch mops, (which is its superpower) I did not want to
downgrade its performance in any way, and found that I had to make a separate style
for them.
In the style library pic you can see that there are 6 styles needed for a 6 mm endmill, two
each for the roughing and finishing for CB standard mops (endmill and Ball endmill), and
two for the troch mops.

Do not use the Troc styles with other mop types as they optimise away G1’s for G0’s.

I want to make clear that the values for the chipload which are obtained from the manufacturers
data sheet for the endmill are predicated on having a good heavy mill with flood cooling.
For the troc pockets the chipload produced a feedrate of 280 mm\m, this is correct, and I have
cut the pockets at this speed, but I had to attend the machine and flood fill the pocket and remove the
chips by hand, this gets old pretty quick, and I like to do something else while the mill is running.
So I run it between 220 and 245 mm/m where the Air blasts can keep the chips away from the cutter and
when the tool has reached full depth pour a little coolant in.
For highspeed spindles I did a test using a surface speed of 300 m/m, capping the spindle speed
between 10000 rpm and 16000 and a minimum feed rate of 2000 mm/m.

For highspeed spindles like 20000 or 24000 rpm with 2 pole motors the step response will be coarser than my spindle.
I’ve included a CB file, and the styles for a 6 mm cutter.
I did get the abacus out and for my spindle, if it can move from 1 hz to 2 hz in 10 ms then
I won’t have to filter the feed rates. I won’t know if this is the case or not until I fire up the new drive.