Project of the Month built by driller1432

Help Support Home Model Engine Machinist by donating using the link above or becoming a Supporting Member.
Home Model Engine Machinist > The Tools and Tips > Machine Modifications > Arduino Rotary Table for Dummies

Reply
 
Thread Tools
Old 07-28-2017, 07:13 PM   #71
chucketn
Senior Citizen
 
chucketn's Avatar
 
Join Date: Dec 2009
Location: Jonesborough, TN
Posts: 1,170
Liked 137 Times on 120 Posts
Likes Given: 96

Default

I am printing Olsson's case for my RT controller. I have the bottom half printed, took over 9 hours. Had a problem printing the top half. The external mosfet in the heat bed circuit failed in the on condition. Luckily, I noticed the bed temp climbing and disconnected the wires to the bed. Shortly thereafter, the Y axis hung, causing many missed steps, which and caused a large level shift, ruining the print at 8 hours + . I will attempt the top half again when the replacement mosfet comes in.
For ChuckF, I can't remember now, but was your code based on Bob Pratl's code?


__________________
Chuck in E. TN

HF X2, Micromark 7x14, Green 4x6 bandsaw, Anet A8 3d printer
chucketn is offline  
 
Reply With Quote
Old 07-29-2017, 08:00 AM   #72
Foozer
HMEM_LIFETIMESUPPORTER.png
 
Join Date: Nov 2008
Location: Camano Island, WA
Posts: 1,102
Liked 74 Times on 66 Posts
Likes Given: 2

Default

Never Mind - Try it again after some sleep . .



Last edited by Foozer; 07-29-2017 at 08:22 AM. Reason: Bad math
Foozer is offline  
 
Reply With Quote
Old 07-29-2017, 08:44 PM   #73
rodw
 
Join Date: Dec 2012
Posts: 1,046
Liked 311 Times on 242 Posts
Likes Given: 161

Default

Quote:
Originally Posted by billanygard View Post
I have read a little in an "sidethread" about another solution but for now that is to heavy for me.

//Olsson
The problem is that no matter what you do you end up with a required division that includes a fraction of a step under some circumstances and stepper motors can only move whole steps. You will get errors if your script simply calculates a fixed number of steps per division.

Imagine a rotary table doing 36 divisions around the complete circle and the required number of divisions is 100.333333333 steps per division. So if you just round this to 100 steps, by the time you get right round the circle, you have missed 36 x 0.3333 = 12 steps.

The only way to fix this is to work out a way of distributing those missing steps around the circle. In our imaginary example, if you moved 101 steps every third division, your problem is solved.

Work out how to code that and your problem will go away.
__________________
RodW
Brisbane, Australia
vehiclemods.net.au
rodw is offline  
 
Reply With Quote
Old 07-30-2017, 03:06 AM   #74
Foozer
HMEM_LIFETIMESUPPORTER.png
 
Join Date: Nov 2008
Location: Camano Island, WA
Posts: 1,102
Liked 74 Times on 66 Posts
Likes Given: 2

Default

float Multiplier = (StepsPerRotation * TableRatio)/360.00;

From: ToMove = (Degrees*Multiplier);
to: ToMove = round(Degrees * Multiplier);

Should get you close . . . At least
Serial.print("ToMove # Steps = ");
ToMove = round(Degrees * Multiplier),
Serial.println(ToMove);
Degrees = Degrees + 1;
if(Degrees==361)Degrees=0;
delay(500);
shows 360 degrees as 1200 steps . . .
__________________
"Nothing is more irritating than that which exposes the pedigree of ideas"----Lord Acton----
Foozer is offline  
rodw Likes This 
Reply With Quote
Old 10-24-2017, 04:07 AM   #75
tjwal
 
Join Date: Sep 2013
Posts: 21
Liked 4 Times on 3 Posts

Default

Quote:
Originally Posted by Foozer View Post
float Multiplier = (StepsPerRotation * TableRatio)/360.00;

From: ToMove = (Degrees*Multiplier);
to: ToMove = round(Degrees * Multiplier);

Should get you close . . . At least
Serial.print("ToMove # Steps = ");
ToMove = round(Degrees * Multiplier),
Serial.println(ToMove);
Degrees = Degrees + 1;
if(Degrees==361)Degrees=0;
delay(500);
shows 360 degrees as 1200 steps . . .
Iím in the process of adding a routine that will allow the steps and table ratio to be input rather than embedded in the code.

While I was going through the code I noticed the issue with ďMultiplierĒ as well. Unless the steps and table ratio give an integer number of steps per degree the controller wonít be accurate. It likely works with most RTs but likely wonít with a timing belt pulley arrangement. There are a number of fixes for this. Changing Multipler to a float is the easiest. Iím going to test a couple things of other methods. I think one of them will also adjust for steps that have been lost through rounding. Iíll post my results and code when Iím done.
tjwal is offline  
 
Reply With Quote
Old 10-24-2017, 01:43 PM   #76
rodw
 
Join Date: Dec 2012
Posts: 1,046
Liked 311 Times on 242 Posts
Likes Given: 161

Default

Quote:
Originally Posted by tjwal View Post
There are a number of fixes for this. Changing Multipler to a float is the easiest.
Unfortunately, this will not work becasue the float has to be converted back to an integer to determine the number of steps to move. So either you will end up truncating or incrementing the integer value. This will lead to errors if the number of steps per division does not end up being a whole number. You cannot move a fraction of a step.

Consider a mythical example that requires 36 divisions per 360 degrees and each division requires exactly 100.33 steps. to move around a circle, you will need 100.33 * 36 = 3612 steps. But truncating to 100 will result in 100 x 36 = 3600 steps meaning you will be 12 steps short at the end of a 360 degree move. This is a significant error and will be noticeable.

So you must work out a way to distribute the 12 step error across the 36 divisions. The solution is to move 100 steps per division and every third division, move 101 steps. How you code that is up to you but two alternative approaches have been documented in other threads on this forum.
__________________
RodW
Brisbane, Australia
vehiclemods.net.au
rodw is offline  
 
Reply With Quote
Old 10-24-2017, 03:53 PM   #77
tjwal
 
Join Date: Sep 2013
Posts: 21
Liked 4 Times on 3 Posts

Default

I agree, changing Multiplier to float only addresses one of the issues. It does not fix the accumulated truncation error that you describe. Iíll have to find the other threads you.

If Iím correct, my method will have less than Ĺ step error at each division. Iíll have to find the discussions you refer to, perhaps itís the same solution.

In any case my original intent was to allow for steps and table ratios to be an input. At the same time Iím changing to long integers so I can use 16th steps with my 90:1 RT.
tjwal is offline  
 
Reply With Quote
Old 10-25-2017, 12:49 PM   #78
rodw
 
Join Date: Dec 2012
Posts: 1,046
Liked 311 Times on 242 Posts
Likes Given: 161

Default

The approach I took on this thread
http://www.homemodelenginemachinist....t=25091&page=3
was to accumulate the fractional error and add a step when it was > 1.0 add another step.

Chuck Fellowes followed another approach. For the start of each division, he tracked how far around the circle he was and calculated how far around the circle he would be after the division, take the difference and move that number of steps.

Ultimately the result is identical. The adjustment algorithm depends a bit on the complete methodology you use to do your divisions.

As far as the data structure goes, using int or long will make no difference unless the number of steps moved exceeds the resolution of the data type. When I did this, I wanted to avoid the use of floats and inevitable rounding errors so I measured angles in the number of seconds of a degree using an unsigned long as there are 1,296,000 seconds in a circle. I wrote routines to input and display this value for angles in degrees, minutes and seconds but internally worked with seconds. Then when actually moving the rotary axis, I implemented a trapezoidal acceleration/deceleration algorithm to maximise torque on startup and overshoot at the end of the move. (You can't do instantaneous accelleration to maximum speed due to the laws of physics).

So what on the surface looks like a simple application becomes amazingly complex, particularly if you use interrupt driven step generation.
__________________
RodW
Brisbane, Australia
vehiclemods.net.au
rodw is offline  
 
Reply With Quote
Old 10-26-2017, 05:36 PM   #79
tjwal
 
Join Date: Sep 2013
Posts: 21
Liked 4 Times on 3 Posts

Default

Rod
I havenít examined Chuckís code but from your description itís the same method as what Iím incorporating. So far it appears to be an almost trivial change to the code. I have more debug print statements than actual new code.

Iíve just completed my controller and donít have it connected to a spindle so I canít directly test the accuracy. The numbers look good though.

It will be a while before I build the spindle so Iíll clean up my code and post it. Perhaps someone can test it out.

Iíve downloaded your code and when I get time will examine your approach.

Cheers
John
tjwal is offline  
 
Reply With Quote
Old 10-27-2017, 06:43 PM   #80
tjwal
 
Join Date: Sep 2013
Posts: 21
Liked 4 Times on 3 Posts

Default

I have finished modifying the code so it now allows for finer microstepping and high ratio rotary tables. I've changed it to accumulate steps so there should never be more than 1/2 step error. I can't physically check this as I don't have it connected to an RT, but I've included a debug macro in the code that when enabled prints values to the serial monitor. As best I can tell the code is working. I've included the code and a text file noting the changes I have made. For installation follow the excellent instructions posted by bmac2 at the start of this thread.


Attached Files
File Type: zip Dummies_Rotary_Table_Control_2017_beta.zip (3.2 KB, 70 views)
tjwal is offline  
2
People Like This 
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Arduino control for a 3Ē rotary table bmac2 Machine Modifications 101 04-23-2017 01:17 AM
Rotary table Coomba General Engine Discussion 64 08-22-2016 04:34 PM
wtb rotary table toolroom Buy / Sell / Trade / eBay 5 01-04-2016 03:31 PM
My Second Rotary Table,80 mm table. gus Introduction 75 07-29-2014 08:36 PM
Using a rotary table. radfordc General Engine Discussion 10 03-10-2009 12:58 PM



Newest Threads






- Top - Member List