Hello Guest it is October 20, 2020, 02:03:37 AM

### Author Topic: Motor Tuning Math  (Read 2540 times)

0 Members and 1 Guest are viewing this topic.

#### rrsquez

• 13
##### Motor Tuning Math
« on: December 13, 2015, 10:28:17 PM »
Hello, I have a problem with losing steps. Before I go and buy a new set of motor drivers, I wanted to explore the math behind the motor tuning (or I might end up right back where I am). I am cutting PCB copper to make circuit boards. I only need to penetrated 0.01 mm from the surface (0.05 mm is actually acceptable). Someone pointed out to me that is only 0.4 mil and is hard to control too. That made me think about the tuning parameters.

Okay, here's some math. I used a caliper to carefully measure the pitch of my lead screw. It seems to be very precisely 2.5 mm per turn (used several threads, then averaged). My system seems to have everything in metric, so that's why I chose it.

1 turn = 360 degrees, so 1/360 (turn/degrees) = 1  (unity)
2.5 (mm/turn) * 1/360 (turn/degrees) = 1/144 (mm/degrees)     This is my lead screw

My stepper motor clearly says "1.8 degrees per step", so
1/144 (mm/degrees) * 1.8 (degrees/step) = 0.0125 (mm/step), or 80 (step/mm)     This is my lead screw/motor combination

What's confusing me is that my CNC manufacturer has indicated "640" as the motor tuning parameter for "Steps per". In my case, that's Steps per millimeter.
Using that number: 640 (step) * 0.0125 (mm/step) = 8 mm

The answer should have been "1 mm", not 8. The funny thing is that this 640 value seems to work very well. I have no "scale" issues with X, Y and Z motions using this number. I just don't understand the math behind Mach 3. I think this might be due to the Tonsen controllers then. In the Mach 3 tutorial video on YouTube, the value they recommend is "2000". I've never seen a stepper motor with that kind of resolution.

HERE IS THE IMPORTANT PART:
Most importantly to me, I'm trying to get to "-0.01" mm (repeatedly), but I can see that my step resolution is actually 0.0125 mm/step from the math above. If I repeatedly go to 0, then -0.01, then to 2, then repeat, will I be loosing that 0.0025 mm every time it cycles through this sequence? These are the only values that I ever command my Z-axis to (except to park it at 4 mm when done).

Since my math (theory) shows my steps per mm as being 8 time greater than what practice says, does that mean my resolution is also 8 times better (0.0125 mm divided by  8 is 0.0015625 mm)? Somehow I think not.

I noticed my program (CopperCAM) can't generate values smaller than 0.01 mm. What precision of mm does Mach 3 support?

Sorry, I know I've asked a lot here. Thanks to anyone that helps. Tweakie and RICH have been great to me, but I don't want to look a gift horse in the mouth.

Sincerely, Richard V

#### Tweakie.CNC

• 8,506
• Super Kitty
##### Re: Motor Tuning Math
« Reply #1 on: December 14, 2015, 02:40:31 AM »
Hi Richard,

Quote
Sorry, I know I've asked a lot here. Thanks to anyone that helps. Tweakie and RICH have been great to me, but I don't want to look a gift horse in the mouth.

No fear of doing that my friend - ask as many questions as you need.

From your calculations it would appear that your stepper driver is set to 1/8th microstepping.

I don't know the exact figure (I am sure that someone here does) but Mach3 supports a precision which is many times greater than the accuracy of any of our machines so you just need to resolve this Z axis steps issue you are experiencing. I think we have mentioned it before but you have thoroughly checked all the mechanicals for loose grub screws, slipping coupler, etc., etc. ??

Tweakie.
KEEP SAFE !

#### beefy

• 138
##### Re: Motor Tuning Math
« Reply #2 on: December 14, 2015, 02:50:58 AM »
Let's try and simplify the maths a bit.

Thread pitch = 2.5mm so one turn of the leadscrew means you move 2.5mm.

1.8 degrees per step is 200 steps per revolution.

So 200 steps divided by 2.5mm = 80 steps per mm so we've both come to the same answer on that one.

Check your stepper drive settings. 640 steps/mm would mean your drive has to have the microstepping set to 8.
(My Gecko drives are set to microstepping of 10 so instead of 200 steps per revolution I get 2000 steps per revolution).

If your stepper drives do have there microstepping set at 8 then yes you have 8 times as many steps per revolution BUT from what I have read you cannot rely on those microsteps for accuracy, i.e. they may not yield exact physical movements of 1/8th of a normal full step movement. Like I say that's just what I've read. If that is true and excellent accuracy is required you may be better off gearing things down instead.

Hope that helps, I rushed it all because I'm in a hurry to do something.

Keith.

#### rrsquez

• 13
##### Re: Motor Tuning Math
« Reply #3 on: December 14, 2015, 02:55:08 PM »
Hello All. Tweakie, yes; checking the mechanicals is the first thing I did recently. At first I thought this was going to fix it, but it didn't help at all.

I think this "1/8 microstepping" may be an issue. I don't see how hardware can support this. That 1.8 degree/step is fundamental to the motor.

I'm feeling better about going out and spending the money on those drivers now. I just the idea of wasting money on something that doesn't fix the problem. I have no problem investing into the correct solution. I'm looking forward to getting a new Gecko drive! I'll let you all know how it goes.

Thanks, Richard V

#### rrsquez

• 13
##### Re: Motor Tuning Math
« Reply #4 on: December 14, 2015, 10:15:27 PM »
Hello All. I had an "Aha" moment. I found my problem. Refer to my previous post about the motor tuning math. My stepper motor resolution is 0.0125 mm. I was trying to get to -0.01 mm penetration depth on the Z-axis. I kept losing track of position.

This attached file demonstrates the fix. When I had the penetration set to -0.01, the problem occurs every time. I changed the value to -0.05 mm because it's an exact multiple of 0.0125 mm. Now it tracks perfectly. Now I don't have to sit and BABYSIT this machine anymore!

My 3-Axis CNC mill is a a "REDONDA" made by "www.DONGDADK.com", from China. It's a great little machine for the money I paid. I just had to work out this issue. If you have one too (eBay), don't be discouraged! I'm using it to make printed circuit boards. I use CopperCAM.

Thank you Tweakie and RICH. I wanted to share my solution with everyone in case the same problem happens to them. Simply put those "micro-steps" get lost! One has to observe the stepper motor / leadscrew step resolution. For me, that's 0.0125 mm (about 0.4 MIL).

Best regards, Richard V
« Last Edit: December 14, 2015, 10:19:12 PM by rrsquez »